Upgrading to PHP 5.2.5 on RHEL and CentOS

November 16, 2007 by · 141 Comments 

After a little more than 2 months of waiting since the last release, PHP has been updated once again, this time to 5.2.5. The 5.2.5 release brings several security enhancements, more than 60 bug fixes, and improved performance for those of you that like arrays (and really, who doesn't?).

PHP 5.2.5 also updated the bundled version of PCRE to 7.3, although if you're a user of my repository you've been using that version for quite some time now, and the timezone database to 2007.9.

Now, what you've all been waiting for... The links! As always, I would encourage everyone reading this to add my Yum repository to your system for quick, easy updates. If you really don't want to, feel free to rebuild the Source RPM at the link below.

Update (11/19/2007): Source RPM updated to fix test issue on certain systems.  No binary package updates since the change doesn't actually affect anything but the test cases.

PHP 5.2.5 Release Notes / Changelog

Update (9/24/2009): Packages deleted, use the yum repository instead.


141 Responses to “Upgrading to PHP 5.2.5 on RHEL and CentOS”
  1. Slappy says:

    Thanks Jason. Update went without a hitch! Appreciate your efforts to help with these updates.

  2. Jesse says:

    Update went smoothly...Thank you!!!

  3. I'm stuck. Totally stuck.

    I'm getting the
    "Error: Missing Dependency: perl(:MODULE_COMPAT_5.8.8) is needed by package perl-DBD-MySQL"
    And I am only getting
    ---> Package php.i386 0:5.1.6-3.el4s1.8 set to be updated
    instead of 5.2.5
    I must have missed something somewhere.
    I have added the repository and everything.
    Is there a step by step guide for n00b like me?

  4. Ok, got rid of the perl error, now I have to figure out why I am not getting the 5.2.5 version.

  5. Carmine says:


    I'm having the same problem as I did with your 5.2.4 srpm. See my comment here:


    You eventually modified something in the src.rpm that made it work. Let me know what you think....

  6. Michael says:

    i am getting this error when i try and make the update.
    Error: Missing Dependency: php-common = 5.2.3-jason.1 is needed by package php-xml
    Error: Missing Dependency: mod_jk >= 1.2.0 is needed by package turbopanel-tomcat

    any ideas?

  7. pesu says:

    Hi Jason,

    I'm trying to compile from source rpm (because I use apache 2.0.59) and I get following error while tests start:

    PHP Warning: PHP Startup: Unable to load dynamic library '/usr/src/redhat/BUILD/php-5.2.5/build-apache/modules/bcmath.so' - /usr/src/redhat/BUILD/php-5.2.5/build-apache/modules/bcmath.so: cannot open shared object file: No such file or directory in Unknown on line 0

    I found all missing .so modules in '../build-cgi/modules/' instead of '../build-apache/modules/'. Please, is this my fault or some bug in spec file?

  8. Jason says:


    You've either not enabled my repo or you've got the priority or protectbase yum plugins installed.


    You're out of luck on using my yum repo on this one. Turbopanel requires Tomcat and that is not a package I rebuild. If you want to update PHP only then I'd suggest downloading the src.rpm and rebuilding from that.


    Grrrr... I'll look into that today. In the interim, you can remove your currently installed copy of PHP and this will build properly.


    Probably the same answer as Carmine. I'll see about getting an updated source rpm up today.

  9. DavNeg says:

    The upgrade was smooth, without a problem. :)

  10. Jesse says:


    Any luck with MySQL :)


  11. codesmith says:

    Hi - was just following your fabulous updates and finally got everything installed and working. (On a CENTOS server with 5.1.4 and needed 5.2 for uploadprogress). Went through all the steps, added your repo, and install went great. But no MySQL - ahhhh! Is there a workaround or can I go back to an older version? Thanks much for all your efforts.


  12. Jason says:


    Nope, no luck yet. Still working on it though.


    Do you have "mysql-server" installed or just "mysql" (which contains only the client libraries)? How about "php-mysql" (which contains the 'mysql' and 'mysqli' connectors for PHP)?

  13. codesmith says:

    "php-mysql" is now installed but didn't get mysql_connect() working. I don't see mysql recognized when I do a phpinfo() (but not sure I should). Restarted apache but not sure if I need to do something else. mysql-server-5.0.48-jason.2.i386.rpm is installed but don't know if it's available - don't see much when using "locate mysql-server". Thanks for the help.

  14. Jason says:


    If you've got 'php-mysql' installed, along with the 'mysql' package (should have been pulled in as a dep) then you should have a "mysql" section in your phpinfo(). If you want to connect to a local MySQL server then you would also need 'mysql-server'.

    If you've got those installed then I really couldn't say what could be going wrong. Are there any errors in your httpd error_log when you restart httpd? Is the /etc/php.d/mysql.ini file listed as being parsed in your phpinfo()? Can you post a link to your phpinfo()?

  15. codesmith says:

    Aha! I looked for errors and saw it was trying to load php4 extensions and not php5. I guess I have a more php4 specific php.ini file. I pointed the extensions to /usr/lib/php/modules/ and it's all sorted. Thanks much for the help.

  16. Jason says:


    Yeah, for the best compatibility you should really use the php.ini file that comes with my packages.

  17. @Jason, (or somebody)
    "You've either not enabled my repo or you've got the priority or protectbase yum plugins installed."
    Hate to bother you again, but could you be more specific?

    I am pretty sure that I have enabled your repo, I followed the http://www.jasonlitka.com/yum-repository/ document and I was getting 5.1 from your repository. But 5.2? not so much. Where should I start looking for problems?

  18. codesmith says:

    Thanks Jason. Can you let me know where I can find your recommended php.ini file? Don't see anything obvious on our server although I'm not that familiar with how Yum installs things.

  19. Jason says:


    It should have been installed into "/etc" when you installed my files. If you had a modified version from before it could have been installed as "/etc/php.ini.rpmnew". If for some reason it isn't there you can either uninstall (make sure you remove and/or rename your /etc/php.ini) and reinstall or fill out the comment form on my "About" page and I'll email you a copy.


    My repo doesn't have any files for PHP 5.1.x. If you were getting those packages then you were probably getting them from the 'centosplus' repo. As I mentioned above, if you've got the 'protectbase' or 'priority' yum plugins installed (it's more likely that you'd have the former than the latter) then it will prevent you from using a 3rd party repo with overlapping packages. If that is the case then you'll need to look through the files in "/etc/yum.repos.d" and make a couple changes. The links below should give you the info you need.


  20. muli says:

    thanks! works smoothly

  21. I am currently working on building a memcache extension RPM for your PHP 5.2.5. IS there a possibility for including memcache support in future versions of your packages?

  22. Jason says:


    The memcache extension from PECL? If so, that's a pretty easy one as there's already a package available in CentOS extras; it would just need to be rebuilt. I'll look into doing that this week sometime.

  23. Thomas Babut says:


    little off-topic, but is there a rsync server so I can mirror your repository locally for many servers?


  24. Jason says:


    Sorry, no rsync at this time. I've got plenty of bandwidth though so don't worry about using it all. If it's your bandwidth you're worried about then you might want to use a squid proxy to cache all of the downloaded files locally or share out your yum cache folder with NFS so other machines can access it.

  25. Alex says:

    thank you for this package. But I have a problem -- I am new to linux systems, but need to install php with pcntl support on CentOS. I know that it is possible to do it using --enable-pcntl while compiling, but I did not manage to compile PHP-5.2.5 (there is simply no Makefile in directory, make command therefore does not work).
    I am realy stuck and am asking to your help. Maybe you can suggest any solution to this problem (how to build rpm with --enable-pcntl --enable-sysvsem).

    Thanks in advance.

  26. JP White says:

    Works like a champ. You da man.

  27. Jason says:


    'php-pcntl' is provided by 'php-cli' and 'php-sysvsem' is provided by 'php-common'. Install those two packages (both are actually required to install 'php' so you shouldn't actually be able to install at all without them) and you should be fine.

  28. Alex says:

    Jason, thanx for help, but actually, it does not work. I have httpd, php, php-common, php-cli installed on my CentOS4 server (from your repositories) and function pcntl_fork() is undefined (says php error message).
    Any suggestions?
    Further thanx.

  29. Jesse says:

    Looking at the "Configure Command" in phpinfo(), the "--enable-pcntl" is missing from that list

  30. Jason says:


    I'll take another look but I searched the spec file and --enable-pcntl was in there. It could be that it was for CLI only. If that's the case, you'd have to add it to the other ./configure string and then rebuild.

  31. Luca says:

    Thanks for the package, but i have a problem when I try to add the module of ZendDebugger. The error is : Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied

    All permissions are ok, the same as the other modules in the same directory. Anyone have the same prob ?

  32. Jason says:


    What version of PHP was that module compiled for? Have you tried installing the 'php-devel' package and then rebuilding?

  33. Luca says:


    At this moment i have installed php-devel, thought yum install. Not rebuilded (what do you mean? I'm little bit new with yum and centos)

    The OS is Centos 5.0 with your repository using php 5.2.5. I tried also to use PHP 5.2.4 but without any different result. Which is the last known working version of PHP/Apache with ZendDebugger ? Is there available any repository with these RPM ?

    This is the complete error of apache.

    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    [Fri Dec 28 05:21:07 2007] [notice] caught SIGTERM, shutting down
    Failed loading /usr/lib/php/modules/ZendDebugger.so: /usr/lib/php/modules/ZendDebugger.so: cannot restore segment prot after reloc: Permission denied
    [Fri Dec 28 05:21:08 2007] [notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t:s0
    [Fri Dec 28 05:21:08 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Fri Dec 28 05:21:08 2007] [notice] Digest: generating secret for digest authentication ...
    [Fri Dec 28 05:21:08 2007] [notice] Digest: done
    [Fri Dec 28 05:21:08 2007] [notice] Apache/2.2.6 (Unix) DAV/2 PHP/5.2.5 configured -- resuming normal operations

  34. Luca says:


    Seems I found what's the problem and partially solved. The problem is caused by SELinux
    installed and activated by default on Centos 5, so should be
    executed "setenforce 0" (or "setenforce Permissive") to allow the loading of ZendDebugger.so

  35. Craig says:


    I have just upgraded to php5.2.5 and re-configured the httpd.conf file to my system build, however, would like to change the ./configure options to enable DOM and PDO support for PHP, any advice?

    I read your words about "rebuilding" however am clueless on how to do this from an rpm

    p.s. thanks for stealing my "RedHat Linux Enterprise Test Page"!!!

  36. Craig says:

    Never mind, found the php-xml in your repos!!

    Much appreciated

    p.s. still not found a way to change the default page back !

  37. Jason says:


    Stole your default page? I have no idea what you're talking about. My httpd install does include a slightly modified version of the default, default page. If you'd like to go back to the original one that came with RHEL then you'd need to reinstall their package.

    Really though, why do you care? That page is only there until you install your own content.

  38. Craig says:


    Take no notice. Thanks for your repo, it's really quite good.

  39. Dave says:

    Thanks for your packages they have been a great help.
    Have one newbie question, i have installed your php5.2.5 package fine and wondered if there was an easy way to add PDO driver for MySQL?
    Thanks again

  40. Jason says:


    Have you installed 'php-mysql'?

  41. Dave says:

    Yes im pretty sure i have.

  42. Jason says:


    Is there a "mysql" section in your phpinfo()? If so, you've got MySQL support.

  43. ross says:

    sorry for the stupid question
    I use your binaries but when i check php info i see:
    --without-mysql' '--without-gd'

    how to enable mysql and gd support?
    i installed
    * php-mysql
    * php-gd

    but no help

  44. Jason says:


    You can ignore the "without" stuff at the top as the main PHP module and the addons are actually compiled separately.

    All you need to do is install 'php-mysql' and 'php-gd' and then restart httpd. If you check your phpinfo() once you do that then you should see 'mysql' and 'gd' sections.

  45. Dave says:

    Just checked and it is showing MySQL under phpinfo.
    PDO drivers only show Sqlite & Sqlite2

  46. ziera says:

    hi Jason..

    Thank you for the effort to share this. Ive been trying to update my php 5.1.6 because i want it to pass the free audit scan by comodo but i never succeeded because 5.1.6 was a part of the package by virtualmin. i cannot proceed to pci compliance test without an update to 5.2.1 or higher. your update works smoothly and now im gettin closer to pci compliance. thanks. May you have a Great Year in 2008. cheers

  47. Jason says:


    Good to hear. PCI compliance is a real pain, I know, I just finished the quarterly scans on our eCommerce sites at work.


    I just checked one of my sites and the PDO section has "sqlite" and "mysql". Make sure that you've got at least the following packages installed: 'php', 'php-common', 'php-cli', 'php-pdo', 'php-mysql'.

  48. Ross says:

    thx Jason
    But now i cant find phpize?
    where it is?
    i installed followed rpms:

  49. ziera says:

    It was tough, but now after i cleared the security holes and warnings, feel much relieved. I just need to work on some areas. Thanks to you. Keep it up. :)

  50. Jason says:


    'phpize' is a development tool; it's in 'php-devel'.


Check out what others are saying about this post...
  1. KMM Projects » Blog Archive » PHP woes says:

    [...] restore it, tried installing Jason’s RPM again, got PHP but no MySQL connector, actually read the comments on Jason’s site and then installed php-mysql and to my amazement, got PHP 5 talking to MySQL [...]

  2. [...] Paquetes e instrucciones para actualizar a PHP 5.2.5 [...]

  3. programming with free software and open source :: Actualizando Php en Centos 5.1–> 5.2 :: June :: 2008 says:

    [...] fuente : http://www.jasonlitka.com/2007/11/16/upgrading-to-php-525-on-rhel-and-centos/  [...]

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.