Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ubuntu 10.04, MySQL 5.1, Apache 2.2, and PHP 5.2/5.3:

I just discovered that I am using the wrong version of PHP for a CRM application. Once I figured out how to make a simple phpinfo() script to tell me what Apache2 is using, I tried changing the php.ini such that my webserver would use the PHP I want. Well, this is my problem. Not sure how to do that.

I compiled the version of PHP I want to /etc here:


Inside this, there was a php.ini-recommended file that I made some changes to and renamed to php.ini so PHP would use it. But when I opened my browser and cleared my history and went to the http://localhost<CRM dir>/install.php address, the wizard still says I'm not usign the correct version of PHP.

Based on this post what do I have to do to change the version of PHP that shows up after I run my test.php script? In other words, phpinfo() says I'm running PHP 5.3.2, but I want to change it to my compiled 5.2.8 version located in /etc.

share|improve this question
up vote 5 down vote accepted

depending on your server, you should be looking in apache, not php.

(For RHEL/CentOS) look in : /etc/httpd/conf.d/php.ini

  1 #
  2 # PHP is an HTML-embedded scripting language which attempts to make it
  3 # easy for developers to write dynamically generated webpages.
  4 #
  6 LoadModule php5_module modules/
  8 #
  9 # Cause the PHP interpreter to handle files with a .php extension.
 10 #
 11 AddHandler php5-script .php
 12 AddType text/html .php

You'll see that your PHP module is modules/

AddHandler php5-script .php tells apache to run PHP on any file with the extension .php.

If your using a RPM based OS its probably easier to uninstall (assuming you can do that) the current verison of PHP, and reinstall the verison you are looking for.

rpm -qa | grep php

will show you what verison of PHP is currently installed.

share|improve this answer
It's worth mentioning you should bounce Apache after changing the config so it is picked up. – Ben Pilbrow Jun 7 '10 at 22:49
I really wish it was this easy. The only php.ini file I have in the server directory is /etc/apache2/php.ini but not where you suggest. This file doesn't have these components you speak of: LoadModule, AddHandler, AddType, etc. – nicorellius Jun 7 '10 at 23:44
interesting. What OS flavor are you running on? Was it configured via YUM, APT-Get, or YAST, (or some other package manager)? – GruffTech Jun 8 '10 at 18:11
Ubuntu 10.04. The new version of PHP (5.3.2) can easily be installed unsing apt-get, which I have done. But hte PHP 5.2.8 and 5.2.13 I compiled, using files from I actually kind of gave up trying to get older version of PHP to run. I think alternate approaches are in order for the sake of brevity. Thanks for your help, nonetheless... – nicorellius Jun 8 '10 at 22:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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