Author: Dan
Date: 30/01/2021
Category: News

How to upgrade to php v8 on Arch Linux

Let's switch to v8 now!
You could ignore the php packages until your web applications like Nextcloud, FreshRSS ... are updated, which are not compatible with v8 at the moment for example, but that would be a bad idea if some security updates are required!

1. Check all php packages

You might need it. Copy the list.

pacman -Q | grep php



2. Backup your php.ini file

Also backup www.conf and other files if you have changed anything for php7.

cp /etc/php/php.ini .



3. Update your system

pacman -Syu



4. Restart system if necessary





5. Check all your applications

If everything runs. NICE, you're almost done! Just merge the pacnew files and restart php8.
If not, keep going.





6. Install all your php7 packages

Check your list of position number 1 and add the 7 after php.

pacman -S php7 php7-fpm ...




7. Move php.ini (7) as pacnew file and copy your php.ini to the directory

mv /etc/php7/php.ini /etc/php7/php.ini.pacnew
cp php.ini /etc/php7/




8. Merge all pacnew files

etc-update

Warning! (only php7)
Pay special attention to the php7 - php.ini file:
extension_dir = "/usr/lib/php/modules/" | extension_dir = "/usr/lib/php7/modules/"






9. Change the php socket path in nginx

If you have a php.conf file in your nginx directory, just copy it and rename it to php7.conf. Change your pages/configuration files which aren't compatible with php8 to
included php7.conf; and change the path to php7 in your config file (see below).

fastcgi_pass unix:/var/run/php-fpm7/php-fpm.sock;






10. Restart/start nginx and php7

systemctl enable php-fpm7.service && systemctl start php-fpm7.service && systemctl restart nginx.service



That's it.