Answer: f(x)≡1 and f(x)=x.
By putting a=1 to f(φ(a))=φ(f(a)) we get f(1)=φ(f(1)) and hence f(1)=1. By putting a=2 we get f(1)=φ(f(2)) and since f(1)=1 we get that either f(2) is either 1 or 2.
Case 1: f(2)=1. Since 1=f(2)=f(φ(3))=φ(f(3)) we get that f(3) is either 1 or 2. But since (3−1)∣f(3)−f(1) we get that f(3)=1. By induction we show that f(n)=1 for all positive integers n. Assume that f(a)=1 for all a=1,2,…,n−1. Then since f(φ(n))=φ(f(n)) and φ(n)≤n−1 we get φ(f(n))=1 and hence f(n) is either 1 or 2. Finally again since n−(n−2)∣f(n)−f(n−2) we get that f(n)=1. Done.
Case 2: f(2)=2. By induction we show that f(n)=n for all positive integers a. Assume that f(a)=a for all a=1,2,…,n−1. By the first condition and by inductive hypothesis for each 1≤a≤n−1 we have n−a∣f(n)−a or equivalently n−a∣f(n)−n. Therefore, for each integer 1≤m≤n−1 we have m∣f(n)−n. Hence the common divisor M of all integers 1≤m≤n−1 also divides f(n)−n; f(n)=Ms+n, where s is integer. Then since φ(n)<n by the second condition and by inductive hypothesis φ(n)=φ(Ms+n). On the other hand, since each integer k with (n,k)=1 and k<n divides M we have (k,Ms+n)=1. Therefore, φ(n)≤φ(Ms+n). If s=0 then (Ms+n−1,Ms+n)=1 and hence we get that φ(n)<φ(Ms+n). This contradiction shows that s=0 and f(n)=n. Done.