How to upgrade the php version in Lampp in Ubuntu

Tags:

Answer: 1

1 hours ago

I need to upgrade the php version to 7.2 in my Lampp. Actually, when I am checking php -v in terminal, it's showing the following result:

PHP 7.2.1-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Jan 11 2018 22:52:58) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.2.1-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies

But I am running the file from opt/lampp/htdocs and there I am getting the php version as 5.6.3 which needs to be upgraded to 7.2. I was referring the following steps to install this originally.

sudo apt-get install apache2 mysql-server php7-mysql php7 libapache2-mod-php7 php7-mcrypt phpmyadmin

Package manager info:

$ apt-cache policy apache2 mysql-server php7-mysql php7 libapache2-mod-php7 php7-mcrypt phpmyadmin
apache2:
  Installed: 2.4.7-1ubuntu4.18
  Candidate: 2.4.7-1ubuntu4.18
  Version table:
     2.4.10-1ubuntu1.1~ubuntu14.04.2 0
        100 http://in.archive.ubuntu.com/ubuntu/ trusty-backports/main amd64 Packages
 *** 2.4.7-1ubuntu4.18 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.4.7-1ubuntu4 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
mysql-server:
  Installed: 5.5.58-0ubuntu0.14.04.1
  Candidate: 5.5.58-0ubuntu0.14.04.1
  Version table:
 *** 5.5.58-0ubuntu0.14.04.1 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     5.5.35+dfsg-1ubuntu1 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
phpmyadmin:
  Installed: 4:4.0.10-1
  Candidate: 4:4.0.10-1
  Version table:
 *** 4:4.0.10-1 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status
N: Unable to locate package php7-mysql
N: Unable to locate package php7
N: Unable to locate package libapache2-mod-php7
N: Unable to locate package php7-mcrypt
Added by: Jerrell Block DDS

Answer: 2

31 hours ago

Seems you have already installed the newest version of PHP, then jump into the 2nd part of this answer. Please check you have installed LAMP stack correctly, follow a tutorial like this,

Then please follow the exact steps.First,

1. Install the newest version of PHP on your Linux machine

# apt update

Then install following packages to install PHP newest PHP versions using PPA,

# apt install python-software-properties

# add-apt-repository ppa:ondrej/php

Then,

# apt update

Then you can check PHP versions available in apt,

$ apt show php -a | grep version or $ apt show php -a | grep -i version

Then install the newest version available in there.For an example, if you want to install PHP version 7.2,

# apt install php7.2

To check if the PHP is in the newest version, run the following command,

$ php -v

2. Change the PHP version of the lamp

# a2dismod php5 to disable current version

# a2enmod php7.2 to enable current version

# service apache2 restart or # /etc/init.d/apache2 restart

Hope you found it useful.

Answer: 3

21 hours ago

Try this steps and your php version will get upgraded.

apt-get update
sudo apt-get install -y apache2
sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip

then check php version,

php-v
Added by: Nedra O'Kon V

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9