upgrading php 7 in lamp - php

I have lamp server installed in ubuntu OS. And, when I check my php version using phpinfo() function using php file over web browser it shows PHP Version as 5.5.6 and when I check through terminal window using php -v it shows, following message:
PHP 5.6.11-1ubuntu3.4 (cli) Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
So, I need to know which is my current php version and which version is running in my lamp server.

Related

php versions are shown differently in WHM and server

In server, it shows 7.0 php like below from either cPanel
or cat /etc/apache2/conf.d/php.version in server
However in php --version, it shows php5.6.
How can I upgrade my php to 7.0? Thanks.
If you change PHP version from cpanel account it will be applied and your website will use the new version.
php -v command shows the default version of PHP for your system but if you want to check PHP version for your cpanel account only you have to modify your ~/.bashrc file:
alias php="/opt/cpanel/ea-php70/root/usr/bin/php"
and then:
source ~/.bashrc
Now you'll find the output some thing like:
php -v
PHP 7.0.33 (cli) (built: xxxxxx) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies

Failed loading xdebug.so undefined symbol: zend_empty_string

I can't debug PHP script in Visual Studio Code - Linux (Ubuntu 18.04.2 LTS).
Before Update, the Xdebug version I was fettching error such as :
Xdebug requires Zend Engine API version 320170718.
The Zend Engine API version 320160303 which is installed, is outdated.
After an update the Xdebug version now fetching following error:
Error: Failed loading /opt/lampp/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so: /opt/lampp/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so: undefined symbol: zend_empty_string.
This is my PHP status:
php -v
PHP 7.2.17-0ubuntu0.18.04.1 (cli) (built: Apr 18 2019 14:12:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.17-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
Please correct me if anything is missing at my end.
I would suggest to use the tailored wizard from the Xdebug website:
Xdebug Wizard
It seems that you are mixing the PHP versions: The Zend Engine API version 20160303 corresponds to PHP 7.1. For 7.2 you will need API version 20170718.
I suppose you have several versions of PHP active - most probably 7.1, 7.2 and 7.3. In such case you need to run the proper phpize - phpize7.2 when going through the wizard.

phpversion() function and `php -version` on terminal returning different results

I just upgraded my PHP version from PHP 5.59 to PHP 6 by following this answer
Upgrade php 5.5.* to php 5.6.* using apt-get
But I am getting a strange problem PHP -version on terminal result in
PHP 5.6.34-1+ubuntu14.04.1+deb.sury.org+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
but phpversion() is still retuning the old version which is
5.5.9-1ubuntu4.24

How to make Drupal use php 5.6 instead of php 7.1.7 (default php version of Sierra)

macOs High Sierra comes with php 7 by default. I want to run a Drupal 6 website on php 5.6. I have already installed php 5.6.
Running php -v gives
PHP 5.6.33 (cli) (built: Jan 7 2018 11:14:18) 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
But when I print phpinfo() in drupal website, it shows PHP Version 7.1.7 as version.
How can I make drupal use php 5.6 ?

Downgrade from php 5.5 to php 5.4 on ubuntu 14.04

Hello guys i have a php code that is running on the version 5.4 so i cannot use the version 5.5 i read alot of threads but nobody seems to solved me the problem can anyone help? thanks in adanvance
when i do php -v this is what i get
PHP 5.5.34-1+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
i am really getting crazy i dunno how to get it since i read that php is not supporting the 5.4 version any more

Categories