PHP Startup: Unable to load dynamic library php_sqlsrv_54_ts.dll - php

I'm hopelessly stuck on this: I'm trying to connect to MS SQL Server 2008 R2 with PHP, but I can't seem to get the configuration right.
Windows Server 2012 Standard
MS SQL Server 2008 R2
PHP:
Version: 5.4.31
Branch: HEAD
Build: C:\php-sdk\php54dev\vc9\x86\obj\Release_TS
All I need is to call a PHP script from command line and save result to database. But I get following error:
C:\ankety>php uctenka.php 1012814411
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php-5.4.31-ts\ext\php_sqlsrv_54 in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\php-5.4.31-ts\ext\php_sqlsrv_54_ts.dll in Unknown on line 0
PHP Fatal error: Call to undefined function sqlsrv_connect() in C:\ankety\zpracuj.php on line 157
Fatal error: Call to undefined function sqlsrv_connect() in C:\ankety\zpracuj.php on line 157
Now, of course there is correct version of php_sqlsrv_54_ts.dll in correct folder (C:\php-5.4.31-ts\ext\). In php.ini I changed:
extension_dir = "C:\php-5.4.31-ts\ext\"
extension=php_sqlsrv_54_ts.dll
When I run the script it also says that MSVCP100.dll is missing on a computer, but it is in fact there - in C:\Windows\System32 and I also tried C:\php-5.4.31-ts\ext\ but without luck.
In phpinfo() there isn't loaded sqlsrv part.
I don't know where I could possibly went wrong, I searched this problem but none of those solutions worked. Hope someone has an idea how to fix this.

For those, who don't want to waste time as myself - try restarting the IIS server :-)

Related

Using WAMP to connect to SQL Server

I've read a lot of posts here on this problem, but I think mine is a little different because the output I'm getting doesn't match what others have had.
I am running WampServer Version 3.1.4 64bit and trying to connect to a SQL Server DB and I get the following error:
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect()
using the following code:
$serverName = "xxx.xxx.xxx.xxx";
$connectionInfo = array("Database" => "db_name", "UID"=>"sa", "PWD"=>"db_pwd");
$conn = sqlsrv_connect($serverName, $connectionInfo);
I have tried the following:
I downloaded the sql drivers for PHP 7 and 7.1 and tried them with the corresponding PHP versions
I made sure to restart all services after updating the php.ini file.
With my version of WAMP the php.ini file in the Apache folder is just a shortcut to phpForApache.ini in the php7.1.22 folder and it updates automatically.
The extensions DO show up in the WAMP menu: PHP > PHP extensions
and they have the green check mark next to them
I consistently get the following in my php_error.log:
[27-Nov-2018 14:25:16 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php7.1.22/ext/php_sqlsrv_71_nts.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
[27-Nov-2018 14:25:16 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php7.1.22/ext/php_sqlsrv_71_ts.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
As stated, I've tried using the appropriate dlls for both php 7 and 7.1.22 and got the same output:
[27-Nov-2018 15:12:37 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php7.0.32/ext/php_sqlsrv_7_ts_x86.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
[27-Nov-2018 15:12:37 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php7.0.32/ext/php_sqlsrv_7_nts_x86.dll' - %1 is not a valid Win32 application.
I'm really not sure what other config I must be missing. I also tried the x64 versions, but I get an error stating the file could not be found, even though I triple checked the location.
Seeing as I get the same not a valid Win32 application error for both versions, I guess it's something outside of PHP

error while running mongodb php program

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212+lfs/mongo.so' - /usr/lib/php5/20121212+lfs/mongo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Class 'MongoClient' not found in /var/www/exhange/b1_functions.php on line 8
This is the error popped up when running a monogdb php program in ubuntu. How can I fix that?

HTTP Request 500 when I call mysqli_connect with PHP

I want to use a database to store user data. I am running an Apache server with PHP and MySQL installed. When I try mysqli_connect, there is a HTTP 500 error. This is my code:
$con = mysqli_connect("localhost","root","password","database");
mysqli_close($con);
I also checked the Apache log; here's what it said:
[Time] [error] [client localhost] PHP Fatal error: Call to undefined function mysqli_connect() in [Document Address] on line 78, referer: [URL]
and
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/php_mysqli.dll' - The specified module could not be found.\r\n in Unknown on line 0
Also, var_dump(function_exists('mysqli_connect')); outputs bool(false).
I've uncommented extension=php_mysqli.dll in php.ini, checked the ext directory and there is a php_mysqli.dll file in it, checked other StackOverflow (and other) questions like this, but none of this answered it for me.
test phpinfo () and make sure that the function is activated

PHP Warning: PHP Startup: Unable to load dynamic library php_pdo_mssql.dll

Yesterday I reinstalled my windows and after installed Apache and copied PHP from dir.
And now I can not get access to PDO MS SQL Server.
In my php.ini ; is absent:
extension=php_pdo.dll
extension=php_pdo_mssql.dll
and in D:\Program Files\PHP\ext dll files is exsist.
When I call PDO script from browser I have this error: could not find driver.
In Apache error.log:
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\\Program Files\\PHP\\ext\\php_mssql.dll' - \xcd\xe5 \xed\xe0\xe9\xe4\xe5\xed \xf3\xea\xe
0\xe7\xe0\xed\xed\xfb\xe9 \xec\xee\xe4\xf3\xeb\xfc.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\\Program Files\\PHP\\ext\\php_pdo_mssql.dll' - \xcd\xe5 \xed\xe0\xe9\xe4\xe5\xed \xf3\xe
a\xe0\xe7\xe0\xed\xed\xfb\xe9 \xec\xee\xe4\xf3\xeb\xfc.\r\n in Unknown on line 0
How can I fix this?
Thanks.

Linking Lame.h with PHP extension

I'm trying to develop my first php extension. It uses Lame , so I've installed liblame-dev
lame.h is located at /usr/include/lame/
In my config.m4
LIBNAME=lame
PHP_ADD_LIBRARY($LIBNAME)
It builds, but something goes wrong at apache startup
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525+lfs/myextension.so' - /usr/lib/php5/20100525+lfs/myextension.so:
undefined symbol: lame_init in Unknown on line 0
SOLUTION
correct rows config.m4 for me, are
PHP_SUBST(MYEXTENSION_SHARED_LIBADD)
PHP_ADD_LIBRARY(mp3lame, 1,MYEXTENSION_SHARED_LIBADD)

Categories