I needed to perform the upgrade php version from 5.3 to 5.6 (ubuntu 12.04).
I used the following commands:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get purge php5-common
sudo apt-get install libapache2-mod-php5.6
sudo a2dismod php5
sudo a2enmod php5.6 # after this command I get 'Module php5.6 does not exist'
sudo service apache2 restart
if check through the terminal “php --version” I see a new version:
PHP 5.6.30-1+deb.sury.org~precise+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
Through http request php does not work. If I understand correctly php already installed. But the apache can not determine it.
How can I fix this?
Thank you.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
12.04 LTS will be end of life in 2 months, why not upgrade to 14.04? This will upgrade PHP too.
Unless the libapache2-mod-php5.6 installs all required PHP packages for you during the process (and not just the module used by Apache to enable PHP), then you would most likely need to install additional PHP packages before you’ll be able to handle web-based requests.
When installing PHP from a PPA or the base repositories, the CLI package is often installed and when you run php -v from the CLI, the PHP CLI package is what’s giving you that result (this is especially the case with the PPA that you’re using – I’m very familiar with it).
So what you’d need to do is run:
sudo apt-cache search php5.6 --names-only
… and when you do, you’re going to see quite a few PHP 5.6 packages pop up in list format. You then need to install the packages that you need for your PHP installation. They may just be tagged as php5, though in some cases, he does tag them as php5.6 (or another version – that’s the case with newer packages for newer Ubuntu releases, such as 16.04).
Ideally, you’d install the common, dev, and cli packages. Once those are installed, if you need MySQL, you’d install the MySQL package, if Memcached, then the memcached package, etc. The only one you don’t want to install, since you’re not setup to use it (based on what you’ve provided) is the FPM package as to run that one you’d need to use another apache module instead of mod_php.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.