I'm a moodle user and recently found out that everytime i try to download a ODS file (exporting grades) it says Exception - Class "ZipArchive" not found"
it turns out that my php (version 8.0) doesn't have the zip extension installed
i tried installing the zip extension on cyberpanel(my moodle is hosted on cyberpanel CentOS 7) but i don't seems to install, when i click to install i receive this message:
Loaded plugins: copr, fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: atl.mirrors.clouvider.net
* epel: mirrors.coreix.net
* extras: mirror.dal.nexril.net
* updates: atl.mirrors.clouvider.net
10 packages excluded due to repository priority protections
Package lsphp80-common-8.0.15-1.el7.x86_64 already installed and latest version
Nothing to do
PHP Extension Installed.
but then when i return to the extension page it says that the extension is not installed, and i still can't generate ODS files, i tried searching in about it and people said that i need to do it on terminal, i tried using cyberpanel terminal as root user with those commands:
yum install php-pear
yum install php-devel
pecl install zip
then i gone to the php.ini ( i tried open it on either cyberpanel interface and on terminal) and insert the code:
extension=zip.so;
before the "module settings" section on the file, and it still doesn't work(it sems that i have multiple versions of php installed on my cyberpanel, i tried editing php.ini on my php 8.0 directory and other versions avaliable)
its weird because on version 7.3 of php it install and work normally(it even install on the interface) and when i change the php version on my moodle to 7.3(i don't wanna use this version) it the error completely disappears, how can i solve it?
Related
My macbook with MacOS Ventura (13.2) just upgraded to PHP 8.2.2 trough Brew but now i'm having problems because php ext-oauth is not active.
When I run composer install in my (Symfony) project I get this message:
Problem 1
- Root composer.json requires PHP extension ext-oauth * but it is missing from your system. Install or enable PHP's oauth extension.
To enable extensions, verify that they are enabled in your .ini files:
- /usr/local/etc/php/8.2/php.ini
- /usr/local/etc/php/8.2/conf.d/ext-opcache.ini
You can also run php --ini` in a terminal to see which files are used by PHP in CLI mode.
I've googled and tried:
adding it to the current php.ini file
sudo pecl install oauth
(returns the message "pecl/oauth is already installed and is the same
as the released version 2.0.7")
I've even copied the previous oauth.so file to the current php directory.
php -m doesn't return the oauth extension in the list
Any ideas, how to fix this?
I've got running again by do these steps:
open terminal
sudo pecl uninstall oauth
sudo pecl install oauth
I'm attempting to upgrade a very old (version 5.0) Laravel application to the current version, and I'm getting an error when running composer install because I don't have box/spout. So I tried composer require box/spout, and got the following:
Package box/spout has requirements incompatible with your PHP version,
PHP extensions and Composer version:
- box/spout v3.3.0 requires ext-zip * but it is not present.
I'm working on RHEL server 7.9, with PHP 8.0.22 and composer 2.3.10. I ran:
sudo yum install php80-php-pecl-zip.x86_64
then created a zip.ini file in my /etc/php.d directory with "extension=zip.so" in it, and restarted apache, but I'm still getting the same error. Is pecl-zip the right package? I did try "sudo yum install php8.0-zip" but it told me there is n such package. How do I resolve this dependency?
I have found the problem and fixed it. By running
rpm ql php80-php-pecl-zip.x86_64
I discovered that yum installed the extension into the /opt/remi/php80/root/usr/lib64/php/modules directory, while PHP was loading from /usr/lib64/php/modules/. I copied over the zip.so file, and that fixed the problem.
I don't know, why do I always come up with weird errors here :D.
Recently I have been facing an error, most like related to PHP-bcmath extension for php7.
The extension is installed in the environment, yet it's not loaded onto the system.
This is confirmed by as when I try to install the extension, this message is shown:
Package php-bcmath-7.0.8-1.el6.remi.x86_64 already installed and latest version
Nothing to do
It's related to WordPress and I'm using amazon AMI Linux to host a WordPress environment.
This extension is required to use a plugin called Wp-Statistics, and I need PHP-bcmath to show the geo-location function.
I tried to install the same extension in another environment which was also a Wordpress site running on Debian, the extension was successfully loaded and the plugin was working well.
Now for this AMI Linux, Is there any way around to load the extension as it says that it's already installed ?
open /etc/apt/sources.list in editor
add:
deb http://ftp.us.debian.org/debian/debian/ sid main
deb-src http://ftp.us.debian.org/debian/debian/ sid main
run apt-get update
and run:
apt-get install php7.0-bcmath
I can't install any package related PHP, I get a yum error: No package php available.
My PHP version is 5.4.37 on Centos 7. I installed remi for other purposes and I think that the repository is not compatible with PHP version but I don't know how to fix it.
[root#server ~]# sudo yum install php php-pear
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centosmirror.netcup.net
* epel: mirrors.n-ix.net
* extras: centosmirror.netcup.net
* remi: mirror5.layerjet.com
* remi-safe: mirror5.layerjet.com
* updates: centosmirror.netcup.net
No package php available.
No package php-pear available.
Error: Nothing to do
You have, in yum configuration:
exclude=apache* httpd* mod_* mysql* MySQL* mariadb* da_* ftp exim* sendmail* php* bind-chroot*
This is very probably a "panel" enabled server (cpanel or others), which provides its own PHP stack.
So by design, you cannot install "php*" packages from standard repository or any other 3rd party repository. Such distribution is so altered, that it is often considered as "Not CentOS".
So, better to ask your php stack provider for how to update it (if possible, without breaking the panel application)
As suggested in other answer, this may be related to excludes set in yum.conf
The command below allows to run the installation of excluded packages without modifying the conf file:
yum --disableexcludes=main install php
BUT
It seems like it might be better to re-install PHP by the means of the control panel installed. IE Cpanel - EasyApache..
I have an unmanaged VPS server preinstalled with CentOs 6.6 and WHM/CPanel. I am trying to install php-ldap but it just says package not found. I have not been able to find anywhere what repository it should be in. How can I install ldap on my server to work with php 5.4? I am trying to manage Windows Server 2012 R2 Active Directory.
root#vps [~]# yum install php-ldap
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.5ninesolutions.com
* epel: fedora-epel.mirror.lstn.net
* extras: centos.arvixe.com
* updates: pubmirrors.dal.corespace.com
No package php-ldap available.
Error: Nothing to do
root#vps [~]#
On a cpanel serveur you probably have an "exclude" line in yum.conf (see I can't install any package related to PHP with yum) which prevent you to install/upgrade php from another repository.
To see the provider of "php", user this command
rpm -qf $(which php)
And the ldap extension, if available will be in the same namespace.
Notice switch the php stack from the cpanel provider to another repo can break it.
You need to understand that the base repos typically don't contain boutique builds for PHP. Your best bet is to install a different repo, like the Remi repo, which does contain that RPM.
While I'm at it, PHP 5.4 went End-of-life 4 days ago. Remi offers 5.5 and 5.6 so you should consider upgrading
Get the php version you are running by
php -v
if not worked try
rpm -qa |grep php
if the php version is 5.4 then use
sudo yum install php54w-ldap
if 5.6
sudo yum install php56w-ldap
and so on.