PHP Warning: PHP Startup: Unable to load dynamic library 'sqlsrv.so' - php

Hi i recently installed SQL Server on my machine. It has Ubuntu 16.04 LTS OS.
I followed this link to install server extensions for PHP 7.2 and now I'm getting these PHP warnings:
PHP Startup: Unable to load dynamic library 'pdo_sqlsrv.so'(tried: /usr/lib/php/20170718/pdo_sqlsrv.so (/usr/lib/php/20170718/pdo_sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlsrv.so.so (/usr/lib/php/20170718/pdo_sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Startup: Unable to load dynamic library 'sqlsrv.so' tried: /usr/lib/php/20170718/sqlsrv.so (/usr/lib/php/20170718/sqlsrv.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/sqlsrv.so.so (tried:/usr/lib/php/20170718/sqlsrv.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

I don't know if this will be useful for you wight now, but this was useful for me when I was trying to install sqlsrv dricer for php in my CentOS 8
sudo su
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
exit
sudo ACCEPT_EULA=Y yum install msodbcsql
sudo yum install unixODBC-devel
yum groupinstall "Development Tools"
sudo yum install php-pear
sudo yum install php-devel
#IF_ERROR:
sudo yum install dnf-plugins-core
sudo yum config-manager --set-enabled powertools
sudo yum install php-devel
#END_IF_ERROR
sudo pecl install sqlsrv pdo_sqlsrv
sudo echo "extension=/usr/lib64/php/modules/sqlsrv.so" >> /etc/php.d/pdo.ini
sudo echo "extension=/usr/lib64/php/modules/pdo_sqlsrv.so" >> /etc/php.d/pdo.ini
Following this steps I execute php -m and I haver sqlsrv and pdo_sqlsrv installed using php 7.2.

Related

Php Imagick error: undefined symbol FT_Done_MM_Var, how can i fix it?

Complete output:
Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /opt/lampp/lib/php/extensions/no-debug-non-zts-20190902/imagick.so (/lib64/libharfbuzz.so.0: undefined symbol: FT_Done_MM_Var), /opt/lampp/lib/php/extensions/no-debug-non-zts-20190902/imagick.so.so (/opt/lampp/lib/php/extensions/no-debug-non-zts-20190902/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
My OS: Fedora 36
Installed packages: ImageMagick ImageMagick-devel ImageMagick-perl php php-common php-pear php-devel gcc php-imagick.
Imagics.so installed via pecl in xampp
Ok, to install imagick on xampp on fedora you need to type the following commands:
sudo dnf install ImageMagick ImageMagick-devel ImageMagick-libs ImageMagick-perl
sudo dnf install php-pecl-imagick php-pecl-imagick-devel
sudo /opt/lampp/bin/pecl install imagick
It is important to install ImageMagick instead of ImageMagick7 and install php-pecl-imagick and not php-pecl-imagick-im6 or im7.

GRPC php extension Ubuntu 20.04 + Plesk

I installed grpc for a project using Ubuntu 20.04 with PLESK and SSH.
Installation is successful, before I run following commands:
apt-get -y install gcc make autoconf libc-dev pkg-config
apt-get -y install libgpgme11-dev apt-get -y install php-pear
apt-get -y install php-dev
cd /opt/plesk/php/8.0/bin
pecl install grpc
After installation the grpc.so file was stored under: /usr/lib/php/20190902/grpc.so
I manually copied it from there to the php plesk path:
cp /usr/lib/php/20190902/grpc.so /opt/plesk/php/8.0/lib/php/modules/grpc.so
Reread the php binaries
plesk bin php_handler --reread
Reboot the server (to make sure everything is restarted).
Under /opt/plesk/php/8.0/etc/php.d/grpc.ini the content is: extension=grpc.so
Then the extension is shown in plesk if I click on the php Version. I can activate the extension and deactivate it.
That comments in or out in the /opt/plesk/php/8.0/etc/php.d/grpc.ini
But in my php-code it is not working:
"Uncaught Google\Cloud\Core\Exception\GoogleException: The requested client requires the gRPC extension"
If I run:
/opt/plesk/php/8.0/bin/php -m | grep grpc
The output is:
PHP Warning: PHP Startup: grpc: Unable to initialize module
Module compiled with module API=20200930
PHP compiled with module API=20190902
These options need to match
In Windows with the precompiled .dll and XAMPP the code works fine.
phpinfo shows:
Additional .ini files parsed ---- /opt/plesk/php/8.0/etc/php.d/grpc.ini
But there is no extra section created and the extension is not loaded..

pdo_mysql installation on debian 10: undefined symbol: mysqlnd_allocator

I ran into some problems while installing pdo_mysql. I used the following commands to install php (and the pdo_mysql extension) on my system:
sudo apt -y install php php-common
sudo apt -y install php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
After the install I edited the php.ini located in /etc/php/7.3/php-cli and uncommented extension=pdo_mysql.
I already tried reinstalling php completely but that didn't seem to solve my problem because when I execute any php command, I get the following warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20180731/pdo_mysql (/usr/lib/php/20180731/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/pdo_mysql.so (/usr/lib/php/20180731/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0

Failed to get Imagick load for php7.4

I know there has been a lot of question asked regarding installing imagick to Php7+, unfortunately all the answer doesn't solve my issue.
I just update to php7.4, so I follow the previous setting from 7.3, 7.2 to enabled imagick,
basically:
echo extension=imagick.so > /etc/php/7.4/mods-available/imagick.ini
then soft link to "fpm" and "cli" directory:
ln -s /etc/php/7.4/mods-available/imagick.ini /etc/php/7.4/fpm/conf.d/20-imagick.ini
ln -s /etc/php/7.4/mods-available/imagick.ini /etc/php/7.4/cli/conf.d/20-imagick.ini
reloaded the php7.4-fpm, but imagick still failed to load
verify with php -i | grep imagick but got an error of:
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/20190902/imagick.so (/usr/lib/php/20190902/imagick.so: cannot open shared object file: No such file or directory), /us
r/lib/php/20190902/imagick.so.so (/usr/lib/php/20190902/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Note:
- I have tried to purge php-imagick and reinstall it, but doesn't work.
I solved it on my raspi this way (based on the instructions here: How to Install PHP imagick extension):
sudo apt install php7.4-dev (if not already installed)
check your pecl Version (must match with 7.4): pecl version
make sure that sed is executable from /bin/sed (the pecl install needs it to be there, I had to symlink it from /usr/bin/sed)
sudo apt install libmagickwand-dev
sudo pecl install imagick
Then you can carry on with the steps you already made:
sudo echo extension=imagick.so > /etc/php/7.4/mods-available/imagick.ini
sudo ln -s /etc/php/7.4/mods-available/imagick.ini /etc/php/7.4/fpm/conf.d/20-imagick.ini
sudo ln -s /etc/php/7.4/mods-available/imagick.ini /etc/php/7.4/cli/conf.d/20-imagick.ini
After that, restart your services (php7.4-fpm, apache, nginx, ...).
Hope this helps!
Also got this error and took a solid 2 hours to solve:
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/20190902/imagick.so (/usr/lib/php/20190902/imagick.so: cannot open shared object file: No such file or directory), /phpusr/lib/php/20190902/imagick.so.so (/usr/lib/php/20190902/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Even though php -i showed that my configured php version was 7.4 and that imagick extension was installed, I could not get rid of this warning.
So after running alot of commands and reading on the net, I figured the most obvious thing to do is check the given directory /usr/lib/php/20190902/. So annoyingly even after installing imagick with
sudo apt install php-imagick
it was not installed in that directory, but was for php8.0. This command
apt search imagick
had already showed this,
php7.4-imagick/focal,now 3.5.1-1+ubuntu20.04.1+deb.sury.org+1 amd64
Provides a wrapper to the ImageMagick library
php8.0-imagick/focal,now 3.5.1-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,automatic]
Provides a wrapper to the ImageMagick library
but I did not grasp [installed] being missing.
Solution in the end was to install my configured php version specific imagick with
sudo apt install php7.4-imagick
I checked if installed with php -m | grep imagick and double checked with ll /usr/lib/php/20190902 and ran command sudo systemctl restart apache2 before all was well again.
To install Imagick run bellow command:
sudo apt-get install php-imagick
For specific PHP version (in my case 7.1):
sudo apt-get install php7.1-imagick
Then restart apache:
sudo service apache2 restart
To check if the extension has been installed:
php -m | grep imagick

How to install php yaml on CentOs?

On the start I was getting this error:
Call to undefined function yaml_parse_file()
I have tried everything what I have found over google:
yum install libyaml
yum install yaml
yum install perl-yaml
and etc.
Now I'm getting:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/extensions/no-debug-non-zts-20100525/yaml.so' - /usr/lib64/extensions/no-debug-non-zts-20100525/yaml.so: cannot open shared object file: No such file or directory in Unknown on line 0
Exception: Extension yaml does not exist
Already added
extension=yaml.so
in php.ini file
Details:
CentOS release 6.7 (Final)
PHP 5.4.45
SS after I ran upper install commands:
What is the proper way to install yaml support in php?
php-yaml from epel repository:
php-pecl-yaml-1.1.1-5.el6.x86_64 : Support for YAML 1.1 serialization
using the LibYAML library
Repo : epel
Matched from:
Other: php-yaml
For repo: sudo yum install epel-release
For package: sudo yum install php-yaml
And remember to restart httpd

Categories