zeus php 5.2.3 upgrade

zeus

Compiling php5 for zeus/fastcgi on Solaris 9.

php needed to be upgraded on a webserver to support several scripts that used the new msyqli database interface.

Sun Studio 12 was installed in /export2 because there wasn’t enought space at /opt, the default install location.

The following environmental variables were used:

export PATH=/export2/SUNWspro/bin:/opt/csw/bin:/usr/local/bin:/opt/csw/bin:/usr/ccs/bin:$PATH
export MANPATH=/opt/csw/man:/export2/SUNWspro/man
export CC=/export2/SUNWspro/bin/cc
export CXX=/export2/SUNWspro/bin/CC
export CFLAGS="-xO5 -fast"
export LD_LIBRARY_PATH=/opt/csw/mysql5/lib/mysql:/opt/csw/lib:/usr/local/lib:/usr/sfw/lib

The following was used to configure php 5.2.3:

./configure --prefix=/usr/local/php5fcgi --with-config-file-path=/etc/php5 
--enable-fastcgi --with-libxml-dir=/opt/csw/ --with-xpm-dir=/opt/csw --with-gd 
--with-freetype-dir=/opt/csw --with-tiff-dir=/opt/csw --with-jpeg-dir=/opt/csw 
--with-png-dir=/opt/csw --enable-exif --with-zlib-dir=/opt/csw/ --enable-mbstring 
--with-expat-dir=/opt/csw --with-ldap --with-ldap-dir=/opt/csw 
--with-ldap-sasl=/opt/csw  --with-openssl=/opt/csw 
--enable-dbase --with-mysql=shared,/opt/csw/mysql5  
--with-mysqli=shared,/opt/csw/mysql5/bin/mysql_config

php5 fastcgi startup script /etc/init.d/php5.fcgi:

#!/sbin/sh
#
#       PHP fcigrunner start up script
#       Jason Kalawe, 8/22/2004
#       Adapted from mysqld start up script by Nick Johnson
#
case "$1" in
'start')
        PHP_FCGI_CHILDREN=8
        export PHP_FCGI_CHILDREN
        PHP_FCGI_MAX_REQUESTS=100
        export PHP_FCGI_MAX_REQUESTS
        cd /opt/zeus/web/bin
        ./fcgirunner --user=nobody --group=nobody --pidfile=/export/web/logs/fcg
iphp.pid 8002 /usr/local/php5fcgi/bin/php-cgi


        ;;

'stop')
        kill -TERM -`cat /export/web/logs/fcgiphp.pid`
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0

php5 fastcgi

Previously, compiling php4 with fastcgi resulted in the /usr/local/php/bin/php binary being fastcgi compatible. This isn’t the case with php5. With php5 the /usr/local/php5fcgi/bin/php binary isn’t compatible with fastcgi. The compatible binary is /usr/local/php5fcgi/php-cgi.

php5 Pear libraries

Check what pear libraries were installed for php4:

/usr/local/php/bin/pear list

Install the same libraries for php5:

/usr/local/php5fcgi/bin/pear install Net_Socket Net_UserAgent_Detect 
XML_Parser XML_RPC DB DB_Pager Date HTML_Template_IT HTTP Mail

Modify /etc/php5/php.ini

php’s ini file needed to be modifed:

include_path = ".:/usr/local/php5fcgi/lib/php:/export/web/includes/php"

MySQL 5

In order to fully exploit the power of php5, mysql5 should also be upgraded. I used blastwave.

Make a copy of the mysql data directory:

cd /export/web/mysql
cp -pr data data-msyql5

Copy the blastwave default mysql 5 conf file:

cp /opt/csw/mysql5/share/mysql/my-medium.cnf /etc/mysql5.cnf

Edit the file:

datadir         = /export/web/mysql/data-mysql5

Comment out the section about replication master:

#log-bin=mysql-bin

After testing that everything works normally, the data-mysql5 directory was renamed to data and the previous data directory was archived.

MySQL startup scripts

Nick Johnson’s older startup script was modified:

#!/sbin/sh
#
#       Mysqld start up script
#       Nick Johnson March 2004
#
case "$1" in
'start')
        #cd /opt/csw/mysql5
        /opt/csw/mysql5/bin/mysqld_safe --defaults-file=/etc/mysql5.cnf &
        ;;

'stop')

        kill `cat  /export/web/mysql/data/stillmatic.pid`
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0