arrow36 Comments
  1. TECK
    Feb 16 - 1:29 pm

    Great tutorial, see you at :)

  2. Jason
    Feb 16 - 3:07 pm

    Glad to hear you like it.

  3. Todd
    Feb 18 - 3:55 am

    I am new to Linux and have found your information and instructions very useful! Everyone I have tried has worked great. Wanted to say Thanks! Have you writen anything on Qmail or creating src.rpm's? I have searched but haven't found any if you have.

    Thanks again

  4. Jason
    Feb 18 - 5:25 pm

    Sorry, I don't use QMail. I've had some bad experiences with it on some Plesk servers. My mail server of choice is postfix courier-imap.

    As to creating your own SRPMS, my suggestion would be to read some of the documentation and then start with something simple. Find (or create) a simple program that only requires a "make" & "make install" to build and install. Once you've created a spec file to accomplish that you can move on to more interesting things like breaking apart a program into multiple packages. You can also learn a lot from examining the spec files for programs with install methods similar to what you want to accomplish.

  5. Stacy Haven
    Feb 22 - 10:14 pm


    You rock. I had installed everything on a box and had it all working, but needed to do it on two more boxes. The Apache RPM's I had already made when I was looking for a spec file for php and came across your site. I scraped everything and moved over to your code. Thanks so much for taking the time to do this.


  6. Bogdan
    Feb 26 - 9:55 pm

    Thanks for another guide Jason!

  7. Misha
    Mar 10 - 5:49 pm

    Jason, thanks for the great guide.

    I have some problem, because I need to enable two additional modules: mcrypt and tidy

    So, I added --with-tidy and --with-mcrypt=shared to the configuration lines, but after a while, I get the errors:

    Requires(rpmlib): rpmlib(CompressedFileNames)

  8. Misha
    Mar 10 - 5:50 pm


    error: Installed (but unpackaged) file(s) found:
    RPM build errors:
    Installed (but unpackaged) file(s) found:

  9. Amir
    Mar 11 - 8:50 am

    Thanks Jason, great guide!

    Maybe you can help me. Everything works very good for me. I'm also using Apache with Trac and Subversion (with mod_python) and a Mongrel cluster through the proxy_balancer module.

    It all functions, but memory keeps leaking. The httpd processes keep multiplying (start at 7 and rise constantly) and worse - the system memory just keeps climbing. It starts at 240Mb (with everything running) and just goes up indefinitely. Summing up the memory by the processes I see doesn't get close to the reported memory usage. Then, the system crashes.

    Where might I start looking for the cause of all this?

    Much appreciated,

  10. Jason
    Mar 12 - 10:31 am

    It could be the way you have it configured and it could be the amount of traffic you're receiving. The prefork MPM needs one process per client so it does tend to be high on the memory usage.

    Have you tried enabling the extended status module to see what each process is doing?

  11. Amir
    Mar 13 - 2:09 pm

    Hi Jason,

    From mod_status, it looks OK. It's probably not coming at all from the Apache server, but something else I've done. Is it possible that Linux (via 'top' command) is just reporting a lot of used memory, when it's not really used?

    Just as a sanity check, this is what I'm getting from mod_status:
    Server Version: Apache/2.2.4 (Unix) DAV/2 mod_python/3.3.1 Python/2.3.4 SVN/1.4.3 PHP/5.2.1 mod_perl/2.0.3 Perl/v5.8.5

    Thanks again,

  12. Jason
    Mar 13 - 3:20 pm

    Linux uses spare memory as a disk cache. You can expect to see all of the RAM in your system eventually show as "used" if you are looking in 'top'.

    If you want to know how much memory your programs are really using then use the command "free -m". The numbers next to the line starting with "-/ buffers/cache" are what you want. The first is memory in use and the second is free memory (both in MB).

  13. Jan
    Mar 14 - 2:12 pm

    I have a problem using mod_suphp for this php release. Do you have an rpm for the 0.6.2 version?

  14. Jason
    Mar 14 - 3:55 pm

    Sorry, I don't use that package (and therefore will probably not be building it). Have you tried simply rebuilding the suPHP package from source?

    That said, it looks like that particular module requires you to run the CGI version of PHP. As a whole, is not a terribly great idea, particularly if your site receives a decent amount of traffic. I would strongly suggest that you find a different way to run your site.

  15. Jan
    Mar 15 - 11:54 am

    ok no problem, it's working now with the rebuilded package.

  16. Alex
    Mar 21 - 12:41 am

    Hi. I've been following your blog for a little while although I only just stumbled across your most recent posts regarding your Yum repository. So, firstly thanks for both this blog and the new repository.

    Now, my question, do your PHP RPMs support FastCGI? I'll be using your Apache install but mainly for mod_svn (I assume you support this?) and I want to use another web server which requires PHP to be compiled for Fast CGI use.

    Any guidance will be apprecaited.



  17. Jason
    Mar 21 - 2:28 pm

    Yes, FastCGI should be supported through the 'php-cgi' binary. As to mod_svn, I'm not real familiar with Subversion, but if it uses an httpd module, a binary package created for RHEL4 will NOT work. That said, if you rebuild the src.rpm after installing a newer version of httpd then you should be fine.

  18. Alex
    Mar 21 - 6:10 pm

    Thanks. Subversion (when used with Apache) requires mod_dav. I'll get your apache packages installed and take it from there. If I getit all setup I'll document it somewherefor others to find.

    Thanks again,


  19. Colin Guthrie
    Apr 06 - 9:32 am


    I've not actually followed your tutorial yet, but I'd like to point out something that jumped out at me as being "sub optimal". I build a lot of RPMs on Mandriva and generally faff about with RPM all the time so when I saw this:

    Once that’s out of the way, make sure that you have a non-root user available for the compilation and that that user has full access to the /usr/src/redhat folder (and everything below it). If you don’t have that folder (meaning that you’ve never built a src.rpm before), create it first. The permissions can be set with the ‘chmod -R 777 /usr/src/redhat’ command or with ‘chown -R username:usergroup /usr/src/redhat’ which is actually the better method (make sure you substitute the actual user name and user group).

    i kinda balked!!

    This is not needed. This is the space for the root user to build RPMs but users shouldn't really build in here. Users can build where ever they like, it's just a matter of telling rpm about it!


    [[email protected] ~]$ mkdir rpms
    [[email protected] ~]$ cd rpms
    [[email protected] rpms]$ mkdir BUILD RPMS SOURCES SPECS SRPMS tmp
    [[email protected] rpms]$ cat >~/.rpmmacros

  20. Colin Guthrie
    Apr 06 - 9:34 am

    Hmm last reply was cut off:

    [[email protected] ~]$ mkdir rpms
    [[email protected] ~]$ cd rpms
    [[email protected] rpms]$ mkdir BUILD RPMS SOURCES SPECS SRPMS tmp
    [[email protected] rpms]$ cat >~/.rpmmacros
    %_topdir /home/user/rpms
    %_tmppath /home/user/rpms/tmp
    CTRL D
    [[email protected] rpms]$ rpm -i /path/to/my.src.rpm
    [[email protected] rpms]$ cd SPECS
    [[email protected] rpms]$ rpm -bb my.spec

    Hope that helps for future tutorials :)

  21. Jason
    Apr 06 - 11:01 am

    Thanks for the input. I build my RPMs in /usr/src/redhat (as I recommended in the tutorial) because I NEVER build RPMs as root. In my opinion, if you can't build a package as a non-root user, you shouldn't be building it at all.

    That said, I don't believe that there is really anything wrong with either approach as long as you are comfortable with what you are doing. Knowing that many people aren't comfortable with compiling their own software is one of the reasons I made my yum repository public.

  22. Colin Guthrie
    Apr 11 - 6:58 pm

    The only difference is that "rpm -qV rpm-build" will report that files belonging to a package have been altered etc. in automated tests which may just clog up automated error/warning reports that may be run.... I prefer to keep files/directories owned by packages in their original form unless they are marked as config files in the SPEC. Just my preference tho'.

  23. Jason
    Apr 12 - 1:06 pm

    That's a good point, I'll give it a try your way and see if that affects my build process. If not, I'll write it up differently from now on. Thanks again for your input.

  24. Gary Thorne
    Apr 14 - 10:45 am

    Thanks for the detailed steps here. FYI : I was concerned about the issues raised by the Month of PHP Bugs project and found some patches in the OpenSuSE bleeding edge packages, as well as the suhosin patch. I put together an article on how to get them installed in CentOS at my weblog above. I am running them on a test server right now with eGroupware and it seems to be working so far.

  25. Jason
    Apr 14 - 2:26 pm

    I'll take a look at your site, thanks.

  26. Thirupathy
    Apr 26 - 4:40 am


    thanks for giving the options to install php upgradation documents here. as i am following your steps mentioned here. But am encountering the following error.Please help me to solve this problem. when i issue as a non -root privilleges am getting this error. Am not able to find any php rpm inside the "/usr/src/redhat" folder.

    rpmbuild -bb php.spec
    cat: /usr/include/httpd/.mmn: No such file or directory
    error: Failed build dependencies:
    aspell-devel >= 0.50.0 is needed by php-5.2.1-1.i386
    httpd-devel >= 2.0.46-1 is needed by php-5.2.1-1.i386
    libjpeg-devel is needed by php-5.2.1-1.i386
    libpng-devel is needed by php-5.2.1-1.i386
    sqlite-devel >= 3.0.0 is needed by php-5.2.1-1.i386
    pcre-devel >= 4.5 is needed by php-5.2.1-1.i386
    libc-client-devel is needed by php-5.2.1-1.i386
    postgresql-devel is needed by php-5.2.1-1.i386
    unixODBC-devel is needed by php-5.2.1-1.i386
    net-snmp-devel is needed by php-5.2.1-1.i386
    libxslt-devel >= 1.0.18-1 is needed by php-5.2.1-1.i386
    gd-devel is needed by php-5.2.1-1.i386
    freetype-devel is needed by php-5.2.1-1.i386

  27. matt dennewitz
    Apr 26 - 6:24 pm

    i had to remove php and php-common before this would allow me to install:

    $ yum remove php
    $ yum remove php-common
    $ rpm -Uvh php-5.2.1-[ ... ]

  28. Jason
    Apr 27 - 1:06 pm


    You can't build a program until you've filled all of the dependencies. You'll need to install all of those "-devel" packages before you can build from source. Alternatively, you can simply use teh binary packages out of my Yum repo.

    Matt Dennewitz,

    What error were you given when you tried to upgrade without removing those packages?

  29. Tony
    May 03 - 6:04 pm

    Hi Jason,
    Great guide, I am very close to getting it working but it's crapping out on the SNMP part of the SRPM build.

    Did you have to use a different version of net-snmp when you built your rpm?
    I am running CentOS 4.4 I considered your yum repository, but I have to use the stock version of httpd that came with centos.

    checking for SNMP support... yes, shared
    checking OpenSSL dir for SNMP... no
    checking for snmp_parse_oid in -lnetsnmp... no
    checking for init_snmp in -lnetsnmp... no
    configure: error: SNMP sanity check failed. Please check config.log for more information.
    error: Bad exit status from /var/tmp/rpm-tmp.83959 (%build)

    In the config log it lists this as the problem:

    configure:107611: checking for SNMP support
    configure:107650: result: yes, shared
    configure:107658: checking OpenSSL dir for SNMP
    configure:107676: result: no
    configure:109207: checking for snmp_parse_oid in -lnetsnmp
    configure:109237: gcc -o conftest -L/usr/lib -L/usr/lib -L/usr/kerberos/lib -lnetsnmp -lcrypto -lelf -lm conftest.c -lnetsnmp -lhistory -lreadline -lncurses -laspell -lpspell -lgmp -ldb-4.2 -lcurl -lbz2 -lz -lpcre -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -lresolv -ldl -lz -lcurl -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -lresolv -ldl -lz -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv -lidn -lssl -lcrypto -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -lresolv -ldl -lz -lz -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -lresolv -ldl -lz -lxml2 -lz -lm >&5
    /usr/bin/ld: cannot find -lnetsnmp

  30. Jason
    May 03 - 10:38 pm

    I've got 5.1.2-11.EL4.7 installed of net-snmp, net-snmp-devel, and net-snmp-libs.

  31. Tony
    May 04 - 9:28 am

    hmm, that's weird I have a different verion of the devel package:

    That's probably what the problem is.


    AM Software Design
    Home of Lightning Admin for PostgreSQL and MySQL

  32. Tony
    May 04 - 10:06 am

    Hi Jason,
    I got it compiled and working perfectly.
    Thank you so much for this guide. You should contact the Centos people and see if you can get your work in the CentOSPlus repository.

    In case anyone else is having issues with SNMP, make sure you have lm_sensors and net-snmp-libs, they were not showing on my system as dependencies and I only found out I was missing them when I tried to downgrade my net-snmp to the same version as net-snmp-devel.
    For whatever reason I had a different version of the devel package and that was causing issues with the dependencies.

    On another note:
    Jason, do you use PostgreSQL at all? If so would you be interested in doing a review of Lighting Admin?

    AM Software Design
    Home of Lightning Admin for PostgreSQL and MySQL

  33. Jason
    May 04 - 3:16 pm

    Sorry, no, I don't generally use PostgreSQL. About 90% of the DB-driven applications I work with run from MySQL and the other 10% on Microsoft SQL Server.

  34. [...] been quite a while since the last release of PHP 5.2.  The article I posted on upgrading to PHP 5.2.1 was published back on 2/10/2007, just short of 3 months ago.  That all said, PHP 5.2.2 has finally [...]

  35. Tony
    May 08 - 9:32 pm

    Hi Jason,
    I have another question for you...
    5.2 is supposed to have a built in extension for upload progress bar hooks, but after I built the source RPM the is not in the modules directory.
    Any idea?




    I also have a MySQL version of Lightning Admin, would you be interested in doing a review of that on your site? Reviewers of course get a commercial copy for no charge.

  36. Jason
    May 09 - 4:30 pm

    In order to get progress data for file uploads you need to install the pecl extension "uploadprogress". You can do that by running the command "pecl install uploadprogress". Once you've done that, you'll need to edit your php.ini to load the extension. Finally, you'll need to create a hidden form element called "UPLOAD_IDENTIFIER" so that your progress calls know which upload to track.

    As to reviewing a copy of your software, If you'd like, email me at jasonlitka AT and we can talk some more.

Leave a Reply

You must be to post a comment.

Mobile Theme