Link to home
Start Free TrialLog in
Avatar of itwarlord
itwarlord

asked on

Basic PHP and sqlsrv question

Experts,
My recent task was to stand up a PHP Server with MySQL for a Word Press Site.  Interesting as I have never done it before.
I followed instructions and was able to get MySQL installed with a username and password that worked.
I was able to install PHP 7.4.1 and can get to phpinfo.php.

I was trying to add the SQLSRV extension. (and also pdo_sqlsrv).

I am unable to find out how to run commands like get-extensions.  I found the powershell.

Server 2008 running IIS7.
Extension directory is c:\php

any help appreaciated.  I am waiting for the developer to wake up in mountain time.

Thanks
bob
Avatar of ste5an
ste5an
Flag of Germany image

hmm, SQLSRV is Microsoft SQL Server, not MySQL.. sure you're on the right track?
for MySQL, you most likely need to enable these in the extension:

extension=mysqli
extension=pdo_mysql

Open in new window

Avatar of itwarlord
itwarlord

ASKER

yes, mysql runs wordpress.  the website needs to talk to a sqlsrv.  so the sqlsrv extension is provided along with great detail.
Ryan,
Those are both listed under the extension list.

I am trying to enable the sqlsrv extension.  I will try putting it in that spot.
I am trying to enable the sqlsrv extension.  I will try putting it in that spot.

you will probably need to manually adding these extensions in the php.ini file, such as.

extension=php_sqlsrv_72_nts_x64.dll
extension=php_pdo_sqlsrv_72_nts_x64.dll

you can follow this article for the configuration (in Windows environment)

Microsoft Drivers for PHP for SQL Server
https://docs.microsoft.com/en-us/sql/connect/php/microsoft-php-driver-for-sql-server?view=sql-server-ver15
Ryan,
I have followed that article.  I found the ext directory was in program files (86), not c:\php.
I have moved all of the drivers downloaded including the two you have shown, into the ext directory under (86)
I have added the lines to the php.ini file located in programs (86).  I added it in the section titled [ExtensionList]

I used the ts version, not the nts.
I tried 64 and 86.


I think it is setup properly, but there is nothing displayed in phpinfo..

Thanks.
I have moved all of the drivers downloaded including the two you have shown, into the ext directory under (86)

that's fine.

I think it is setup properly, but there is nothing displayed in phpinfo..

are you using Apache HTTP Server or IIS as the web server? did you restart the service before you re-querying phpinfo() ?
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Got it working.

I think it had to do with the version numer of the PHP SQL driver.  or the annotation in the php.ini file.

I appreciate you help and have awarded you the win