I have a centos server. I have installed apache 2.2.17 from a .tar.gz file. I've also install php 5.3 from the ius repository. That worked fine and apache is functioning and so is php 5.3. However, when i put a phpinfo.php file in the directory that apache should be serving files from, it doesn't work. I can only seem to get php to work if i use yum install httpd which installs an older vesion of apache. Any ideas? Thanks.


Assuming that you're installing a PHP module for Apache, you need to be using the same version of Apache it was built against. It's a bad idea to try to mix-and-match source packages and binary packages like this. Either find a reputable repository and install everything from there, or build everything from source, but trying to mix it up like this will usually lead to this sort of problem.


Open /etc/httpd/conf/httpd.conf using any editor like nano or vi, the go to section <IfModule mime_module> and make sure that you have this two lines:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

If you don't have them the add them and restart you apache like so:

/sbin/service httpd restart

As larsks mentioned, you're mixing and matching versions. That's why grabbing the version from Redhat's repository's worked. Do you really need the functionality provided in any of the newer versions of Apache? If not, go with the version provided by RedHat. It will have all the same security patches you'll find in the latest official Apache version. And it will obviously work with your version of PHP. And it will be far easier to maintain than the tarfile dump you're using now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.