LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-28-2017, 03:22 PM   #1
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 83

Rep: Reputation: 6
PHP version


Hi all,

Re my Ubuntu 14.04 server I upgraded PHP from 5 to 7. The command line is now using 7 =

Code:
$ php -v
PHP 7.0.16-3+deb.sury.org~trusty+1 (cli) (built: Feb 22 2017 10:27:05) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.16-3+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies
$
But the Apache web browser is still using 5.5.9. Any ideas what I am missing or how do I tell Apache to use PHP 7?

Thanks...
 
Old 03-01-2017, 12:47 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,700

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Quote:
But the Apache web browser is still using 5.5.9. Any ideas what I am missing or how do I tell Apache to use PHP 7?
The libapache2 module should be installed along with php-7. Did you restart apache after installing php-7, so it loads the new php module?
If it still doesn't work you may need to run one or both of the following:
Code:
sudo apt-get install libapache2-mod-php7.0
sudo a2enmod php7.0
Also you should clear your browser cache before testing.

Regards

Last edited by bathory; 03-01-2017 at 12:48 AM.
 
Old 03-01-2017, 06:23 AM   #3
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 83

Original Poster
Rep: Reputation: 6
@bathory thanks for your reply - please see below...

Code:
$ apt-get install libapache2-mod-php7.0                                                                                                          
Reading package lists... Done
Building dependency tree
Reading state information... Done
libapache2-mod-php7.0 is already the newest version.
libapache2-mod-php7.0 set to manually installed.
The following package was automatically installed and is no longer required:
  libvpx1
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 134 not upgraded.
$ a2enmod php7.0
Considering dependency mpm_prefork for php7.0:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.0:
ERROR: Module php5 is enabled - cannot proceed due to conflicts. It needs to be disabled first!                                                                                                     
$
Actually I don't really need PHP 5 so maybe it is just easier to remove it rather than having both PHP 5 and PHP 7.
If so is it this ?

Code:
$ apt-get purge 'php5*'
 
Old 03-01-2017, 06:29 AM   #4
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903Reputation: 2903
Hi Juc1. Just a side note that with 134 packages not upgraded, I would advise you to get on top of your updates with:

sudo apt-get update

followed by

sudo apt-get upgrade
 
Old 03-01-2017, 07:08 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,700

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Quote:
ERROR: Module php5 is enabled - cannot proceed due to conflicts. It needs to be disabled first!
Disable the php5 module prior enabling php7
Code:
a2dismod php5
Quote:
Actually I don't really need PHP 5 so maybe it is just easier to remove it rather than having both PHP 5 and PHP 7.
If so is it this ?

$ apt-get purge 'php5*'
Yes but need to be run using sudo

Also consider upgrading to the latest 16.04, or at least update those 134 packages as hydrurga said.
 
Old 03-01-2017, 08:57 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180Reputation: 3180
Do be very careful to test your web sites for compatibility with PHP-7.

Be prepared for the fact that they very well might not be.
 
Old 03-02-2017, 09:05 AM   #7
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 83

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by hydrurga View Post
Hi Juc1. Just a side note that with 134 packages not upgraded, I would advise you to get on top of your updates with:

sudo apt-get update

followed by

sudo apt-get upgrade
ok done
 
Old 03-02-2017, 09:12 AM   #8
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 83

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by sundialsvcs View Post
Do be very careful to test your web sites for compatibility with PHP-7.

Be prepared for the fact that they very well might not be.
OK just testing, not production
 
Old 03-02-2017, 09:14 AM   #9
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 83

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by bathory View Post
Disable the php5 module prior enabling php7
Code:
a2dismod php5
Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP error after upgrading to latest version of PHP Skillz Programming 3 08-17-2012 08:02 PM
How to upgrade php from version 5.1.6 to version 5.3.6 on Centos Manpasand Linux - Server 2 08-09-2011 01:54 AM
How to upgrade php from version 5.2.10 to version 5.3.3 on Centos ashlule1 Linux - Newbie 3 10-18-2010 02:55 AM
Compiling PHP 5.1.6 from source - php -v and phpinfo() version discrepancy nicky77 Linux - Software 7 03-05-2010 02:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration