Shadowmak
Shadowmak

Reputation: 111

Apache using old PHP version

When I execute phpInfo.php script on my Linux (fedora)

<?php
phpinfo();
?>

It gives PHP Version 5.5

Whereas when I reach it using my Apache server (via browser) it gives me old PHP 5.3 version.

Found that Apache is using some library (LoadModule php5_module modules/libphp5.so) - found it in php.conf.

Can anyone help how to change version Apache is using?

Or is there another way to force Apache to use another version of PHP?

Thank you in advance.

Upvotes: 2

Views: 1936

Answers (1)

Kryten
Kryten

Reputation: 15790

First, I'm not that familiar with package management on Fedora, so perhaps someone else can check the commands I've listed below.

On Debian, there are (at least) two different PHP packages:

php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language

When you run your script from the command line, you're executing the second one of these. When you run your script via Apache, you're executing the first.

I've never known these to get out of sync - I've always seen both with the same version - but it doesn't sound like something impossible. I can imagine that if I really wanted to, I could figure out how to install different versions of both.

From my (limited) knowledge of package management on Fedora, I'd start by trying to update both packages to the latest version:

yum update php5-cgi
yum update php5-cli

Again, these may be named differently in the Fedora repositories, so you'll need to research that a little.

Upvotes: 2

Related Questions