Reputation: 4949
I'm running Ubuntu 12.0, apache2. I manually installed PHP 5.2.17. I also installed, sudo apt-get install libapache2-mod-php5
When I type
php --version
it shows,
PHP 5.2.17 (cli) (built: Dec 27 2015 01:01:25) Copyright (c) 1997-2010 The PHP Group
-However when I used the php script
<?php
echo 'Current PHP version: ' . phpversion();
echo phpversion('tidy');
?>
I have no idea where 5.3.10 came from but is there anything I can do to get Apache to run 5.2.17 instead? Thank you. Ahdee
Upvotes: 2
Views: 855
Reputation: 1223
Apache will be loading/using a different binary than the one on your command line. Comparing the path to the php binary from phpinfo()
with that found on the command line via $ which php
will likely show the difference.
To install a specific version of php for mod-php5 there's a handy guide here. You can also look at compiling a specific version of PHP from source though this becomes slightly more complicated and requires ongoing maintenance to patch.
As this guide suggests, you should really be upgrading to a more recent version. Contrary to the advice of the article (which was accurate at the time of authoring) PHP 5.5 is currently the lowest version still receiving (security only) support.
Ubuntu LTS backports security fixes into its supported php package. If you opt to use a custom php package that is not in the main repositories (e.g. you stray to a specific version or you decide to compile your preferred version) you'll not be receiving these security patches for your version of PHP which significantly reduces the security of your application.
Upvotes: 1