Upgrading to PHP 5.2.4 on RHEL and CentOS

September 5, 2007 by · 70 Comments 

Well, it's been 3 months since the last release of PHP 5.2 but 5.2.4 is finally here. Unlike the earlier releases of PHP 5.2 which have included both performance/memory optimizations as well as fixes for critical bugs (security issues and otherwise), this release is aimed at improving the overall stability of the 5.2 release chain (no doubt aiming to improve the image of PHP 5.2 with 4.4 being discontinued at the end of the year) by fixing more than 120 small bugs, as well as taking the opportunity to fix a few low-level security holes.

The PHP development team didn't slap a "0mg!!! j00 m|_|$7 |_|pd473 j00r php 0r 3l$3 j00 \/\/1ll b3 h4ck3d!!!" tag on this one but stability is always a good thing so I would recommend that all of my readers upgrade when they get a chance. Really though, since I do all the work, do you really have an excuse NOT to update?

Along with the upgraded PHP packages I've also generated updated versions of the PCRE packages. PHP 5.2.4 updated the bundled version to 7.2 and I was still on 7.0, so I figured, "why not stay ahead of the crowd?" and jumped all the way to 7.3.

UPDATE (9/17/2007): The src.rpm has been updated. Those of you having problems using it to build your own binaries shouldn't have issues anymore. Also, in these newer revision packages I have added "php-mssql" and "php-embedded" as both of these are in the latest builds from Fedora Devel. Finally, php-dbase has been merged into php-common, again, as with the latest packages from Fedora Devel.

PHP 5.2.4 Release Notes / Changelog

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

Comments

70 Responses to “Upgrading to PHP 5.2.4 on RHEL and CentOS”
  1. Snorkel says:

    Jason,
    Are there any changes needed to the spec file, or is it good to go as is?

  2. Jason says:

    @Snorkel,

    The RPMs generated by the src.rpm are functionally-identical to those available in the default packages from Red Hat. If you require something extra then you would need to edit the spec file. Really though, why not just use the binary packages I've provided in my yum repo?

  3. Snorkel says:

    Can't use the binaries as they are built with a newer version of Apache. I have to keep my current version.

  4. Snorkel says:

    Having a problem building 5.2.4
    I built it the same way as I did 5.2.3 but it's hanging here:

    FAIL EXPECT [tests/run-test/test001.phpt]
    FAIL EXPECTF [tests/run-test/test002.phpt]
    FAIL EXPECTREGEX [tests/run-test/test003.phpt]
    FAIL INI section allows '=' [tests/run-test/test004.phpt]
    TEST 5/2569 [tests/run-test/test005.phpt]

    And before this it's showing a bunch of these:

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

    Any ideas?

    It's weird because I have not made any changes to the server since I built 5.2.3

    Later,

    Snorkel

  5. Jason says:

    @Snorkel,

    Those warnings mean that the loadable modules created during the compile are not where they are supposed to be (or perhaps failed to build at all). What version of httpd are you using? Was it installed using RPMs or did you compile from source? Also, you're not trying to build PHP as 'root', are you?

  6. We were in the middle of testing our stuff for a 5.1.2 -> 5.2.3 upgrade. Is it still possible to somehow get the 5.2.3 packages? If not binaries, maybe SRPM?

  7. My apologies, the 5.2.3 packages seem to be still there. Please do not delete them! :)

  8. Jason says:

    @Dmitriy,

    I generally leave the binary packages around for 2-3 prior versions. After that they are deleted for space concerns (although the SRPMS are kept around).

  9. Snorkel says:

    oh, yes I do the build as root, just did 5.2.3 that way and it worked perfectly.
    I tried a regular user but the build fails because of rights.

  10. Snorkel says:

    Seems to be something odd with the 5.2.4 spec file.
    modules are being put in /var/tmp/php-5.2.4-jason.1-root-root/usr/lib/httpd/modules/
    but the php startup islooking for them in /usr/src/redhat/BUILD/php-5.2.4/build-apache/modules/

    It just hangs forever on TEST 5/2569 [tests/run-test/test005.phpt]

    It's probably some dependency, but there is no error generated, so I have no idea what it might be. Seems to me I had this issue before. will look back in the blog to see if I did.

  11. Snorkel says:

    nope, didn't have this issue before, but someone who was building 5.2.3 from source did in the blog entry comments for that version.
    Building as a non root user now.

  12. Snorkel says:

    Well, get the same result as a non root user....
    It's hanging on test 5 , anyone know what that particular test is?

  13. Jason says:

    @Snorkel,

    According to the notes in that file, that test checks error handling. It is probably hanging because the first actual line of code checks to see if an extension is loaded. In your case, it seems like the extension dirs are getting messed up.

    Honestly though, it sounds to me like the real problem is that your build environment isn't setup properly (since you can build as root but not as a regular user). I used to build as a non-root user in /usr/src/redhat but had nothing but problems with certain packages. I would suggest that you try out the directions at the URL below.

    http://www.jasonlitka.com/2007/05/21/setting-up-an-rpm-build-environment/

  14. snorkel says:

    Hi Jason,
    I will take a look at the link. Thanks.

    I don't think my build environment is that messed up though, I was able to build all the versions up until this one. I even built 5.2.3 today as a test and it worked fine.

    I am currently trying to build on a different server.

    Later,

    Snorkel

  15. snorkel says:

    Well, I got it all built and the problem was the old version of php was still installed.
    I removed the 5.2.3 version completely and then it built just fine.
    I think the base API has changed a bit in 8.2.4 and when the tests where being run it was picking up the currently installed CLI (command line interface) to run the tests.
    No changes where made to the system other than doing a rpm -e for all the existing php packages.

    Anyway, hope that helps someone else who may be running into the same issue.

    Later,

    Snorkel

  16. Jason says:

    @snorkel,

    I'm glad to hear that you got it worked out, although removing the existing copy of PHP shouldn't have had anything to do with it as I test compile the src.rpms with and without the prior version already installed, just to make sure that I haven't created any dependencies on something I shouldn't have.

  17. Snorkel says:

    I agree, I never had to do that before. For whatever reason that new spec file is picking up the path (from the environment vars) to the currently installed php command line executable to run the tests.
    I verified this on two separate servers. Won't build with 5.2.3 installed, remove the old version and it builds completely and the tests all pass.

  18. Randy says:

    Jason,

    Thanks for this info! I have used your repository to successfully install PHP and Apache. However, I noticed that my PHP configuration requirements are significantly different from what you provide in your repository. I am assuming I could take your source RPM and make the changes, but I am pretty clueless on how to do this. Could you point me to a resource that would explain how I would go about doing this? If it can't be for PHP specifically, then for source RPMs in general?

    Thanks.

  19. Nick says:

    Hi Jason

    I've successfully run the rpm - I think... Previously I had php 5.1.4 installed which is still there. Have restarted Apache but 5.1.4 is still the default. What should I do to set it to 5.2.4? Thanks in Advance

    Nick

  20. Jason says:

    @Randy,

    I'm not sure how that could possibly be the case as I am providing the same packages (more, actually) that come with RHEL & CentOS. As with the stock RPMs, if you need MySQL support then you would also have to install 'php-mysql', PostgreSQL would be 'php-pgsql', IMAP would be 'php-imap', etc. What is it that you need that isn't available?

    @Nick,

    If your previous version was installed using RPMs then it should have been removed automatically. If it was installed via source then you would have to remove it yourself. If that is the case, you may want to reread the second-to-last paragraph on the Yum Repository page.

    http://www.jasonlitka.com/yum-repository/

  21. Jesse says:

    Jason,

    I noticed that the last couple of upgrades for PHP listed all of the modules I've installed as dependencies except php-dbase.x86_64. Not really a major thing cause i just upgrade that after php installs, just a minor annoyance.

    Jesse

  22. Jason says:

    @Jesse,

    I'm not exactly sure what you mean. Are you saying that when you upgraded from 5.2.3 to 5.2.4 that 'php-dbase' stayed at 5.2.3 until you manually updated it?

  23. Jacek says:

    BTW, a new version of MySQL Enterprise is available at:
    http://mirror.provenscaling.com/mysql/enterprise/source/5.0/mysql-5.0.48.tar.gz
    It seems that it is OK to use according to GPL.
    Best wishes, Jacek

  24. Jesse says:

    @Jason,

    That is correct...'php-dbase' stayed at 5.2.3 until i manually upgraded it.

  25. Jason says:

    @Jacek,

    Thanks. I've been playing around with the sources from BitKeeper but they require a bit of work before they're ready to go so I've been a bit hesitant in actually releasing binaries built from those sources.

    @Jesse,

    I looked at the spec file and I believe that I know what the issue is. The next release should need to be manually updated as you have done in the past but everything after that should take care of itself. Thanks for pointing out this issue.

  26. Bo says:

    can you tell us how you build the patch files?

  27. Jason says:

    @Bo,

    What patch files are you referring to?

  28. Bo says:

    Patch1: php-5.1.4-gnusrc.patch
    Patch2: php-4.3.3-install.patch
    Patch5: php-5.0.2-phpize64.patch
    Patch8: php-5.2.0-includedir.patch

    # Fixes for extension modules
    Patch22: php-4.3.11-shutdown.patch
    Patch23: php-5.2.2-pdosym.patch

    # Functional changes
    Patch30: php-5.0.4-dlopen.patch
    Patch31: php-5.0.0-easter.patch

    # Fixes for tests
    Patch50: php-5.0.4-tests-dashn.patch
    Patch51: php-5.0.4-tests-wddx.patch

    those files are what i was refering to.

  29. iDaemon says:

    Sorry for dummy question

    Can i run this rpm instantly? I have maunaul installed apache php mysql build from your past post here http://www.jasonlitka.com/2006/11/21/upgrading-php-rhel4-centos4/

  30. Jason says:

    @Bo,

    Those patches were inherited from the original package that came from RH. I leave them there to keep my packages as close to identical in functionality to the originals as possible. Some of the patches present in my older packages have been removed because they have been accepted into the main code base, others were updated by me to cover changes to the sources that didn't resolve the "issue" that RH was trying to patch.

    @iDaemon,

    I saw your thread over at vbulletin.com. You must be back here to head off the inevitable suggestion from George (eva2000) that you update your httpd, PHP, and MySQL versions to the newest available.

    In any case, PHP is dependent on a few packages, most notably httpd. If you are using my yum repository then all you need to do is to run "yum update" and you'll get the newest versions of httpd, PHP, and MySQL. If not, but you are running httpd 2.2.x, then yes, you should be able to use the binary RPMs from my repo without issue. If you are running httpd 2.0.x or 1.3.x then you would need to download the src.rpm I provided and build it into binary RPMs for your system. There may be a couple other dependencies to fill (apr, apr-util, pcre) but if you've already upgraded using that other tutorial then you've probably already got them covered.

  31. Carmine says:

    Jason,

    I'm having a similar problem as Snorkel did above. Building the RPM from SRC is failing at test005.phpt.

    Your 5.2.3 package worked with out any problems, but following the same procedure with 5.2.4 is giving me the above issue. Compiling as myself, not as root, and following your instructions on setting up the dev environment. Here is a snipet of where it starts to bomb:
    -----
    cd build-apache
    export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
    NO_INTERACTION=1
    REPORT_EXIT_STATUS=1
    MALLOC_CHECK_=2
    unset TZ LANG LC_ALL
    make test

    Build complete.
    Don't forget to run 'make test'.

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

    .... follows with several of the same errors for different .so files.

    =====================================================================
    CWD : /home/carmine/rpms/BUILD/php-5.2.4
    PHP : /home/carmine/rpms/BUILD/php-5.2.4/build-apache/sapi/cli/php
    PHP_SAPI : cli
    PHP_VERSION : 5.2.4
    ZEND_VERSION: 2.2.0
    PHP_OS : Linux - [hidden] 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686
    INI actual : /home/carmine/rpms/BUILD/php-5.2.4/build-apache/tmp-php.ini
    More .INIs : /etc/php.d/bcmath.ini,/etc/php.d/dba.ini,/etc/php.d/dom.ini,/etc/php.d/gd.ini,/etc/php.d/imap.ini,
    /etc/php.d/json.ini,/etc/php.d/ldap.ini,/etc/php.d/mbstring.ini,/etc/php.d/mysql.ini,/etc/php.d/mysqli.ini,
    /etc/php.d/ncurses.ini,/etc/php.d/odbc.ini,/etc/php.d/pdo.ini,/etc/php.d/pdo_mysql.ini,/etc/php.d/pdo_odbc.ini,
    /etc/php.d/pdo_pgsql.ini,/etc/php.d/pdo_sqlite.ini,/etc/php.d/pgsql.ini,/etc/php.d/snmp.ini,/etc/php.d/soap.ini,
    /etc/php.d/xmlreader.ini,/etc/php.d/xmlrpc.ini,/etc/php.d/xmlwriter.ini,/etc/php.d/xsl.ini,/etc/php.d/zip.ini
    Extra dirs :

    =====================================================================
    TIME START 2007-09-12 12:58:24
    =====================================================================
    FAIL EXPECT [tests/run-test/test001.phpt]
    FAIL EXPECTF [tests/run-test/test002.phpt]
    FAIL EXPECTREGEX [tests/run-test/test003.phpt]
    FAIL INI section allows '=' [tests/run-test/test004.phpt]
    TEST 5/2569 [tests/run-test/test005.phpt]

  32. iDaemon says:

    first, I want to say thank you jason, I'm noobie and not server admin but i can built my own server setup from your blog, cheer!

    yes i have follow all of your apache, php, mysql built-up

    but after i have tried yumupdate i got this error
    Error: Missing Dependency: libmysqlclient_r.so.14(libmysqlclient_14) is needed by package MySQL-python

  33. iDaemon says:

    I just take a time in your site and know that you change to yum repository.

    so what I have to do is edit yum repository and run yum update right?

    please suggest me.

  34. Jason says:

    @iDaemon,

    If you're running EL4 and you require older versions of the mysql client libraries then install the "mysqlclient14" and/or "mysqlclient10" packages as needed. This should be done automatically if you have my repository configured on your system although stranger things have happened than a dependency not being automatically filled...

    @Carmine,

    I have still not been able to duplicate that on my development boxes. It looks like you're building on 32-bit EL4, correct? Can you give me a list of the php-5.2.3 packages you already have installed? Maybe it's caused by some package I don't typically install. In any case, I'll give the build another try on my EL4 32-bit system...

  35. Carmine says:

    @Jason,

    It seems like Snorkel said, that the path or environment variable maybe wrong. Nothing is actually in that build-apache directory created as part of the build. Here's what I got:

    rpm -qa | grep php

    php-bcmath-5.2.3-jason.2
    php-ldap-5.2.3-jason.2
    php-soap-5.2.3-jason.2
    php-dba-5.2.3-jason.2
    php-ncurses-5.2.3-jason.2
    php-xmlrpc-5.2.3-jason.2
    php-gd-5.2.3-jason.2
    php-pgsql-5.2.3-jason.2
    php-pear-4.3.9-3.22.5
    php-cli-5.2.3-jason.2
    php-devel-5.2.3-jason.2
    php-mbstring-5.2.3-jason.2
    php-pdo-5.2.3-jason.2
    php-xml-5.2.3-jason.2
    php-debuginfo-5.2.3-jason.2
    php-odbc-5.2.3-jason.2
    php-5.2.3-jason.2
    php-imap-5.2.3-jason.2
    php-snmp-5.2.3-jason.2
    php-common-5.2.3-jason.2
    php-mysql-5.2.3-jason.2

  36. iDaemon says:

    i need to delete old xxx.repo inside /etc/yum.repos.d/ ?
    or i just add utterramblings.repo and then run yum update?

    there two files inside CentOS-Base.repo and kbsingh-CentOS-Extras.repo

  37. Jason says:

    @iDaemon,

    Do not delete the default repos. Just add a file called "utterramblings.repo" with the content from the "Yum Repositories" page to the "/etc/yum.repos.d/" folder.

    @Carmine,

    I'll take a look at this today.

  38. JMR says:

    I was able to update mysql using yum update mysql-devel , however I am having problems when trying to update php. If I just type "yum update" which you mention several times on this site to do after installing your repository, I get an error

    Error: Missing Dependency: mod_jk >= 1.2.0 is needed by package turbopanel-tomcat

    If I do " yum update php" I get the same error as above in addtion to

    Error: Missing Dependency: php-common = 5.2.3-jason.1 is needed by package php-xml

    I am currently running PHP version 4.3.9 and MySQL 5.0.48-jason.1

    Any help would be appriciated

  39. Jason says:

    @JMR,

    The main packages in my repository are httpd 2.2.x, PHP 5.2.x, and MySQL 5.0.x. MySQL has no dependency on the other two which is why you were able to install it. httpd & PHP are another story entirely. httpd does not depend on either MySQL or PHP but PHP and other extensions do have version-specific dependencies on it.

    As I understand it, mod_jk is a part of Tomcat, correct? If so, whatever version you have would need to be recompiled for httpd 2.2.x as httpd extensions are not (usually) portable between versions. Once you had those packages available, the rest of the binaries I've made available should fall into place nicely.

    An alternative would be for you to take the Source RPM I've provided and to build binaries for your own system running whatever version of httpd you have installed.

  40. JMR says:

    Thank you for the reply, and pardon my lack of experience with this. To back-track a little, I am installing from a fresh virtual private server. It came standard with CentOS 4 and php 4.3.9. I did some searching and I found this site, and decided to try and follow the directions to get php and mysql updated.

    I have no idea what mod_jk is. I didn't even know what Tomcat was, after I did some investigation, I found out Tomcat wasn't even activated on the server. I tried activating it and running the yum update again, but same result. After looking through the Tomcat interface, I don't even need it. Can I somehow stop the system form depending on mod_jk? How exactly would I recompile mod_jk for httpd 2.2.x ? I couldn't even find where to download mod_jk.

    I would be willing to build the binaries myself, if possible, please provide what steps I would need to take to do that... I will search your website in the meantime, thanks for the help!

  41. Jason says:

    @JMR,

    Quick question, was a control panel installed on your server (CPanel, Plesk, etc.)? If so, Tomcat may have been installed as a part of it. If that is the case, you'd probably be best off removing it from there.

    If not, and if you're not using TomCat, then I'd I'd start with "yum remove mod_jk" and see what it wants to remove. If you're sure you're not using anything on the list then go ahead and let it do it.

  42. JMR says:

    Hello Jason,

    Yes I am using a control panel, it's called Simple control panel, something developed by godaddy. I figured I would try using it before paying extra for cPanel or Plesk.

    I couldn't find a way to easily remove Tomcat from the interface, so I went ahead and did a "yum remove mod_jk " and the only dependencies was something called turbopanel and tomcat. I went ahead and said Yes to remove mod_jk.

    I went back and did "yum update" and everything looks like it was installed correctly! I am now running PHP version 5.2.4 ! Thank you for saving me alot of time and headaches trying to figure this out!!

  43. JMR says:

    ***Correction, while my php was updated, I seemed to have killed my web server with the above process...back to the drawing board, I am re-provisioning the server.

  44. Jason says:

    @JMR,

    I just looked into this and apparently 'turbopanel' is actually the poorly-named package for the "Simple Control Panel". If that package depended on tomcat and mod_jk then it is probably written with JSP. If that is the case, you will, in all likelihood, not be able to use my repo with their control panel.

  45. Psykick says:

    Hi Jason,

    Thanks for the previous version of PHP 5.2.3, went without a hitch and downloading and about to try new version 5.2.4

    One question though, have you enabled the DOM module in this release as in previous release DOM was not enabled?

    Regards

  46. OJ says:

    I am having problems with the Apache Update module of the new cPanel WHM 11. I have selected the option to compile Apache with PHP 5.2.4 but it seems that I cannot find the configuration option --with-xsl=[DIR] in cPanel's Apache build script. Did the guys from cPanel intentionally miss out this flag or is the Apache build script buggy? I have RPM'ed libxslt, libxslt-devel, and even libxslt-python to no avail. Any idea anyone? Comments deeply appreciated. Thanks.

  47. Psykick says:

    OJ ...

    Perhaps you're missing httpd-devel rpm?

  48. Psykick says:

    Perhaps also libxml-devel? But that should have been installed with libxslt-devel or libxsl-devel

  49. Psykick says:

    Hi Jason,

    Thought that I'd at least reply to my own message for anyone else that was wondering. Yes, DOM is enabled.

  50. OJ says:

    Hi Psykick, sorry about my post. It turned out that phpinfo() wasn't showing the --with-xsl flag and the XSL extension information, BUT the XSL extension and classes work! (for some reason I don't know why they hid XSL from phpinfo()).

    On the other hand, the DOM and XSL extensions show in phpinfo() on Windows.

    Anyway, thanks guys. Happy coding!

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.