logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Can Apache2.4 load PHP7/SQL Server Extensions VC14on win X64
Author
JMCDS



Joined: 30 Jan 2017
Posts: 2
Location: USA, DES MOINES

PostPosted: Mon 30 Jan '17 20:59    Post subject: Can Apache2.4 load PHP7/SQL Server Extensions VC14on win X64 Reply with quote

Trying to get an Apache2.2 + PHP5 + SQL server upgraded to newer software. Having problems. Wondering if PHP7 SQL Server extensions are compatible with Apache (as opposed to only IIS).

I have previously used a configuration with Apache2.2 + PHP5 + SQL Server 2008 R2 for years which has worked wonderfully. I'm now trying to upgrade to:

Apache 2.4

PHP 7.0 (ThreadSafe)

SQL 2008 R2 and eventually SQL 2014

Windows 7 SP1, 64 Bit

I got Apache and PHP connected and working (before PHP SQL drivers). I've then tried to load the PHP SQL server extensions (x64 TS versions). Also added version 11 odbc driver. Tried to add the version 11 SQL Native Client but SNAC wouldn't install.

After loading the PHP SQL server extensions in my Ext folder:

php_sqlsrv_7_ts_x64

php_pdo_sqlsrv_7_ts_x64

Neither sqlsrv or PDO extensions will load when PHP loads. They do not show up when I run the PHPInfo() command to view the PHP setup. I've done all the basic stuff (I hope) like restarting Apache, verifying the X64 vs X86 versions, verified my spelling, added the loadModule command, enabled extensions, etc..

PHP ERROR LOG:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\PHP\\ext\\php_sqlsrv_7_ts_x64.dll' - The specified procedure could not be found.\r\n in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\PHP\\ext\\php_pdo_sqlsrv_7_ts_x64.dll' - The specified procedure could not be found.\r\n in Unknown on line 0

In any event, is it even possible to use these drivers with Apache instead of IIS? Also, the error log is weird in that its showing double "\\" in the error log file path description. I would not expect to see that.

I've previously had to copy that pesky NTWDBLIB.DLL into system32 on my xp web server. Could that be the problem in X64 win7? Also had to copy msvcr71.dll previously as well. Don't know if they are used in X64 Win 7 OS.

Any ideas?
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Wed 01 Feb '17 14:17    Post subject: Reply with quote

Are you running the x64 versions of Apache and PHP 7? A 64-bit extension will not load in PHP 7 x86...
Back to top
romanski



Joined: 07 Feb 2017
Posts: 2
Location: Austria

PostPosted: Wed 08 Feb '17 11:33    Post subject: Reply with quote

Any progress on this topic?

I'm having the exact same issue - trying to connect to MSSQL 2012 from Apache 2.4.25 + PHP 7.1.1.

Apache error log:
Code:
[Tue Feb 07 12:49:04.984643 2017] [mpm_winnt:notice] [pid 6312:tid 540] AH00455: Apache/2.4.25 (Win64) OpenSSL/1.0.2k PHP/7.1.1 configured -- resuming normal operations
[Tue Feb 07 12:49:04.984643 2017] [mpm_winnt:notice] [pid 6312:tid 540] AH00456: Apache Lounge VC14 Server built: Dec 17 2016 11:15:57
[Tue Feb 07 12:49:04.984643 2017] [core:notice] [pid 6312:tid 540] AH00094: Command line: 'C:\\Program Files\\Apache24\\bin\\httpd.exe -d C:/Program Files/Apache24'
[Tue Feb 07 12:49:04.984643 2017] [mpm_winnt:notice] [pid 6312:tid 540] AH00418: Parent: Created child process 2376
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_sqlsrv_7_ts_x64.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
[Tue Feb 07 12:49:05.390891 2017] [mpm_winnt:notice] [pid 2376:tid 468] AH00354: Child: Starting 64 worker threads.


Has anyone ever got this to work properly? Any help would be appreciated!
Back to top
romanski



Joined: 07 Feb 2017
Posts: 2
Location: Austria

PostPosted: Wed 08 Feb '17 14:35    Post subject: Reply with quote

I might have found a solution: the extensions provided by MS on their website are outdated. You should try the extensions from their github repository: https://github.com/Microsoft/msphpsql

The latest build 4.1.6 (available here: http://windows.php.net/downloads/pecl/releases/sqlsrv/4.1.6/) works fine, the extension is loaded by PHP and I am able to get a connection to the SQL server. Still having some security issues, but those should be worked out in no time.

Cheers,
Roman
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Wed 08 Feb '17 15:52    Post subject: Reply with quote

The v4.1.6 extensions for PHP 7.1 are also linked at
https://pecl.php.net/package/sqlsrv and
https://pecl.php.net/package/pdo_sqlsrv

The v4.1.5 extensions are also available for PHP 7.0 (and 7.1):
https://github.com/Microsoft/msphpsql/releases/tag/4.1.5-Windows
Back to top
JMCDS



Joined: 30 Jan 2017
Posts: 2
Location: USA, DES MOINES

PostPosted: Wed 08 Feb '17 22:34    Post subject: Reply with quote

JAN-E & romanski
Thank you very much!! That solved my problem. Here's my setup for anyone who might stumble across this:

****** APACHE BUILD 2.4.25 (Threadsafe) ***********
www.apachelounge.com/download
httpd-2.4.25-win64-VC14.zip

******* PHP BUILD ************************
http://windows.php.net/download
php-7.1.1RC1-win32-VC14-x64.zip


******* SQLSRV EXTENSION (Threadsafe) **********
Download Directory:
http://windows.php.net/downloads/pecl/releases/sqlsrv/4.1.6/

Downloaded File:
(Thread safe for Apache ver 2.4.25 x64)
php_sqlsrv-4.1.6-7.1-ts-vc14-x64.zip

******* PDO_SQLSRV EXTENSION (Threadsafe) *********

Download Directory:
http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/4.1.6.1/

Downloaded File:
(Thread safe for Apache ver 2.4.25 x64)
php_pdo_sqlsrv-4.1.6.1-7.1-ts-vc14-x64.zip

***** ADDITIONS TO PHP.INI *******************

After extracting extension files to my "ext" folder:
added the following extension calls to php.ini:

extension=php_sqlsrv.dll
extension=php_pdo_sqlsrv.dll

***** OTHER NOTES ***************************
-Not sure how much of this is needed:
--2012 SQL Native Client
----www.microsoft.com/en-us/download/confirmation.aspx?id=29065

--Microsoft ODBC Driver 11 for SQL Server
----www.microsoft.com/en-us/download/details.aspx?id=36434

--Visual C Redistributable (vc_redist.x64.exe)
-----www.microsoft.com/en-us/download/details.aspx?id=53840


**** COMPLETE NEWBIES **********
This guy has a couple of great videos on installing apache and also installing PHP. It doesn't address hooking up SQL server extensions but it covers the basics. Hooking up SQL server is somewhat advanced.

www.youtube.com/watch?v=D-wFWUMHcUA

Good luck.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Thu 09 Feb '17 0:56    Post subject: Reply with quote

Today the v4.1.6 builds have been added for PHP 7.0 as well on the pecl website:
https://pecl.php.net/package/sqlsrv/4.1.6.1/windows
https://pecl.php.net/package/pdo_sqlsrv/4.1.6.1/windows
Back to top


Reply to topic   Topic: Can Apache2.4 load PHP7/SQL Server Extensions VC14on win X64 View previous topic :: View next topic
Post new topic   Forum Index -> Other Software