Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

/etc/php-5.2.8/

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
add comment

1 Answer

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 #
  5
  6 LoadModule php5_module modules/libphp5.so
  7
  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/libphp5.so.

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
3  
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 php.net/releases. 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
add comment

Your Answer

 
discard

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.