Recent announcement from php.net about end support for php4 make me thinking about upgrading to php5.
All server already use latest php4 version php 4.4.7 with mysql support (4.0.27) and apache1.37
Upgrading start from student server :
1. Uninstall all related php4 ports
2. Install php5 ports
kongja# cd /usr/ports/lang/php5 && make clean
===> Cleaning for apache-1.3.37_4
===> Cleaning for php5-5.2.3
kongja# cd /usr/ports/lang/php5 && make install
===> php5-5.2.3 : Your apache does not support DSO modules.
*** Error code 1
Stop in /data3/ports/lang/php5.
wew, seem that I must reconfigure apache first 🙂
3. Reconfigure apache, nothing to do except build with DSO support.
4. Restart apache
kongja# apachectl restart
/usr/local/sbin/apachectl restart: configuration broken, ignoring restart
/usr/local/sbin/apachectl restart: (run ‘apachectl configtest’ for details)
kongja# apachectl configtest
Syntax error on line 235 of /usr/local/etc/apache/httpd.conf:
Cannot load /usr/local/libexec/apache/libphp4.so into server: Cannot open "/usr/local/libexec/apache/libphp4.so"
Ouch, deinstaling php4 not automatically remove php4 things.
Do it manually by give # sign in ‘php4’ related line
kongja# ee /usr/local/etc/apache/httpd.conf
LoadModule setenvif_module libexec/apache/mod_setenvif.so
#LoadModule php4_module libexec/apache/libphp4.so
LoadModule security_module libexec/apache/mod_security.so
5. Try again install php5 :
kongja# cd /usr/ports/lang/php5 && make clean
===> Cleaning for php5-5.2.3
kongja# cd /usr/ports/lang/php5 && make install
===> php5-5.2.3 : Your apache does not support DSO modules.
*** Error code 1
Stop in /data3/ports/lang/php5.
Sighh… no DSO support 🙁
Ok, how about this:
uninstall apache13
install php5 and let php5 dependency solve the problem for me 🙂
ok, everthing seem smooth till see this ::
/sbin/ldconfig -m /usr/local/lib
===> Registering installation for libxml2-2.6.29
===> Returning to build of php5-5.2.3
===> Configuring for php5-5.2.3
exec: /usr/local/bin/autom4te259: not found
*** Error code 127
Stop in /data3/ports/lang/php5.
*** Error code 1
7. Checking for autoconf
kongja# pkg_info | grep autoconf
autoconf-2.13.000227_5 Automatically configure source code on many Un*x platforms
autoconf-2.53_3 Automatically configure source code on many Un*x platforms
autoconf-2.59_2 Automatically configure source code on many Un*x platforms
wow
uinstall unnecessary autoconf
kongja# pkg_delete autoconf-2.59_2
kongja# pkg_delete autoconf-2.53_3
pkg_delete: package ‘autoconf-2.53_3’ is required by these other packages
and may not be deinstalled:
automake-1.5_3,1
kongja# pkg_delete autoconf-2.13.000227_5
8. Check again
try again :
===> Compressing manual pages for php5-5.2.3
===> Registering installation for php5-5.2.3
===> SECURITY REPORT:
This port has installed the following files, which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache/libphp5.so
/usr/local/bin/php
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type ‘make deinstall’
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://www.php.net/
9. Great, time to check
kongja# rehash
kongja# php -v
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/xcache.so’ – Cannot open
"/usr/local/lib/php/20060613/xcache.so" in Unknown on line 0
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 16 2007 09:36:46)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
10. Installing xcache
kongja# cd /usr/ports/www/xcache && make install
===> Found saved configuration for xcache-1.2.0
=> xcache-1.2.0.tar.bz2 doesn’t seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from http://210.51.190.228/pub/XCache/Releases/.
xcache-1.2.0.tar.bz2 87% of 77 kB 8532 Bps
*****************************************************************************
===> Registering installation for xcache-1.2.0
kongja# rehash
kongja# php -v
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 16 2007 09:36:46)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with XCache v1.2.0, Copyright (c) 2005-2006, by mOo
11. Installing extension for php5
kongja# whereis php5-extensions
php5-extensions: /usr/ports/lang/php5-extensions
kongja# cd /usr/ports/lang/php5-extensions && make install
12. Last thing to do
edit httpd.conf to make sure these lines exist, or only php CLI available not php as apache module 🙂
LoadModule php5_module libexec/apache/libphp5.so
AddModule mod_php5.c
<IfModule mod_php4.c>
AddType application/x-httpd-php .php .htm .html .asp .aspx
AddType application/x-httpd-php-source .phps
</IfModule>
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .htm .html .asp .aspx
AddType application/x-httpd-php-source .phps
</IfModule>
13. Restart apache
14. Done
Great, combination ::
apache-1.3.37_4
php5-5.2.3
mysql-client-4.0.27 Multithreaded SQL database (client)
mysql-server-4.0.27 Multithreaded SQL database (server)
Ok student, we use php5 now 😉