PHP4 on Fedora

Mauriat Miranda (

Other Guides/Resources

Published: 7 April 2006 (updated: 23 June 2008)

NOTE: The content of this page may be outdated. Links may not be valid and the steps detailed may no longer work. This page is saved for archival purposes only.

Installing PHP4 on Fedora

This guide shows how to install PHP4 on Fedora Core 6 (FC6) using a repackaged source RPM. Some PHP applications are not compatible with PHP5, hence the need for this guide.

Installing PHP4 on Fedora Core 5: These same steps will work on Fedora Core 5 (FC5).

Installing PHP4 on Fedora Core 4: These same steps will work on Fedora Core 4 (FC4) with some very minor differences.

NOTE: These builds have not been tested on PPC architecture. These RPMS apply to i386 and x86_64 architecture.

NOTE: These instructions were meant for Fedora Core 6 (FC6) and older. There are listed below SRC.RPM for Fedora 7, Fedora 8 and Fedora 9. Please take note of minor differences between versions.

NOTE: These files are provided for testing purposes only. They are NOT validated for security and hence should NOT be used on a production server.

Removing PHP5

All previously installed PHP5 RPM's must FIRST be removed either through yum or manually. Note that neither method will remember which parts of PHP were previously installed.

Through yum (preferred method):

[root@charon ~]# yum remove php php-common

Note: FC5 and FC4 users will not have the php-common package.

Manually make sure to get every RPM:

[root@charon ~]# rpm -qa | grep php

If there are any components remaining remove them manually using: rpm -e.

Modified SRC Package

The php4.src.rpm that is provided here is the same source as is provided in Fedora Core 3 Legacy ( However there are some minor modifications made in order for it to compile in GCC4.x (used by FC4, FC5 and FC6). The only differences are listed below:

Presently this should be compatible in features and functionalities across most Fedora releases.

[Right-Click] and Save

Based on: version 4.3.11-2.8.4.legacy
php-4.3.11-2.8.4.mjm.src.rpm	25-Oct-2006 21:52	4.9MB

Based on: version 4.3.11-2.8
php-4.3.11-2.8.1.mjm.src.rpm	13-Mar-2006 19:40	4.9MB

Do not link to these files, they are not in their permanent location!

Fedora 7 - php-4.3.11-2.8.5.mjm.fc7.src.rpm
Fedora 8 - php-4.3.11-2.8.6.mjm.fc8.src.rpm
Fedora 9 - php-4.3.11-2.8.6.mjm.fc9.src.rpm


To compile the SRC.RPM have all the dependancies regardless if they will be used or not. If any dependancies are missed it will complain in the next step.

[root@charon ~]# yum install apr-devel apr-util-devel libc-client \
postgresql beecrypt-devel elfutils-devel mysql-devel postgresql-devel \
httpd-devel net-snmp-devel libc-client-devel aspell-devel unixODBC-devel \

Compile the RPM. (PHP5 must be removed before this step):

[root@charon ~]# rpmbuild --rebuild php-4.3.11-2.8.4.mjm.src.rpm

NOTE: If most likely will have errors similar to the following:

001+ PHP Warning: mime_magic: type regex BEGIN[[:space:]]*[{] application/x-awk invalid in Unknown on line 0

This will happen for users with the file RPM newer than version 4.16. (Thanks to Alex Dupay).

[mirandam@charon ~]$ rpm -q file

To fix this, open /usr/share/file/magic.mime in a text editor (gedit, kate, nano, etc) and comment out line 273:

/usr/share/file/magic.mime  Line 273:
0	regex		BEGIN[[:space:]]*[{]	application/x-awk
#0	regex		BEGIN[[:space:]]*[{]	application/x-awk

Recompile the SRC.RPM. All the RPM's will be located in: /usr/src/redhat/RPMS/

Pre-Compiled Binaries

NOTE: Precompiled binaries WILL NOT be gauranteed to be up to date (below). The RPM's for FC5 are already out of date.

The following precompiled binaries RPM's for Fedora Core currently providing . Do not link to these files, they are not in their permanent location!

Fedora Core 6 - FC6 - i386, compiled with GCC 4.1

php-4.3.11-2.8.4.mjm..> 25-Oct-2006 22:02   1.4M  
php-debuginfo-4.3.11..> 25-Oct-2006 22:04   5.1M  
php-devel-4.3.11-2.8..> 25-Oct-2006 22:04   404k  
php-domxml-4.3.11-2...> 25-Oct-2006 22:04    52k  
php-gd-4.3.11-2.8.4...> 25-Oct-2006 22:04   105k  
php-imap-4.3.11-2.8...> 25-Oct-2006 22:04    51k  
php-ldap-4.3.11-2.8...> 25-Oct-2006 22:04    34k  
php-mbstring-4.3.11-..> 25-Oct-2006 22:05   908k  
php-mysql-4.3.11-2.8..> 25-Oct-2006 22:05    36k  
php-ncurses-4.3.11-2..> 25-Oct-2006 22:05    40k  
php-odbc-4.3.11-2.8...> 25-Oct-2006 22:05    42k  
php-pear-4.3.11-2.8...> 25-Oct-2006 22:05   349k  
php-pgsql-4.3.11-2.8..> 25-Oct-2006 22:05    51k  
php-snmp-4.3.11-2.8...> 25-Oct-2006 22:05    27k  
php-xmlrpc-4.3.11-2...> 25-Oct-2006 22:05    55k  

Fedora Core 5 - FC5 - i386, compiled with GCC 4.1

php-4.3.11-2.8.1.mjm..> 03-Apr-2006 22:05   1.4M  
php-debuginfo-4.3.11..> 03-Apr-2006 22:05   5.1M  
php-devel-4.3.11-2.8..> 03-Apr-2006 22:05   403k  
php-domxml-4.3.11-2...> 03-Apr-2006 22:05    51k  
php-gd-4.3.11-2.8.1...> 03-Apr-2006 22:05   103k  
php-imap-4.3.11-2.8...> 03-Apr-2006 22:05    50k  
php-ldap-4.3.11-2.8...> 03-Apr-2006 22:05    33k  
php-mbstring-4.3.11-..> 03-Apr-2006 22:05   907k  
php-mysql-4.3.11-2.8..> 03-Apr-2006 22:05    35k  
php-ncurses-4.3.11-2..> 03-Apr-2006 22:05    40k  
php-odbc-4.3.11-2.8...> 03-Apr-2006 22:05    41k  
php-pear-4.3.11-2.8...> 03-Apr-2006 22:05   349k  
php-pgsql-4.3.11-2.8..> 03-Apr-2006 22:05    51k  
php-snmp-4.3.11-2.8...> 03-Apr-2006 22:05    27k  
php-xmlrpc-4.3.11-2...> 03-Apr-2006 22:05    54k

Fedora Core 5 - FC5 - x86_64, compiled with GCC 4.1

php-4.3.11-2.8.1.mjm..> 08-Jul-2006 14:28   1.5M  
php-debuginfo-4.3.11..> 08-Jul-2006 14:31   5.4M  
php-devel-4.3.11-2.8..> 08-Jul-2006 14:31   402k  
php-domxml-4.3.11-2...> 08-Jul-2006 14:31    54k  
php-gd-4.3.11-2.8.1...> 08-Jul-2006 14:32   104k  
php-imap-4.3.11-2.8...> 08-Jul-2006 14:32    50k  
php-ldap-4.3.11-2.8...> 08-Jul-2006 14:32    34k  
php-mbstring-4.3.11-..> 08-Jul-2006 14:32   910k  
php-mysql-4.3.11-2.8..> 08-Jul-2006 14:32    36k  
php-ncurses-4.3.11-2..> 08-Jul-2006 14:32    41k  
php-odbc-4.3.11-2.8...> 08-Jul-2006 14:32    42k  
php-pear-4.3.11-2.8...> 08-Jul-2006 14:32   348k  
php-pgsql-4.3.11-2.8..> 08-Jul-2006 14:33    51k  
php-snmp-4.3.11-2.8...> 08-Jul-2006 14:33    27k  
php-xmlrpc-4.3.11-2...> 08-Jul-2006 14:33    53k


Manually install all the RPM's that the system requires. For example on i386:

[root@charon i386]# rpm -ivh php-4.3.11-2.8.4.mjm.i386.rpm \
php-domxml-4.3.11-2.8.4.mjm.i386.rpm \
php-gd-4.3.11-2.8.4.mjm.i386.rpm \
php-mysql-4.3.11-2.8.4.mjm.i386.rpm \
php-pear-4.3.11-2.8.4.mjm.i386.rpm \

NOTE: The php and php-pear RPM's MUST be installed at the SAME. Most other RPM's can be installed separately.

If RPM's were compiled, then ALL dependancies will be met. It is recommended to remove any unnecessary RPM's (ex: postgres).

If RPM's were downloaded, then it is required to manually determine dependancies.

Other Possible Idea: Using yum localinstall filename.rpm, it is possible for yum to grab dependancies automatically. However on testing, this has not been very reliable!


Updating through yum will update PHP4 to PHP5. The following changes are required to prevent yum from doing so:

EDIT: /etc/yum.conf
ADD at the end of the file:


Presently, to maintain compatibility no updates on this page will be provided outside of any officially updated release by Redhat/Fedora or in the event of a security advisory. It is not recommended to rely on this page or any information provided here for production servers.

More Information

Most other ideas are available on the guide: PHP4 on Fedora Core 4

Special Thanks to Jim Walters (jimw[at] who provided the initial help on this guide.

Comments, suggestions, questions or any feedback welcome for this page or any of my Resources. Please use the contact link.

Help Out: If you found this guide or any Resource helpful, please consider supporting this site by recommending this page to others or linking to this page. I appreciate all the support I receive. Thank you in advance.

Disclaimer: The author makes no claim to the accuracy of the information provided. This information is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY. There is no implied support from referencing this guide. Any help that is provided is at will. Use this information at your own risk. Always make proper backups and use caution when modifying critical system files.

PLEASE DO NOT mirror, translate or duplicate this page without contacting me.

Copyright © 2003-2013 by Mauriat Miranda (