Ahmad Naser Turnkey Ecosystem Ahmad Naser
August 20, 2022

Fatspanel centos replace php cli 74

Published in the Ahmad Naser ecosystem. Estimated reading time: 2 minutes.

You can install PHP on the PC of CentOS 7 assuming that the Laravel environment is built.

Add and install repository
Execute the following command to add a repository.

$ sudo yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Execute the following command to install the necessary items.

$ sudo yum install --enablerepo=remi-php74 php74 php
$ sudo yum install --enablerepo=remi-php74 php-fpm
$ sudo yum install --enablerepo=remi-php74 php-mbstring
$ sudo yum install --enablerepo=remi-php74 php-mysqlnd
$ sudo yum install --enablerepo=remi-php74 php-pecl-zip
$ sudo yum install --enablerepo=remi-php74 php-xml
Confirm
Execute the following command to display the installed package named php.

$ yum list installed | grep php
Below is information about the installed package named php in my environment.

oniguruma5php.x86_64 6.9.5+rev1-2.el7.remi @remi-safe
php.x86_64 7.4.8-2.el7.remi @remi-php74
php-cli.x86_64 7.4.8-2.el7.remi @remi-php74
php-common.x86_64 7.4.8-2.el7.remi @remi-php74
php-fpm.x86_64 7.4.8-2.el7.remi @remi-php74
php-json.x86_64 7.4.8-2.el7.remi @remi-php74
php-mbstring.x86_64 7.4.8-2.el7.remi @remi-php74
php-mysqlnd.x86_64 7.4.8-2.el7.remi @remi-php74
php-pdo.x86_64 7.4.8-2.el7.remi @remi-php74
php-pecl-zip.x86_64 1.19.0-1.el7.remi.7.4 @remi-php74
php-sodium.x86_64 7.4.8-2.el7.remi @remi-php74
php-xml.x86_64 7.4.8-2.el7.remi @remi-php74
php74.x86_64 1.0-3.el7.remi @remi-safe
php74-php-cli.x86_64 7.4.8-2.el7.remi @remi-safe
php74-php-common.x86_64 7.4.8-2.el7.remi @remi-safe
php74-php-json.x86_64 7.4.8-2.el7.remi @remi-safe
php74-runtime.x86_64 1.0-3.el7.remi @remi-safe
If the same package as above is installed, the work of this article is completed.

Then make sure you zip.so is enabled

I've got the same problem and found following solution:

Search for installed php modules:
yum list installed | grep php*

Try to locate installed php-zip module:
rpm -ql php72-php-pecl-zip

You will see something like this:
/etc/opt/remi/php72/php.d/40-zip.ini
/opt/remi/php72/root/usr/lib64/php/modules/zip.so # <----
/opt/remi/php72/root/usr/share/doc/pecl/zip
Then just create symlink to this file in directory where php searches modules by default:
ln -s /opt/remi/php72/root/usr/lib64/php/modules/zip.so /usr/lib64/php/modules/zip.so

After this steps I finally saw zip extension in php -m output and now can use class ZipArchive.

Also you should probably restart your httpd service.

Leave a Reply

Your email address will not be published. Required fields are marked *