PHP And SQL for Windows 10 x64
My Platform for setup is
- PHP 5.6.17 64 bit
- SQL Server 2016 64 bit
- Apache 2.4.17 64 bit
- The Editor - Sublime 2
I am using Wamp Server 3.0 64 bit mainly because my copy of SQL is 64 bit and i want some conformity as the drivers need to match SQL server to PHP
Tricks to get PHP to talk to SQL
Get Drivers from http://robsphp.blogspot.com.au/2012/06/unofficial-microsoft-sql-server-driver.html
- If you need 64 bit use drivers from x64 folder
- If your PHP server is a Thread Safe version use the thread safe dll (if it doesn't load try the non threadsafe dll )
- Make sure the drivers are copied into the ext directory listed in my.ini
- Add the Drivers to the Extension part of the ini file , ie Extension = driver name
- Restart PHP to load the drivers
if your unsure if your php server is thread safe or not run the code below in getconfig.php
<?php
phpinfo();
?>
save this to getconfig.php and open your browser and browse to ( in my case localhost) localhost\getconfig.php
you should see as below if its thread safe or not.
Also if you have loaded the Sql Drivers correctly ( php_pdo_sqlsrv & php_sqlsvr) - version and thread type not specified you should see this if its loaded correctly.
Once you have confirmed that the drivers are installed , make sure your SQL server has SQL Server and Windows Authentication Enabled , not just Windows Authentication Enabled. Once that is confirmed ( if you have to change it , the sql server need to be re started.) Add a user if you don't have one that's got Sql Server Authentication instead and give it the access it needs ( user rights , access to the db your going to use).
On Windows 10 you can use IIS but i found on my copy of window 10 64 bit it was actually 32 bit and it didn't play ball with the drivers for PHP as IIS installed a 32 bit copy of PHP and the drivers needed to be 64 bit as my SQL server is 64 bit. Instead i used Wamp Server 3.0 and ignored the fact MySql Does'nt work due to access denied issues on Windows 10.
Once you have confirmed you have the drivers working the below script can test to see if PHP can talk to SQL.
Save the above script file as testmssql.php and run it in your browser to ensure your php can connect to your sql server.
In my next blog i'll talk about encryption on the sql server
Once you have confirmed you have the drivers working the below script can test to see if PHP can talk to SQL.
Save the above script file as testmssql.php and run it in your browser to ensure your php can connect to your sql server.
In my next blog i'll talk about encryption on the sql server



