I have install LAMP stack on ubuntu 16, I got php 7.
I want to downgrade it to php 5.4 . what command should I use to remove php 7 and install php 5.4 in my ubuntu 16?
try this
sudo apt-get purge php*
then
sudo apt-get install php5.4 php5.4-gettext php5.4-common
First, remove LAMP from your Ubuntu.
Then, use the following:
sudo apt-get update
sudo apt-get install apache2 php5 mysql-server mysql-client php5-mysql //install php 5.3
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get remove php5 //remove php 5.3
sudo apt-get update
sudo apt-get install php5 //install php 5.4
First you must install PHP 5.4 (if you have not already done so):
sudo apt-get install php5-fpm php5-mysql
And then:
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.4 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.4
Related
I install vesta control panel on my ubuntu EC2 instance on AWS. By default vesta uses php 7.3 but my script demands php 5.6. So i had to downgrade my php version from and followed below method:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php5.6
php -v
--This may show your old version.
--So now to switching the versions 7.0 > 5.6
sudo a2dismod php7.0
sudo a2enmod php5.6
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php5.6
--Basically need to install few modules first
sudo apt-get install php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6
--enabling your required extensions example >>> sudo phpenmod mbstring
sudo apt-get update
sudo update-alternatives --set php /usr/bin/php5.6
sudo service apache2 restart
https://forum.vestacp.com/viewtopic.php?t=6898
After PHP 5.6 is running fine but my phpmyadmin is showing blank page. I tried many online solutions but i couldn't resolve it.
For some reason, my php cli switched to 5.6.40 instead of the 7.2 version that I had before. Then I was unable to restart apache2, so I tried to apt purge php7 & php5 to reinstall them.
But now, I only have this error:
(sorry for the French, it says packages have unsatisfied dependencies). How can I clean it ?
I have already tried the following commands :
apt-get -f install
apt-get clean
apt-get update
apt-get upgrade
You have to purge comlete php7.3:
sudo apt-get remove -y --purge php7.3*
add repository (if not exist):
sudo add-apt-repository ppa:ondrej/php
install dependents
sudo apt install php libapache2-mod-php
if you have apache:
sudo systemctl restart apache2
if you have nginx:
sudo service nginx restart
install php:
sudo apt install php-fpm
check php:
sudo service php7.3-fpm status
I want to upgrade my apache php version on ubuntu 16.04. Right now phpinfo() shows 7.0.26. How can I upgrade?
I want to upgrade to phpversion 7.2. sudo apt install php7.2, doesn't update the apache php version. How can I update the apache php version.
I'm assuming that you already have apache and php 7.0 installed, and that you're using the Ondřej Surý PPA something like this:
LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2
At this point, you would need to remove the old libapache2-mod-php package, install the new one, and restart apache:
sudo apt remove libapache2-mod-php*
sudo apt update
sudo apt install libapache2-mod-php7.2
sudo service apache2 restart
Now, phpinfo() from within a web page should show PHP Version 7.2.0-2+ubuntu16.04.1+deb.sury.org+2
If the add-apt-repository command is missing, you can install it with:
sudo apt install software-properties-common
Please run below commands to upgrade your PHP version to 7.2
sudo apt-get update
sudo apt-get install python-software-properties
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get install php7.2
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo update-alternatives --set php /usr/bin/php7.2
sudo service apache2 restart
sudo apt-get install libapache2-mod-php7.2 php7.2-cgi php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pspell php7.2-readline php7.2-soap php7.2-xml
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
sudo service apache2 restart
Hope this helps !!!
In this way, simply run following order for update php rendition.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.3
Upgraded to Ubuntu 16.04 and facing problem after installing PHP5.
Installed PHP-5 with following:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.5 # for PHP 5.5
Trying to install php-curl but its not working.
sudo apt-get install php5-curl
Error: E: Unable to locate package php5-curl
In Ubuntu 16.04 default PHP version is 7.0, if you want to use different version then you need to install PHP package according to PHP version:
PHP 7.4: sudo apt-get install php7.4-curl
PHP 7.3: sudo apt-get install php7.3-curl
PHP 7.2: sudo apt-get install php7.2-curl
PHP 7.1: sudo apt-get install php7.1-curl
PHP 7.0: sudo apt-get install php7.0-curl
PHP 5.6: sudo apt-get install php5.6-curl
PHP 5.5: sudo apt-get install php5.5-curl
This worked for me.
sudo apt-get install php-curl
This works for me:
sudo apt-get install php5.6-curl
Do:
apt-get update
And then:
apt-get install php5-curl
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php8.0-curl
To Install cURL 7.49.0 on Ubuntu 16.04 and Derivatives
wget http://curl.haxx.se/download/curl-7.49.0.tar.gz
tar -xvf curl-7.49.0.tar.gz
cd curl-7.49.0/
./configure
make
sudo make install
For Ubuntu 18.04 or PHP 7.2 users you can do:
apt-get install php7.2-curl
You can check your PHP version by running php -v to verify your PHP version and get the right curl version.
sudo apt-get install php5.6-curl
and restart the web browser.
You can check the modules by running php -m | grep curl
Recently the new php7 has been released. However, when I am trying to install the gd package, the library can not be found.
I have tried through
sudo apt-get install php70-gd
and
sudo apt-get install php70-php-gd
Does anybody have an idea if gd is available for php 7?
PHP7 packages for Ubuntu including php7.0-gd can be installed via PPA for PHP by Ondřej Surý:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Next, install the desired version:
sudo apt-get install php7.0-gd
# or
sudo apt-get install php7.1-gd
# or
sudo apt-get install php7.2-gd
# or
sudo apt-get install php7.3-gd
# or
sudo apt-get install php7.4-gd
EDIT:
As MacroMan stated, under Ubuntu 16.04 you don't need to add the repository any more. Simply issuing sudo apt-get install php7.0-gd works.
just try
sudo apt-get install php7.0-gd
i got it working that way.
Greetings.
In 2018, there is an alias package for this:
sudo apt-get install php-gd
Use this to retrieve the last version.
my php version is 7.1
sudo apt-get install php7.1-gd
this command is work for me
For
Ubuntu 16.04.4 LTS
this is the command:
sudo apt-get install php7.0-gd
check php verison first using
php -v
It will give version number suppose your version is 7.0.1 then use this command to install GD Library
sudo yum install php70-gd
OR use this command depending upon server specification
sudo apt-get install php7.0-gd