SLES 9 is some what incomplete OS especially in php software for x86_84 arch. There are some php extensions missing in this release, such as iconv. I realized this when install Mailbee Webmail. At the beginning it was very tragic problem, because I’m so lazy to think how to solve the problem. And beside there is no rpm package for this missing ext available in the internet. But still the show must go on and the problem need to be solve. Another importance is that in other webapplication (gdl) php5 required therefore the application work normally.
So I brave my heart not just only fill the missing ext but also completely change the system. The newest php installed in the SLES 9, at that moment php 5.2.6 was the newest.
Before install php there is important note that newbies like I’m need to pay attention. That is if we want to install complete package, first of all we need install library. For example, if we want install mhash support so we need to install mhash-devel first. And so on.
For my SLES the configuration I used is
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/sbin/apxs2-prefork --with-libxml-dir=/usr/local/libxml2 --enable-calendar --with-curl --with-zlib --with-jpeg-dir=/usr --with-gd --with-png-dir=/usr --with-freetype-dir=/usr --with-ttf --with-mysql --with-iconv --with-imap --with-imap-ssl --with-gettext --with-bz2 --with-curl --with-mcrypt --with-mhash --with-mime_magic --with-ncurses --with-openssl --with-readline --with-mm --with-snmp --enable-sockets --enable-ftp --enable-zip --enable-cli --enable-fastcgi --enable-cgi --with-libdir=lib64 2>&1 | tee build.log
Of course the directory up to your system. Another note is that php5 need newer version of libxml2. We need install newer libxml2 to complete the requirement.
When everything work smoothly, next step is configure apache2 to support php5. This can be done by edit the /etc/sysconfig/apache2 and add php5 in variable APACHE_MODULES. Here is for the example APACHE_MODULES="suexec access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif userdir ssl python php5" And remember not to mess with php4.
Next, copy the libphp5.so in the directory pointed in file /etc/apache2/sysconfig.d/loadmodule.conf.
And then we need conf file to make sure that php5 will be loaded. The file is called php5.conf and put in /etc/apache2/conf.d. The file contains following line:
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .html .htm
AddType application/x-httpd-php-source .phps
AddHandler application/x-httpd-php .php4
AddHandler application/x-httpd-php .php5
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .php4s
AddHandler application/x-httpd-php-source .php5s
AddHandler application/x-httpd-php-source .phps
DirectoryIndex index.php4
DirectoryIndex index.php5
DirectoryIndex index.php index.html index.htm
</IfModule>
And then restart apache service:
/etc/init.d/apache2 restart
Voila, your php5 have just installed. To make sure you can test with php function phpinfo.
Thank you
By: JekAdusedrund on August 3, 2008
at 2:52 am