PHP extension dir on Ubuntu - php

I've just installed the imagick PHP extension following this script: https://gist.github.com/rostockahoi/1d53a2efb8863d72d5f1acb94ae940d1
The install went fine. I found the imagick.so file in /usr/lib/php/20180731 directory. And my php.ini files (fpm and cli) have the extension=imagick.so at the end.
I've restarted PHP and nginx.
Though, PHP cannot find the extension. Look at this CLI test :
$ php -i
$ PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/20170718/imagick.so (/usr/lib/php/20170718/imagick.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/imagick.so.so (/usr/lib/php/20170718/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP is looking for extensions in this directory /usr/lib/php/20170718/
This dir exists but the imagick.so is not in it.
On the other hand, as said before, there is also the directory /usr/lib/php/20180731/ with the imagick.so file in it.
I guess I have to tell PHP to look into the 20180731 dir instead of the 20170718.
How can I do that ?
Or should I copy manually the imagick.so file into 20170718 ? That does not seem optimal...
thanks !

Maybe you should try this php-config --extension-dir
If php-config doesn't exist, then apt-get install php-config
That command will give exact location of your php extension folder.
Don't forget to change your php.ini in order to use extensions.

I finally used another single command to install imagick and everything is fine.
sudo apt-get install php-imagick
The imagick.so has been installed in all /usr/lib/php/YYYYMMDD/ directories.
Much simpler !

Related

Installing librdkafka on Windows for PHP XAMPP

Please help me to install librdkafka on windows xampp for php development.
PHP : 7.1.12, x86, Thread Safe, MSVC14
I downloaded compatible package from https://pecl.php.net/package/rdkafka/3.0.5/windows
Copied php_rdkafka.dll to ext folder of my php xampp and librdkafka.dll to System32 folder (also to ext folder).
But the extension is not working. I am getting following error:
PHP Warning: PHP Startup: Unable to load dynamic library
'C:\xampp\php\ext\php_rdkafka.dll' - The specified module could not be
found. in Unknown on line 0
I suspect that librdkafka is not properly installed.
I managed to make it work by doing below steps.
Copy librdkafka.dll to C:\Windows\SysWOW64 if x86 otherwise copy to C:\Windows\System32. Don't copy to both folders.
Then run regsvr32 librdkafka.dll in command prompt.
Then copy php_rdkafka.dll to ext folder of your php.
Then add extension=php_rdkafka.dll to your php.ini file
Restart PHP, DONE!!!
The accepted answer did not work for me, instead I installed the dependency as following:
Download the library from https://pecl.php.net/package/rdkafka
Extract the file librdkafka.dll to the the root PHP directory (same level as php.exe for example C:\xampp\php).
Extract the file php_rdkfaka.dll to the ext folder: C:\xampp\php\ext
Add the line extension=php_rdkafka.dll to the php.ini.
Restart the server.
Note: within the library you will download, you will find a README.md with a link to the official documentation.

homebrew -- Image Magick throwing version error when executing Php

PHP execution is throwing a Warning about Imagick...
Output of php -v:
PHP Warning: Version warning: Imagick was compiled against Image Magick
version #### but version #### is loaded. Imagick will run but may behave
surprisingly in Unknown on line 0
You have certainly upgraded imagick after installing PHP, so you need to reinstall imagick using pecl.
Run the following:
sudo pecl uninstall imagick
sudo pecl install imagick
If you run php -v and see a warning saying that the module imagick was already loaded, check your ini file:
php -i | grep 'Configuration File'
Then open the file and remove duplicate entries of extension="imagick.so". You might need to look into the configuration path to check also other ini files.
php##-imagick needs to be rebottled
brew reinstall --build-bottle php56-imagick
OR
brew reinstall --build-bottle php71-imagick
make sure you use the reinstall command and the proper php## version
Reference to solution on github.com
If you want, you can make the correction by creating a file called ".user.ini" in the root directory of the domain or sub-domain in question and placing the following line inside it:
imagick.skip_version_check = true
The solution is:
Create a file called .user.ini
Type the following into the file.
imagick.skip_version_check=true
Save the file in the top-level folder for the site.

php_pgsql package extension is not loaded automatically from /etc/php.d/ directory

I have installed php_pgsql package using the command
yum install rh-php56-php-pgsql.x86_64
I am developing my project with
PHP 5.6.27
PostgreSQL 9.6.1
RedHat 7 OS
instalation was succesful..
Installed: rh-php56-php-pgsql.x86_64 0:5.6.5-9.el7
Dependency Installed: audit-libs-python.x86_64 0:2.6.5-3.el7
checkpolicy.x86_64 0:2.5-4.el7 libcgroup.x86_64 0:0.41-11.el7
libsemanage-python.x86_64 0:2.5-4.el7 policycoreutils-python.x86_64
0:2.5-8.el7 python-IPy.noarch 0:0.75-6.el7
rh-php56-php-common.x86_64 0:5.6.5-9.el7 rh-php56-php-pdo.x86_64
0:5.6.5-9.el7 rh-php56-php-pecl-jsonc.x86_64 0:1.3.6-3.el7
rh-php56-runtime.x86_64 0:2.0-6.el7 setools-libs.x86_64
0:3.3.8-1.1.el7
Complete!
I could find the pgsql.ini file in /etc/php.d/ directory.
still the php.info page is not showing the pgsql details.
please check my error_log file
PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php56/root/usr/lib64/php/modules/pgsql.so' - /opt/cpanel/ea-php56/root/usr/lib64/php/modules/pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
So my instalation was not added the pgsql.so file in the right place. I dont know how to sove this issue. please help, thanks in advance.
finally i solved the issue..
The package instalation was actually done to the DIR PATH
/usr/lib64/php/modules/pgsql.so
I ensured it with the command
rpm -ql php-pgsql
from the PHP config file i found the exact PHP Module path.
by moving the pgsql.so file into the location made the module enabled for PHP.

Can' get PHP SOAP enabled

I think I have installed SOAP using:
yum install php-soap
However, when I use the following command:
php -i | grep -i soap
I get this error message:
PHP Warning: PHP Start-up: Unable to load dynamic library
'/usr/local/lib/php/extensions/php_soap.dll' - /usr/local/lib/php/extensions/php_soap.dll: cannot open shared object file: No such file or directory in Unknown on line 0
When I try to install SOAP again, it says it's installed already. In my php.ini file I have uncommitted the line:
extension=php_soap.dll
What am I still missing?
Thanks!
EDIT
Found my .so file with: "find / -name soap.so" (at root)
Then placed that path in my php.ini file.
If you check this answer you might find your clue
how-to-enable-soap-on-centos
You should point to some soap.so library. DLLs are usually on windows. Check your libraries path /usr/local/lib/php/extensions and see if any soap.so library is to be found there

Trouble Enabling cURL on Ubuntu 11.10

I have installed curl:
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
and I have updated my php.ini file to include:
extension=php_curl.dll
I check to see if curl is working with the following command:
php -i | grep curl
and I receive the following message:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/php_curl.dll' - /usr/lib/php5/20090626+lfs/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
Additional .ini files parsed => /etc/php5/cli/conf.d/curl.ini,
curl
I also tested curl by creating a file called testCurl.php which contains the following:
<?php
echo ‘<pre>’;
var_dump(curl_version());
echo ‘</pre>’;
?>
When I navigate to localhost/testCurl.php I get an error: HTTP Error 500
Can anyone help me to get curl working?
You put the wrong info in your php.ini
extension=php_curl.dll
On Ubuntu/Unix that is
extension=php_curl.so
.so means Shared Object, that is a dynamic library the error messages speaks of. On Windows that is .dll, you probably just mixed that.
And it appears you try to load sqlite.so which does not exists. Normally you don't need to change your php.ini file when you install libraries on Ubuntu via apt, because the package scripts take care of that thanks to the work of the package maintainers.
If you'r using Ubuntu or have more than one php.ini you may face this problem of enabling extension=php_curl.dll.
It's curious but I was facing this problem using UBUNTU. For some reason it was calling a .dll file, but linux uses .so files.
First thing to do is echo phpinfo(); in a .php file to check what php.ini is getting loaded.
Configuration File (php.ini) Path /etc/php/7.1/apache2
Loaded Configuration File /etc/php/7.1/apache2/something/php.ini
So if you change only in one file it may not have the correct effect.
In my case whas in /etc/php/7.1/apache2/php.ini and CURL was calling this way:
;extension=curl.dll
Change to
extension=curl.so
Save and restart apache:
sudo systemctl restart apache2
Support for sqlite2 is removed from php5 I think, so sqlite.so is no longer available in the current version of the package. You can manually restore it from the natty packages (this worked for me):
Download the old package from here: http://packages.ubuntu.com/natty-updates/php5-sqlite
Extracts sqlite.so
Move sqlite.so (+pdo_sqlite.so) to /usr/lib/php5/20090626+lfs/
Change file permissions to root:root
(https://lists.ubuntu.com/archives/ubuntu-server-bugs/2011-October/065547.html)

Categories