PHP team released PHP 7.3 for general availability (GA) and marked the third feature update to PHP 7. You can upgrade your PHP to the latest release PHP 7.3 on your Google Cloud Compute Engine.
Many popular CMS like WordPress, Joomla, Drupal, Magento, Prestashop, Opencart, etc and frameworks like CodeIgniter, Laravel, etc use PHP to function…
Here is a brief guide to show you how to install and upgrade to PHP 7.2 on Ubuntu 18.04 LTS with Nginx on Google Cloud
Prerequisites
- Comfortable using LINUX command line interface
- Your Compute Engine Instance running.
- For setting up Compute Engine, see the Setting up Compute Engine Instance
- Domain name is pointed to your virtual machine.
Install PHP 7.3
sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.3-fpm php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip unzip -y
After the installation has completed, confirm that PHP has installed correctly with this command
php-fpm7.3 -v
Now that PHP 7.3.* has installed and you need to configure the user and group that the service will run under.
sudo nano /etc/php/7.3/fpm/pool.d/www.conf
Change the following lines by replacing the www-data with your username
.
user = www-data group = www-data listen.owner = www-data listen.group = www-data
Now we configure PHP for WordPress by changing some values in php.ini
.
sudo nano /etc/php/7.3/fpm/php.ini
Hit F6 for search inside the editor and update the following values
upload_max_filesize = 32M post_max_size = 48M memory_limit = 256M max_execution_time = 600 max_input_vars = 1000 max_input_time = 400
Hit CTRL+X
and Y
to save the configuration and check if the configuration is correct and restart PHP
sudo php-fpm7.3 -t sudo service php7.3-fpm restart
Now we have installed PHP 7.3 in Ubuntu 18.04 LTS.
Upgrade to PHP 7.3 – Nginx
Once you have installed and configured PHP 7.3 you can update the Nginx configuration to use PHP 7.3 for your website.
SSH your VM Instance and edit the Nginx configuration file for your website with the following command
sudo nano /etc/nginx/sites-availabale/yourdomainname.com
Find the line with fastcgi_pass unix:/run/php/php7.2-fpm.sock;
Update the php7.2-fpm.sock
to php7.3-fpm.sock
So the output will be
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
Check your configuration and restart Nginx for the changes to take effect
sudo nginx -t sudo service nginx restart
Leave a Reply
You must be logged in to post a comment.