-# without suffix, install as php.cli
-%if "%{?php_suffix}" == ""
-%define phpfn %{name}.cli
-%else
-%define phpfn %{name}
+# versioned suffix is always installed
+libtool --mode=install install -p sapi/cli/php $RPM_BUILD_ROOT%{_bindir}/php%{ver_suffix}
+cp -p sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1/php%{ver_suffix}.1
+
+%if %{with default_php}
+# man for php
+echo ".so php%{ver_suffix}.1" >$RPM_BUILD_ROOT%{_mandir}/man1/php.1
+# link as /usr/bin/php
+ln -sf php%{ver_suffix} $RPM_BUILD_ROOT%{_bindir}/php
+# php.cli link for backward compatibility
+ln -sf php $RPM_BUILD_ROOT%{_bindir}/php.cli