Upgrading Major Versions of PHP

From Apoyar Wiki
Jump to navigation Jump to search

PHP UPGRADING


• For checking the version of PHP the command is php –v.

• root@live:/home/neal # php –v.Now we are using the version of PHP 7.0 but that was last till is 1st jan 2019 for Apoyar_live_test.

• First we should find the list of modules for that

• root@live:/home/neal # php –m

• This above command gives the list of all the php modules which are on php version.There is an list of modules we should have to follow that.Now we

should remove all the modules and replace the modules with new one.

• root@live:/home/neal # dpkg -l grep php.

• This command gives the modules which are present on php version and in this packages will contain more than one module.

• Now we need to remove all the packages one by one by using the command.

• root@live:/home/neal # apt-get purge php7.0 php7.0-common php7.0-curl php7.0-fpm.

• First we should execute above command and remove this four modules due to the dependencies it will remove more modules.after completion of this.

• Again execute the below command it will shows which are still available modules.

• root@live:/home/neal # dpkg -l grep php

• This shows the remaining modules we should remove them also for that.

• root@live:/home/neal # apt-get purge php-common.

• Now we should install the 7.4

• root@live:/home/neal # apt-get install php7.4

• Now we should see the list for this

• root@live:/home/neal # dpkg -l grep php

• There we can see php 7.4.now we should search for list of modules by using this below command.

• root@live:/home/neal # php –m

• By this we can see list of modules which are installed with php7.4 now we should compare the modules with the previous version of php and we have install the missing modules.

• root@live:/home/neal # apt-get install php7.4-curl php7.4-dom php7.4-mbstring php7.4-mysql php7.4-sqlite php7.4-pgsql

• Now we should remove apache as nginx is already running on the port.For removing apache.

• root@live:/home/neal # dpkg -l grep apache

• root@live:/home/neal # apt-get purge apache2 apache2-bin apache2-data apache2-utils.

• Now we should replace this php7.4 in nginx configurations.

• root@live:/etc/nginx/sites-available# vi apoyarcloud.conf

• After going into that file under the location ~ \.php$ {

• Under that it shows the old version of php for upgrading there we should go to below path

• root@live:/etc/nginx/sites-available#

• After going into that path with should run below command.

• grep -rli 'php7.0' * | xargs -i@ sed -i 's/php7.0/php7.4/g' @