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

I have a centos 6 vm as my development environment and came with php5.3.3 By this I mean I use yum to install php (yum install php)

I install php 5.4 with these instructions http://www.webtatic.com/packages/php54/

In command line (php -v) I have 5.4 but with apache I still have 5.3 (phpinfo())

I have looked and looked but I can't find a 5.4.so file that I can point apache to.

How do I get apache to use the 5.4 version?

#>yum list installed | grep php
php54w.x86_64          5.4.19-1.w6      @webtatic                               
php54w-cli.x86_64      5.4.19-1.w6      @webtatic                               
php54w-common.x86_64   5.4.19-1.w6      @webtatic                               
php54w-devel.x86_64    5.4.19-1.w6      @webtatic                               
php54w-gd.x86_64       5.4.19-1.w6      @webtatic                               
php54w-mbstring.x86_64 5.4.19-1.w6      @webtatic                               
php54w-mysql.x86_64    5.4.19-1.w6      @webtatic                               
php54w-pdo.x86_64      5.4.19-1.w6      @webtatic                               
php54w-pear.noarch     1:1.9.4-7.w6     @webtatic                               
php54w-soap.x86_64     5.4.19-1.w6      @webtatic

In my case there is no php configuration in http.conf but all *.conf files are included in conf.d folder. In the conf.d folder there is a php.conf and it contains.

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule !worker.c>
  LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
  LoadModule php5_module modules/libphp5-zts.so
</IfModule>

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
share|improve this question
    
When you say it came with 5.3.3 what do you mean. Was it installed as a package (if so you should be able to remove it). More information would be helpful. –  Drew Khoury Sep 23 '13 at 9:44
    
Add the output of "# yum list installed | grep php" to the question –  ALex_hha Sep 23 '13 at 9:52
    
Questing updated as requested –  garethhallnz Sep 23 '13 at 10:37
1  
Have you restarted apache since installing the php 5.4 RPMs? –  MadHatter Sep 23 '13 at 10:48
    
Yes I have with apachectl restart. I have also done a complete OS reboot –  garethhallnz Sep 23 '13 at 11:05

1 Answer 1

In your Apache2 configuration (or vhost config, depending on your setup) there is a setting that selects the PHP version to use. As you configured apache with php 5.3, you have to change this to the new PHP version, something like this;

ScriptAlias /php5.3 /usr/local/php5.3/bin 
Action application/php5.3 /php5.3/php-cgi
AddType application/php5.3 .php
share|improve this answer
    
I have updated my question with more information. –  garethhallnz Sep 23 '13 at 20:57

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.