After following the install instructions for oracle instant client, php is not able to load the oci8 extension.
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html#ic_x64_inst
I am getting an error.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/oci8.so' - libmql1.so: cannot open shared object file: No such file or directory in Unknown on line 0
I have verified both oci8.so and libmql1.so locations.
Am I missing something?
I'm using Ubuntu 16.04 and php version 7.1
There are few directories in /usr/lib/php/
for example
20131226 for php5.6
20160303 for php7.1
so problem with me that, the oci8 extension got installed on the wrong ( a user lib folder for php7.2) so I had to remove the php 7.2 completly
sudo apt-get purge php7.2-common
then I had uninstall the oci8 by running following command
sudo pecl uninstall oci8
and install again by running the following command
sudo pecl install oci8
To check the configuration loaded you do
php-config --extension-dir
And make sure that all extension are installed in the correct extension directory.
Make changes in the /etc/php/7.1/apache2/php.ini and /etc/php/7.1/cli/php.ini
Check by running phpinfo(); You must see this, ignore the cli if that stills gives you same error as your web shows the extension is getting loaded.
I solved adding the following to /etc/environment:
LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH
I followed this tutorial: https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703
What I did was completely remove any installations of PHP and reinstall the version that I need.
sudo apt-get purge 'php*'
Source: https://askubuntu.com/a/59889/226518
Or:
export LD_LIBRARY_PATH=/usr/local/instantclient_12_1/
I had the same problem, it works for me.
After wasting entire day for this small problem finally I came with this solution.
Sorry guys I am not champion is PHP but somehow I manage.
In my system I have CentOS 7 and PHP 7.4.XX.
I changed my LD_LIBRARY_PATH,
I have restarted my httpd service and checked phpinfo in browser (http://localhost/info.php),
Last I restared php-fpm service ........... and it's work for me.
Thanking you,
Anand
Related
Can anyone help me install php-redis in MAC OSX .
brew install php-redis
not working.
pecl install php-redis
also not working getting -
invalid package name/package file "php-redis".
Homebrew Error:
homebrew_error
git clone https://www.github.com/phpredis/phpredis.git
cd phpredis
phpize && ./configure && make && sudo make install
Add extension=redis.so in your php.ini
brew services restart php#7.2
make test
You can check working or not
php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"
As of 2019, with homebrew php7.2 and up, pecl is now installed by default alongside the php binaries.
To see this for yourself type which pecl.
Steps to install
Check your version of redis, then find a suitable version of the extension here.
If unfamiliar with pecl, type pecl to see the options.
Issue pecl install redis-5.0.2. (or your version). Enter no to each question asked if you're not sure.
If that succeeds check the new file it created at: /usr/local/lib/php/pecl/20180731/redis.so
The install will have added extension="redis.so" to top of your php ini.
Check that by opening the file /usr/local/etc/php/7.3/php.ini.
(assuming you're on 7.3 there)
brew services restart php.
php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
This is what I just did in September 2019 and it works for me.
If what mwal wrote above doesn't work (please try his/her answer first),
first, try to uninstall first (if you have it but broken):
sudo pecl uninstall redis
and after that run:
sudo pecl install redis
After that, ini the php.ini, use full path for the extension.
Mine was /usr/local/Cellar/php#7.3/7.3.21/pecl/20180731/redis.so (assuming you are using php#7.3)
so at the top of my php.ini file is like this:
extension="/usr/local/Cellar/php#7.3/7.3.21/pecl/20180731/redis.so"
Here are steps to use pickle, for PHP >= 7.3 (tested with 8.1):
brew install pickle
pickle install redis
Find your php.ini location via php -i|grep php.ini
Edit the php.ini, insert extension=redis. Preferable at Dynamic Extensions section.
No restart of Apache httpd service is required. You may test your PHP code with Redis
Bonus
If you use VS Code, to enable intellisense / auto complete, at Preference -> paste intelephense.stubs at Search setting box -> Add Item -> select redis.
If you got the following error,
Please make sure the PHP Redis extension is installed and enabled
despite doing everything in the verified answer above, try valet restart . It worked for me
I have tried all these solutions but didn't work for me for a while so I tried this link https://developer.redis.com/develop/php/ from the original docs and it works as charm
If someone gets an error during sudo pecl install redis
Warning: mkdir(): File exists in System.php on line 294
PHP Warning: mkdir(): File exists in /opt/homebrew/Cellar/-----/pear/System.php on line 294
that means you need to create the broken directory manually.
Try to create the directory...
pecl config-get ext_dir | pbcopy
mkdir -p {paste clipboard value}
# in my case, it was
mkdir -p /opt/homebrew/lib/php/pecl/20200930
Now try to install any pecl extensions.
sudo pecl install redis
After installing any extension, restart php
brew services restart php
Happy coding :)
After following the install instructions for oracle instant client, php is not able to load the oci8 extension.
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html#ic_x64_inst
I am getting an error.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/oci8.so' - libmql1.so: cannot open shared object file: No such file or directory in Unknown on line 0
I have verified both oci8.so and libmql1.so locations.
Am I missing something?
I'm using Ubuntu 16.04 and php version 7.1
There are few directories in /usr/lib/php/
for example
20131226 for php5.6
20160303 for php7.1
so problem with me that, the oci8 extension got installed on the wrong ( a user lib folder for php7.2) so I had to remove the php 7.2 completly
sudo apt-get purge php7.2-common
then I had uninstall the oci8 by running following command
sudo pecl uninstall oci8
and install again by running the following command
sudo pecl install oci8
To check the configuration loaded you do
php-config --extension-dir
And make sure that all extension are installed in the correct extension directory.
Make changes in the /etc/php/7.1/apache2/php.ini and /etc/php/7.1/cli/php.ini
Check by running phpinfo(); You must see this, ignore the cli if that stills gives you same error as your web shows the extension is getting loaded.
I solved adding the following to /etc/environment:
LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH
I followed this tutorial: https://gist.github.com/hewerthomn/81eea2935051eb2500941a9309bca703
What I did was completely remove any installations of PHP and reinstall the version that I need.
sudo apt-get purge 'php*'
Source: https://askubuntu.com/a/59889/226518
Or:
export LD_LIBRARY_PATH=/usr/local/instantclient_12_1/
I had the same problem, it works for me.
After wasting entire day for this small problem finally I came with this solution.
Sorry guys I am not champion is PHP but somehow I manage.
In my system I have CentOS 7 and PHP 7.4.XX.
I changed my LD_LIBRARY_PATH,
I have restarted my httpd service and checked phpinfo in browser (http://localhost/info.php),
Last I restared php-fpm service ........... and it's work for me.
Thanking you,
Anand
I'm trying to install PHP 5.5.21 on CentOS 7.0.
When I execute php -v
I get about 10 modules errors like this one:
PHP Warning: PHP Startup: curl: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
I tryed to install or update package with pecl install curl and pecl upgrade curl
But pecl always responds :
No releases available for package "pecl.php.net/curl"
And yum install php-curl says:
Package php-common-5.4.16-23.el7_0.3.x86_64 already installed and latest version
Nothing to do
How can I do to fix modules error?
Try running: find / -name curl.so
Then copy the directory it finds curl.so in and create a symbolic link to it where the rest of your working .so files are stored:
cd <where your working .so files are>
ln -s <where curl.so is> curl.so
Then edit your php.ini file and enable the extension:
extension=curl.so
Restart apache:
service httpd restart
service apache2 restart `#If the service is named apache2 rather than httpd`
This resolved my problem when I had a similar issue.
I finally solved my problem removing the custom PHP installation and using this tutorial to install PHP 5.5
I am trying to install MongoDB with PHP5.2 on CentOS. When I run phpinfo() it says Mongo is not installed. I believe the PHP is working fine. I installed MongoDB, and I can enter the shell. I did pecl install Mongo, says it was completed and installed properly. I add a mongo.ini file which is extension=mongo.so. I can go to /usr/lib64/php/modules/ and mongo.so is there. Is there anything I am forgetting? I have restarted both HTTPD and Mongod services.
The only thing I did for mongo driver 1.2.9 to work with php was
$ cd mongodb-php-driver-folder
$ phpize
$ ./configure
$ sudo make install
At the end of php.ini, add
extension=mongo.so
Restart apache.
If something like an undefined symbol is showing up, it means that the source didn't compile properly. However, "Z_DEFLREF_P" is not part of the Mongo PHP Driver source code (in the latest version). Are you sure the error doesn't mention "Z_DELREF_P"?
Right now, that is indeed a bug in the 1.2.9 version of the driver. It doesn't compile with PHP 5.2 right now. I've added a ticket at https://jira.mongodb.org/browse/PHP-335
Use the 1.2.7 mongo driver for php and you shouldn't have an issue compiling.
I had PHP 5.2 with MongoDB installed on Debian Lenny x64 and everything was fine.
After updating PHP to 5.3 (dotdeb) I can't get MongoDB to work, I always get an error
Fatal error: Class 'Mongo' not found (...)
Everything else works fine, all default modules are working.
My php.ini:
extension_dir = "/usr/lib/php5/20090626"
extension=mongo.so
Mongo.so is in same location as written above.
But when I run php -m in console to check loaded modules, "mongo" isn't listed there.
I can't use dl('mongo.so') to load module at runtime, because this function was deprecated in PHP 5.3.
May be I should recompile mongo somehow, I just don't know how to do that because I'm not very good in *nix commands.
Thanks for your help!
UPDATE
Also may be it's worth saying that before my mongo.so was in /usr/lib/php5/20060613 and I manually copied it to "/usr/lib/php5/20090626" because it seems that after updating my PHP all modules are located there.
The extension module api has changed between php5.2 and php5.3. When php tries to load an extension module both sides have to "present" an api magic key that identifies the api version. If those numbers don't match the module is not loaded/activated.
Try sudo pecl install mongo again to get an extension module that fits your new php version.
Try re installing mongo & restart service
sudo pecl uninstall mongo
sudo pecl install mongo
sudo service apache2 restart
This will install mongo in to newer version
I spent a little time trying to fix this, I am guessing you had a previous mongo install. The way I fixed it was by:
I installed php5-dev:
sudo apt-get install php5-dev
cd /etc/php5/apache2/conf.d/
sudo rm -rf mongo.ini
I then viewed my php.ini and removed extension=mongo.so
Then:
sudo pecl uninstall mongo
sudo pecl install mongo
sudo service apache2 restart