My previous articles on installing PHP on CentOS dealt with installing PHP 5.2.6. I have found this to have some bugs that kill the process without error information. One bug I found, which was on an x86_64 server, was that converting an object to a string did this.
So, I have compiled the latest PHP version, 5.2.10 5.3.0 5.3.3, and put it in my own repository for easy installation. I have compiled it for CentOS 5 i386 and x86_64, and provided the source RPMS in the repo, if anyone wants to compile it for another OS or architecture.
Update 2009-07-03 – I updated the version to PHP 5.3, which was released a few days before. This includes many new features such as closures, namespaces, and packaged scripts in phar files, which I’ll blog about soon. Check out PHP changelog for more details.
Update 2009-09-01 – Added a note about deprecated errors, and how to silence them. Also I have included a tip that might help those of you struggling to install.
Update 2010-03-03 – I’ve added both apc 3.1.3p1 beta (php-pecl-apc in yum) and eAccelerator 0.9.6 (php-eaccelerator in yum) RPMs to the repository, they are compiled for (and work on) php 5.3.x
I have also included the same php extensions I mentioned in my other article, php-mcrypt, php-mhash (in PHP 5.2), php-mssql and php-tidy
To install, first you must tell rpm to accept rpm’s signed by me, then add the yum repository information to yum:
rpm -ivh http://repo.webtatic.com/yum/centos/5/`uname -i`/webtatic-release-5-0.noarch.rpm
Now you can install php by doing:
yum --enablerepo=webtatic install php
Or update an existing installation of php, which will also update all of the other php modules installed:
yum --enablerepo=webtatic update phpIf this does not work correctly, try disabling all other repositories while installing/updating, by adding the –disablerepo=* option. This will stop other dependencies from being installed, so you may want to install them first.
yum --disablerepo=* --enablerepo=webtatic update php
“Depsolving” problems
If you get depsolving problems when updating, you may have currently installed some extensions that have been removed, e.g. php-mhash, php-ncurses.
You will need to remove them before upgrading.
yum remove php-mhash php-ncurses
Deprecated Errors
Once you are running the new version, you may get “deprecated” errors in your error logs. This isn’t bad, it just means to tell you that some of the functions you are using are no longer prefered, and may be removed in a future major release. An example of this is the ereg functions. Preg functions are prefered over these, as they are much faster and more powerful, and in all cases do at least the same thing.
If upgrading the functions are not an option, and you would like to hide the deprecated errors from your error log, for example on a production server, just edit your /etc/php.ini file, find the line:
error_reporting = E_ALL
and replace to:
error_reporting = E_ALL & ~E_DEPRECATED
PHP 5.2.14
I am also maintaining a PHP 5.2.14 release, so should you prefer to install that (for reasons like incompatibilities or testing), you can force it to install that instead by doing:
yum --enablerepo=webtatic --exclude=php*5.3* update php
Or you can add to the /etc/yum.repos.d/webtatic.repo the line:
exclude=php*5.3*
Appologies for the delay in getting the latest PHP updates (5.3.3, 5.2.14) ready. I changed jobs at the time of release.
They are both now available in the repository. PHP 5.3.3 also includes a php-fpm (FastCGI process manager) package as it is now part of the php core distribution.
http://php-fpm.org/
Hi, i recently found this site and i’m very happy that i can finally use PHP 5.3 on my CentOS 5.5 … so big thanks for your great work.
I just installed latest PHP 5.3.3 but i had to disable eAccelerator … because all my sites crashed.
I get this type of errors in apache
Sun Aug 08 02:17:35 2010] [notice] child pid 5155 exit signal Segmentation fault (11)
[Sun Aug 08 02:17:37 2010] [notice] child pid 5160 exit signal Segmentation fault (11)
[Sun Aug 08 02:17:38 2010] [notice] child pid 5156 exit signal Segmentation fault (11)
[Sun Aug 08 02:17:42 2010] [notice] child pid 5168 exit signal Segmentation fault (11)
After i disable eAccelerator all things works ok.
So any update for eAccelerator?
Thanks for your response.
Strange, I did a rebuild of eAccelerator against php 5.3.3, which seems to have fixed it. That shouldn’t normally be necissary.
The update is in the repository, and correctly working on my system.
Finnaly yum picked up on eAccelerator update .. now it’s all good … maybe there was a slite delay for the update to be available through yum.
Thank you for your fast response … it’s working great now!