# gunzip php-5.2.6.tar.gz
# tar xf php-5.2.6.tar
# cd php-5.2.6
# ./configure --with-apxs2=/usr/sbin/apxs
...................................
...................................
# make
...................................
...................................
# make test
...................................
...................................
# make install
...................................
...................................
# which php
/usr/local/bin/php
# php -v
PHP 5.2.6 (cli) (built: Aug 12 2008 15:57:07)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
This way I installed PHP5 on my system.
A word of caution: PHP5 is not 'officially' supported by Redhat Linux 4.
Further Update:
The problem with PHP upgrade doesn't finish till now. I was trying to run a sample index.php from my apache's home directory but couldn't get the desired output. Instead, I was getting the following in error_log file:
[Tue Aug 12 16:46:51 2008] [notice] SIGHUP received. Attempting to restart
*** glibc detected *** double free or corruption (!prev): 0x000000552afbd390 ***
[Tue Aug 12 16:46:51 2008] [notice] seg fault or similar nasty error detected in the parent process
[Tue Aug 12 16:48:00 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Aug 12 16:48:01 2008] [notice] Digest: generating secret for digest authentication ...
[Tue Aug 12 16:48:01 2008] [notice] Digest: done
[Tue Aug 12 16:48:01 2008] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Tue Aug 12 16:48:01 2008] [notice] LDAP: SSL support unavailable
[Tue Aug 12 16:48:01 2008] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Tue Aug 12 16:48:01 2008] [warn] pid file /etc/httpd/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Tue Aug 12 16:48:01 2008] [notice] Apache/2.0.52 (Red Hat) configured -- resuming normal operations
[Tue Aug 12 16:48:08 2008] [error] [client 10.84.64.122] Directory index forbidden by rule: /var/www/html/
[Tue Aug 12 16:49:30 2008] [notice] child pid 20637 exit signal Segmentation fault (11)
[Tue Aug 12 16:49:43 2008] [notice] child pid 20638 exit signal Segmentation fault (11)
[Tue Aug 12 16:54:58 2008] [notice] child pid 20639 exit signal Segmentation fault (11)
So, I had to further dig into the problem. And here I what I finally did to make it working:
1) Renamed the /usr/bin/php to /usr/bin/OLD.php
2) In /etc/httpd/conf.d/php.conf file, modified the enties for LoadModule. I my case, now it looks like:
LoadModule php5_module modules/libphp5.so
3) In /etc/httpd/conf/httpd.conf file, made sure that I have following lines: (check for the location of lines... the numbers before the contents represent the line number in my httpd.conf file. It can be different in other systems/env)
------------
110 SetHandler application/x-httpd-php
195 LoadModule php5_module modules/libphp5.so
383 DirectoryIndex index.html index.html.var index.php
806 AddType application/x-httpd-php .php
-------------
4) In /etc/httpd/modules/ (this is a link to /usr/lib64/httpd/modules/ directory), renamed the libphp4.so to _libphp4.so so that apache should not try to load it.
MOST IMPORTANT: While doing all these things, make sure that the backup of these files (if at all you want to keep, anyway) is not in the same directory. The stupid Linux reads all files available in some specific directories!!! I have seen this behavior in Linux only. With this, all the changes which are made in actual files are no longer valid because it reads all files :-)... so be careful while doing such things.
Once these 4 changes were done, I restarted apache and went to http://myserver/test.php ... and my goodness.. it started working!
This was time consuming for me and on top of it, I am not a big fan of PHP/Linux both ;)
No comments:
Post a Comment