PHP Module not shown - php

I need php-cli module installed and working but when I run php -m this module is not listed although it's installed via yum. Both php-cli and php are listed and have the same version which are Version 5.4.16 release 36.3.el7_2. How can I make sure this module is correctly installed? phpinfo does not indicate the module is installed either.

Related

Ubuntu 18.04 using PHP version that is not installed as a module

Using the commmand php -v on a Ubuntu 18.04 server is displaying PHP version 8.1.14, but no PHP8.* module is installed.
I have tried running the command: sudo update-alternatives --config php which displays:
Available PHP versions
Disabling the PHP8.1 module will show me that the module is not installed:
module not installed
While php -v is really showing me PHP8.1:
PHP version
I have tried to purge the PHP 8 version with the following command:
sudo apt-get purge php8.*
It showed me 0 modules were marked for removal, just to be sure I also ran autoremove & autoclean commands.
When I display the PHP info, it also shows the 8.1 version:
PHP info
I need to get the server back to version 7.4 to make some installations function properly, I have tried all options above but did not succeed. How can I downgrade to PHP Version 7.4?
While I was installing the PHP Selector add-on for DirectAdmin, I noticed Zend modules were being installed for 7.4. Perhaps these were missing for the server to switch back to version 7.4. Problem solved!

The packages are installed with pecl but are not displayed in phpinfo()

I use centos and php 7.3.2 and Nginx web server
I have installed several packages using pecl. They are all installed successfully.
When I run command "pecl list" or "php -m", I see the name of the desired packages:
Package Version State
PDO_IBM 1.5.0 stable
apcu 5.1.21 stable
ibm_db2 2.1.5 stable
igbinary 3.2.7 stable
raphf 2.0.1 stable
I have also checked the php version related to CLI with phpinfo() function. Both of them are one.
I have also run the "pecl config-show" command. Its php path is correct
I have also checked the following values. CLI and phpinfo() are the same
PHP API 20180731
PHP Extension 20180731
Zend Extension 320180731
However, I cannot see the installed modules on the phpinfo() page. And their functions don't work either

PHP is not loaded as a module of Apache

I'm currently developing a web page with PHP, and I had to install Pthread extension, I made it in the server (Ubuntu 14) so, before I had all working well, the problem came when I installed the extension, to install this extension I had to compile the php to make the needed configurations of PHP. Now, when I open a simple page, apache shows me the php code, it means that php is not interpreting or is not loaded in the modules of apache.
I went to /etc/apache2/mods-enabled but there's nothing of PHP, but in the linux terminal PHP is working well (so, it's installed). then I made:
sudo a2enmod php5
And I get this response:
ERROR: Module php5 does not exist!
then , I made:
a2query -m php5
but I get:
No module matches php5
I have installed PHP 5.6version, so how can I enable this module in apache. I cannot install the standar version of PHP, I need this one for the mentioned reason. Thanks!
Apache needs a PHP module to execute PHP. In some distros (Debian, etc.) there is a specific package for this. In Ubuntu: libapache2-mod-php5
It does not impact the php installation install but only adds the apache module.
Once installed, one only need to activate the module.

Unable to initialize mongoDB module on MAMP

I've installed MongoDB using homebrew and also installed the php mongo driver and included it in the current php version of my MAMP package. But when I start MAMP this error is in my php error log:
PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
I tried to compile the driver again with the phpize which is inside the mamp folder but got the same results. I'm very new to mac and *nix environment in general, Is there something that I'm missing?
The PHP version installed by homebrew is 5.5.17 and PHP version in my MAMP Package is 5.5.14
If you're compiling the PHP driver, you must do so against the same PHP version that you intend to run it with. Based on the error you've shared, the driver was clearly compiled against a different PHP runtime.
Luke Peters has a blog post discussing how to compile the module for MAMP, and it entails setting your PATH environment variable to MAMP's bin/ directory before using PECL to build the module. This will ensure that the appropriate phpize binary gets used. To paraphrase his write-up for your environment (5.5.14):
$ export PATH=/Applications/MAMP/bin/php/php5.5.14/bin:$PATH`
$ cd /Applications/MAMP/bin/php/php5.5.14/bin
$ sudo pecl install mongo

Problems installing PHP's PECL sphinx module

I've installed the sphinx binaries and libraries and am now trying to install the PECL sphinx module.
My system is running OS X 10.6 with MAMP 1.8.2 installed. I try to install sphinx using the following command:
sudo pecl install sphinx
The PECL command outputs the following:
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
The versions above don't match the versions listed when doing a phpinfo(). It seems that PECL is trying to complie against the built-in version of PHP.
If I ignore the errors and continue the it will successfully compile and place the sphinx.so file in:
/usr/lib/php/extensions/no-debug-non-zts-20090626/sphinx.so
when in fact it should be:
/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/
I've tried copying the sphinx.so file to the MAMP extensions dir but when I restart apache PHP displays the following warning:
PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/sphinx.so
I think this is because MAMP is 32bit and the built-in PHP is 64bit so PECL complies for 64bit. I might be completely wrong but I did read this when I goggled on the topic.
Does anyone know how to get PECL to map to the MAMP version of PHP instead of the built-in version?
If the "correct" version of PHP is installed in something like /Applications/MAMP/bin/php5/, and has the development tools included, you should have some version of the pecl command to go with it, some next to that directory.
If so, running that pecl command that corresponds to your "correct" version of PHP should help : it'll run the correct version of phpize, and will allow the extension to be compiled against the (once again) correct version of PHP.
You just have to hope that MAMP includes those commands -- I cannot check, as I don't have a mac.

Categories