PHP SQL server extensions broken - php

I'm trying to get PHP talking to MS SQL server by following this guide, which is for SQL server 2005 (I'm using 2014 express but it was the most recent I could find).
I'm running 32bit Wamp and PHP 5.5.12. I have installed php_sqlsrv_55_ts.dll and php_sqlsrv_55_ts.dll in the ext folder and have added the following lines to php.ini:
extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll
All seems to go smoothly but no SQLSRV information is listed under phpinfo() and on the php extensions tab for Wamp they are listed but with a red triangle containing an exclamation mark next to them.
Anyone know what I've missed?

If you just type php at the command line it waits for more input, it does not hang.
If when you run php from the command line ( PHP CLI ) you see sqlsrv is supported but not when you run phpinfo through Apache, then you have edited the wrong php.ini file. There are normally 2, one to control PHP CLI and one to control PHP when being run under Apache.
The php.ini that controls php under apache is normally in the \apache\bin folder. The exact path is of course dependant upon whether you use WAMPServer/XAMPP... or install everything yourself.

Related

How to install PHP 7 extension "memcache" on Windows

I'm having huge problems installing memcached extension for php.
Currently using:
OS: Windows 10 x64
PHP: 7.0.1 via XAMPP
Apache: 2.4.18 (Win32)
I have successfully installed memcached in C:/memcached the service is running.
But the problem starts when trying to add the memcache php extension. I've tried numerous versions of php_memcache.dll and non seem to be working. I did include the extension in php.ini extension=php_memcache.dll
When i run php -m memcache is not listed and at the top i recieve the error:
PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_memcache.dll' - The specified module could not be found.
And when I try running a test.php for memcache initialization i recive the Class not found exception
This is a huge problem, because I need it for running selenium tests.
The memcached service doesn't actually install the PHP memcached extension for you. It only installs the memcached server used to store your cache.
You'll need to download the Windows DLL from the PECL repository first (click on the blue Windows DLL link). Then you must add the extension=php_memcache.dll line to the correct php.ini file for your SAPI. Also, note the extension DLL file needs to be placed in the correct path for your XAMPP installation.
For Apache, simply create a script in your document root with the line <?php phpinfo(); and try loading that in your web browser. You should see a line at the top labeled Loaded configuration (php.ini) which gives you the full path to your loaded php.ini file. On Windows the path may actually appear different than what is stated in phpinfo() if you installed PHP through something like XAMPP. So you may need to rely on XAMPP to locate the correct php.ini file.
For the CLI SAPI, you can use php.exe --ini to do the same. Again, you may need to rely on the XAMPP package if it has modified your configuration path (since this is a compile time directive).
After making your changes to php.ini you will need to restart PHP for the changes to take effect.
Since you're using PHP 7 on Windows it's probably also important to note that the compiled DLL from PECL may not actually work under apache for Windows, because you're more than likely using a theaded SAPI. So make sure you are downloading the correct version. As far as I can tell that version is only compiled to work with up to PHP 5.6. The github alternative, for PHP 7, available at https://github.com/nono303/PHP7-memcahe-dll as mentioned in the comments is tested under non-thread safe. So you may only be able to get this working for your CLI scripts on Windows.

Fatal error: Call to undefined function sqlsrv_connect() using wamp php 5.5.12

I am trying to connect to a Azure data base. I have read many other stack overflow answers but they did not work for me:
-I have downloaded all the drivers that Azure offers to you. They are in
C:\wamp\bin\php\php5.5.12\ext folder:
-I have added to the system variable the path to extensions folder.
-I have set the extension in both php.ini files (inside the apache and php folders).
-Extensions have been set like
extension=php_sqlsrv_5X_ts.dll
extension=php_pdo_sqlsrv_5X_ts.dll and like extension=C:/wamp/bin/php/php5.5.12/ext/php_sqlsrv_5X_ts.dll extension=C:/wamp/bin/php/php5.5.12/ext/php_pdo_5X_ts.dll
Where X means that I have tried 53, 54, 55 and 56.
-I restart all wamp services every single time that I try new changes.
-I have even tried with IISExpress.
-It is still giving me this error and I can't see "sqlsvr" when I use phpinfo().
what more I should do? I have been suffering this for weeks.
I use this XAMPP with PHP 5.5.34 at https://www.apachefriends.org/download.html to have the test to enable the sqlsrv extension of PHP.
You can refer my steps:
After install the XAMPP application, run xampp-control.exe, click config=>PHP(php.ini) to check the extension folder.
Download the MSSQL driver for PHP in 3.2 version from https://msdn.microsoft.com/en-us/library/cc296170%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396. Uncompress it.
Copy php_pdo_sqlsrv_55_ts.dll and php_sqlsrv_55_ts.dll from the uncompressed driver folder to the PHP extension folder (X:\xampp\php\ext in my scenario).
Add extension=php_pdo_sqlsrv_55_ts.dll and extension=php_sqlsrv_55_ts.dll in PHP.ini file.
Start Apache.
Meanwhile, you can use phpinfo() to check the setting of Loaded Configuration File and extension_dir to make sure whether you have configured the correct settings in the definite files and the DLL files in the right folder.
I refer to the practice of Jordi's message in this post: Fatal error:
Call to undefined function sqlsrv_connect() in C:\xampp\htdocs
xampp3.2.1 + php 5.5 + sql server 2014 Express, x64.
My situation is, transplant xampp folder to a brand new computer.
Done all things need to do. (Download SQLSRV 5.6 (or 5.3 or..), check php.ini path, ...)
Download and install OBDC Driver 13(x64) (or maybe you can try OBDC Driver 11(x64))
Download and install SQL ServerĀ® 2014 Service Pack 3 (x64), need to restart the computer.
Download and install Visual C++ Redistributable VS2012 Update4 (x86)
Restart Apache
Then it can work!!!!!
I have been searching for a solution to this problem for several days and hope to help more people.

PHP extensions on MAMP 3.5

I have installed MAMP 3.5 with Apache 2.4.16 on Yosemite 10.10.5 and have run into some obstacles that I find hard to solve.
The first issue was that virtual host settings have changed in Apache but that I managed to fix.
The remaining problem is with extensions. I use gettext in an application and it can not be found.
php -v says PHP 5.6.10 (cli)
phpinfo() says PHP 5.5.27
php --ini says /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
The php.ini path seems to be correct although phpinfo() says that extension_dir is /usr/lib/php/extensions/no-debug-non-zts-20121212
This seems very strange to me? The gettext extension is not in this directory but is found along with all other relevant extensions in the directory listed in the php.ini file for PHP 5.6.10 which is the one that should be used...
Any ideas what has gone wrong and how I can make PHP use the correct ini file?
CLI uses the installed version of OSX, MAMP uses it's own version.
The easiest way to use same version for both is to add the MAMP version first in your path in ~/.bash_profile.
export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php7.0.0/bin/:~/bin:$JAVA_HOME/bin:$PATH
of course you need to replace the php7.0.0 part with the version you want to use.
Quit your terminal app and reopen it, and try php -v again.

Cannot install Microsoft SQL driver for PHP 5.6 on Windows

I have been trying all day long and nothing. No sqlsrv extension, no logs, nothing. The sqlsrv_connect() function is not defined and I don't see the extension in phpinfo(). I tried WAMP at first. It didn't work. Now I am doing it bit by bit.
I have Windows 10
I installed SQL Express 2005 (is what I need for RMS).
I installed Apache 2.4.16 (x86) in C:\Apache\apache24 from here
I installed PHP 5.6.12 TS (x86) in C:\PHP\php5_6_12 from here
Configured Apache to load php5apache2_4.dll (and changed several other settings so it can run PHP files)
I downloaded Microsoft Drivers for PHP for SQL Server (file SQLSRV32.EXE) from here
I extracted php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll to the ext folder of PHP
Set up extension_dir like extension_dir = "ext"
Added the extensions to php.ini
I start Apache (httpd.exe), see no errors (neither inside the error.log file)
Now, when I open the file that outputs phpinfo() I don't see the extension anywhere. The sqlsrv_connect() is undefined.
I don't see where the PHP related errors are saved (maybe is not configured yet) and I am just stuck after trying thousands of solutions. Can't believe how hard is this in our century. PHP is really old but I really need to have this working.
print phpinfo() and and find sqlsrv. if you'r not able to find in phpinfo()
then, go to wamp and enable the extension my be you have not enable the extension , same issue happens with me so.. pls check
if you are using wamp with 64bit than you need to use unofficial Microsoft SQL Server Driver for PHP (sqlsrv)

MySQL refuses to work with Apache 2.2 and PHP 5.2 on Windows 7 or Win2k3

MySQL refuses to work with Apache 2.2 and PHP 5.2.
I have been working with a friend who is trying to get this to work on Windows 7 64bit and I have been trying on Windows 2003 Server and we both have the same problem - MySQL will not be recognized. From the command line MySQL works fine, but PHP and/or Apache will not load the MySQL modules.
phpinfo() does not show it is installed. Apache and PHP work fine.
Anyone have any ideas? Be aware that I have already been on at least 100 sites and have read 100's of articles on how to fix this. So I am looking for concrete info on this, not speculation.
No insults to anyone intended, but after 3 days and long distance calls to California from Ontario, I need results before I go broke and go insane.
Look for php\ext\php_mysqli.dll on your filesystem (this is the path in the xampp install). It's only PHP that needs this module, Apache only needs to execute PHP. So check you have
extension=php_mysql_libmysql.dll
in php\php.ini. along with a config section for MySQL
[MySQLi]
mysqli.allow_local_infile = On
mysqli.allow_persistent = Off
mysqli.cache_size = 2000
mysqli.max_persistent = -1
mysqli.max_links = -1
mysqli.default_port = 3306
...
What errors do you get trying to use the mysqli_query() etc functions?
If you really can't get it working, the excellend xampp will install a full *AMP stack on your OS of choice with very little hassle.
edit: #Beauford if the function's undefined then the library is not loaded. Follow above instructions for MySQLi, if in this still doesn't work package installation steps are here along with a perhaps relevant Win7 troubleshooting guide in the comments (copied verbatim):
to enable the mysql_... and mysqli_...
functionality, i opened the php.ini
file to uncomment the following lines:
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_pdo_mysql.dll
but phpinfo() still stated that no
mysql extensions were loaded. i tried
the fixes and suggestions above with
no success. so i invoked the windows
shell and typed ("Path" environment
variable set to the PHP & MySQL
directories): php.exe -m
this returned the following error:
PHP Startup: Unable to load dynamic
library 'C:\php5\php_mysql.dll' -
Module not found.
this told me that PHP didn't recognize
what i thought was the extensions
directory. it searched all other
places first (sys-dir, workin'-dir,
the MySQL "bin" dir because of the
"Path" variable set, and even a
curious directory "C:\php5" that
doesn't even exist on my mashine) but
not the expected "ext" directory.
so the fix was to go to "php.ini"
again and uncomment the following
line:
;extension_dir="ext"

Categories