Greetings,
I need to install oci8 drivers for PHP, but I’m having some trouble.
I already have a WAMP install, which comes with the oci8 extension, and have done the following in effort to set it up:
Enabled the extension by adding the following to my php.ini file in my Apache docroot as a local variable:
[PHP_OCI8]
extension=php_oci8.dll
Added my extensions directory path to my PATH environment variable on windows (c:/wamp/bin/php/php5.3.0/ext/;)
Added the same extensions directory to my php.ini file
When I start up my wamp I see the following error message:
PHP Startup: Unable to load dynamic library ‘c:/wamp/bin/php/php5.3.0/ext/php_oci8.dll’
I’m able to verify that the above path is correct, and am tempted to say that there’s something wrong with the .dll, but I’m not sure.
Has anyone experienced similar issues?
The Oracle OCI8 driver also requires that the Oracle Instant Client 10gR2 (aka 10.2.x) libraries or newer be installed on the machine PHP is running on. It is recommended you use either the Basic or Basic Lite version depending on if you need the internationalization libraries or not.
Win32 Instant Client Download Page
Win64 Instant Client Download Page
An annotation: I recently had the task of installing PHP 5 on a Windows system with Oracle HTTP Server 10g. PHP <= 5.0 requires an Oracle 8i or 9i client, PHP >= 5.1 requires an Oracle 10gR2 client or above. The Oracle HTTP Server 10g deploys an Oracle 10gR1 client which is not at all supported by PHP 5 (at least on Windows, maybe one can compile by himself...),
but contains PHP 4.3.9 as an Apache module. I couldn't use it: some PHP modules that are required need at least PHP 5.0.
Solution was: return to Oracle HTTP Server from the 9i companion CD while running a 10gR2 database in a separate Oracle Home.
Related
I am migrating a website from a development environment (Angular 4 - WAMP Server - PHP 5.6.35) to a production environment. In development, the Angular 4 application was successfully able to connect to a PHP script and run an Oracle stored procedure so there are no issues with the code.
In production, I've had to install PHP using the Web Platform Installer to successfully run a PHP site with phpinfo() showing 'PHP Version 7.2.7'. I run the application and when it attempts to run the PHP script, I get a 500 Internal Server error when the script is run. PHP error logs show:
<b>Fatal error</b>: Call to undefined function ocilogon() in <b>C:\inetpub\wwwroot\app\assets\scripts\php\pullData.php</b> on line <b>154</b><br />
Research has indicated that the issue could be:
Possible IIS configuration issue
Oracle Instant Client issue
OCI8 PHP Library not enabled
I think I've ruled out the IIS configuration as the front-end connects to PHP and runs the scripts without issue.
Oracle Instant Client 12.1 is installed and other applications can connect to Oracle. The PATH environment variable appears correctly set. I don't know if it is a 32-bit or 64-bit version - or whether this makes a difference.
I think this is the issue - the OCI8 library isn't enabled correctly. On the dev server, I was able to modify the php.ini file to uncomment (and enable) the dll, and phpinfo() showed the OCI8 library in the list:
extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
On production, I've had to manually add the 'extension=php_oci8_12c.dll' line (it wasn't uncommented out) and I've checked the EXT folder of PHP and the dll exists there. Phpinfo() still doesn't show the OCI8 library enabled.
Issue is fixed, and I took the following steps to fix it:
Uninstalled PHP (removed all PATH references and folders).
Uninstalled Oracle Instant Client using Oracle Universal Installer.
Installed PHP for IIS Express (and all dependencies) using the IIS Web Platform Installer.
Installed Oracle Instant Client 12c using automatic installer (winx64_12102_client.zip), not ZIP file. This way I didn't have to manually add PATH variables etc.
Checked PHP version (and if it was thread safe) using phpinfo(). Thread safety was (is) disabled. Downloaded the non-thread-safe (nts) version of php_oci8_12c.dll from windows.php.net (https://windows.php.net/downloads/pecl/releases/oci8/2.1.8/) and copied contents to EXT folder in the PHP install directory (which was in a parent folder of IIS Express).
Edited the PHP.ini files (php.ini-production and php.ini-development and php.ini) to include 'extension=php_oci8_12c.dll' or uncomment "extension=oci8_12c".
Restarted the server (probably unnecessary).
Opened CMD and ran the code 'php --ri oci8' to check OCI8 support is enabled and using the version of Oracle Instant Client that I just installed. Verified this also by using phpinfo().
Done. OCI functions now work.
This was a grueling process because this web server had multiple installs of Oracle Instant Client and the Web Platform Installer for IIS was buggy when installing PHP 5.6 and its dependencies. I was lucky that this time that the installer did not error out with PHP 7.2 as it originally did when installing PHP 5.6.
I'm developing a PHP application that connects to MSSQL on windows environment, I have
Windows Server 2008 R2 Enterprise - 64-bit operating system
WAMP 2.5 - 64-bit (Apache 2.4.9 / PHP 5.5.12)
I've installed the official Microsoft SQL PDO Drivers (php_pdo_sqlsrv_55_ts.dll, php_sqlsrv_55_ts.dll)
I've connected to the database successfully, and executed different queries
I've two problems
Every time the WAMP starts I found these errors in the error log
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp/bin/php/php5.5.12/ext/php_pdo_sqlsrv_55_ts.dll' - %1 is not a
valid Win32 application. in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp/bin/php/php5.5.12/ext/php_sqlsrv_55_ts.dll' - %1 is not a
valid Win32 application. in Unknown on line 0
When I try to use PDO method (bindValue) ... the page crashes .. don't throw specific error or warning or anything .. just this message in the browser "This site can’t be reached" ... and the same two errors appear in the PHP error_log
The PDO_SQLSRV is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MS SQL Server (starting with SQL Server 2005).
The extension is enabled by adding appropriate DLL file to your PHP extension directory and the corresponding entry to the php.ini file, which appears to have been done in your installation. The PDO_SQLSRV file download comes as 8 driver files, 4 of which are for PDO support.
The ts/nts abbreviation in file names below means Thread-safe /Non-thread-safe respectively.
If you are running non-thread-safe PHP (PHP 5.3), use the php_pdo_sqlsrv_53_nts.dll file. (You should use a nts version if you are using IIS as your web server).
If you are running ts PHP, use the php_pdo_sqlsrv_53_ts.dll file.
Similarly for PHP 5.4, use the php_pdo_sqlsrv_54_nts.dll or php_pdo_sqlsrv_54_ts.dll depending on whether your PHP installation is non-thread-safe or thread-safe.
The most recent version of the driver is available for download here. If you need support for PHP 5.2 and/or PHP compiled with VC6, use the 2.0 release of the driver.
I wanted to setup a database connection from PHP to SQL server 2012.I have a wamp server(64 bit) set up on a windows machine(64 bit) with PHP 5.5.12 and on the same machine I have SQL server 2012 installed.
Extracted sqlsrv drivers from official_link
Copied the extracted drivers php_sqlsrv_55_ts.dll, extension = php_pdo_sqlsrv_55_ts.dll to php\ext folder, and then changed the php.ini file to include the extensions
extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
Now I tried
<?php
phpinfo();
?>
I see the following information without any SQL server information in it.
Don't seem to have configured SQL server connection successfully. Could some one please guide me on what I am missing here.
64 bit WAMP server was not able to connect using the drivers extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
So, I installed a 32 bit version of the WAMP server and it works fine now.
Check the php error log (c:\wamp\logs\php_error.log).
I had the same setup (64bit WAMP/PHP 5.5.12) and same missing sqlsrv reference in phpinfo and I got this error in my log:
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp/bin/php/php5.5.12/ext/php_pdo_sqlsrv_55_ts.dll' - %1 is not a
valid Win32 application. in Unknown on line 0
The solution was to install the 64bit version of the sqlsrv drivers. I found the unofficial 64bit drivers through http://robsphp.blogspot.nl/2012/06/unofficial-microsoft-sql-server-driver.html
Warning: In my testing I found these 64bit PHP_PDO_SQLSRV extension 10 times slower than when using PHP_PDO_ODBC.
I am visiting this thread and i think this might help full for you and other with the same issue:
How can I install pdo_sqlsrv on my windows 2008 Server 2008 R2?
The PDO Extension is not the same as the native driver Microsoft is offering. For PDO you must enable
extension=php_pdo_mssql.dll
in your php.ini.
{Normally this file (php_pdo_mssql.dll) should be in your PHP extension-directory (C:...\php\ext). If it's not there you can download PHP from http://windows.php.net/download/ and just take the extension from a package there (take one that correspond with your PHP version of course)}.
Above is taken from PDO MSSQL Server - Driver not found
read for more details. i have the same issue foe linux and i have saved all the pages thats why i am quoting for you help.
if all above didn't work for you then:
On the php.net it is listed that
On Windows, PDO_ODBC is built into the PHP core by default. It is linked against the Windows ODBC Driver Manager so that PHP can connect to any database cataloged as a System DSN, and is the recommended driver for connecting to Microsoft SQL Server databases.
http://php.net/manual/en/ref.pdo-odbc.php
You can connect to mssql server using odbc drivers as i have never connect by my self from windows i use to do it through linux using freeTds, following pages might help you
http://craigballinger.com/blog/2011/08/usin-php-5-3-with-mssql-pdo-on-windows/
Connect PHP to MSSQL via PDO ODBC
PHP to SQL Server without ODBC or MSSQL support
Is there a driver for MSSQL Server for PHP (64-bit)?
I have Apache 2.4 (64-bit) environment installed. Also PHP 5.5.12 (64-bit)
I have search for MSSQL Server driver "on the net" for php 64-bit but I found nothing. All I can find is a 32-bit. Also, all the articles that I found were old and nothing recent.
I tried to install the 32-bit driver but I get a warning when executing C:\php>php -m
This is the warning
PHP Warning: PHP Startup: Unable to load dynamic library 'ext\php_sqlsrv_54_ts.dll' - %1 is not a valid Win32 application. in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'ext\php_pdo_sqlsrv_54_ts.dll' - %1 is not a valid Win32 application. in Unknown on line 0
I downloaded the MSSQL Server Driver from Microsoft Drivers 3.0 for PHP for SQL Server
If there a MSSQL Server driver available for PHP 64-bit environment?
If not is there a workaround beside having to go back to 32-bit PHP environment?
I have run into this issue as well. What I have found is that you need to make sure that the extension=php_sqlsrv_54_ts.dll area of your php.ini file is only uncommented on the Apache location of php.ini.
For example:
if you have C:\Webserver\bin\apache\bin\php.ini, you probably have a C:\Webserver\bin\php\php.ini as well. Make sure your extension referrences are ONLY in the ...\apache\bin\php.ini.
It took me 3 hours to realize there were 2 different php.ini files and that the error was throwing because I had the extension initialized in the wrong php.ini file yet it was still looking there for some reason. I hope this helped.
Have you tried updating to php 7 ?
The x64 builds of PHP 5 for Windows are experimental, and do not provide 64-bit integer or large file support. Therefore I doubt MS will release a php5 version of the driver especially since the one for php 7 has been out for a few months now.
This MSSQL driver was release in July of 2016
Download the "SQLSRV40.EXE" from https://www.microsoft.com/en-us/download/details.aspx?id=20098
The executable is a self-extractor, unpack where you want.
You even get the PDO for the same price.
Here are the files in the package
PHP Drivers License Terms.rtf
php_pdo_sqlsrv_7_nts_x64.dll
php_pdo_sqlsrv_7_nts_x86.dll
php_pdo_sqlsrv_7_ts_x64.dll
php_pdo_sqlsrv_7_ts_x86.dll
php_sqlsrv_7_nts_x64.dll
php_sqlsrv_7_nts_x86.dll
php_sqlsrv_7_ts_x64.dll
php_sqlsrv_7_ts_x86.dll
release.txt
SQLSRV_Readme.htm
SQLSRV_ThirdPartyNotices.rtf
Tested with php 7.0, 7.1, 7.2
Goal
Connect to a MSSQL 2008 R2 server using the FreeTDS (php_dblib.dll 0.82 + 20110906 patches) Drivers for PHP 5.4.16 (VC9).
I am unable to use any alternative to FreeTDS unless the client also decides to use an alternative. This is unlikely unless they also run into this issue when upgrading their current version of PHP (currently 5.3.x) tomorrow.
Issue
PHP is unable to load the FreeTDS extension.
The Apache error log displays this on server start:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.16/ext/php_dblib.dll' - The specified module could not be found.\r\n in Unknown on line 0
As far as I understand it, the extension is either unable to be found or is the wrong version?
The extension directory location in the php.ini has been checked and triple checked and is:
c:/wamp/bin/php/php5.4.16/ext/
That leads me to believe it is the wrong version of php_dblib.dll. I've also checked that multiple times and made sure to use the version for PHP 5.4.X Thread Safe.
Steps Taken
Clean install of WAMP 2.4 with PHP 5.4.16 and Apache 2.4.4
Thread Safe php_dblib.dll placed in PHP extension directory
extension=php_dblib.dll added to the correct php.ini
extension=php_mssql.dll and extension=php_pdo_mssql.dll disabled in php.ini
msvcr71.dll (DotNet framework 1.1) added to PHP root directory
freetds.conf added to server root directory (c:)
System Details
WAMP Server 2.4
Apache 2.4.4
PHP 5.4.16 (VC9)
Thread Safety: enabled
FreeTDS Thread Safe (php_dblib.dll) 0.82 + 20110906 patches
Microsoft SQL Server 2008 R2
msvcr71.dll (DotNet framework 1.1) only included in the PHP root directory
EDIT:
WAMP 2.4 32-bit
OS: Windows 7 Pro 64-bit
EDIT 3
Last update only applied to the 64-bit version of WAMP. I've installed the 32-bit version, again, and --without-dblib is no longer in the configure command section of the phpinfo().
Questions
With the information given, is there anything else you'd need to know about to give an accurate assessment of the situation?
I am unable to find any, but are there any known issues with FreeTDS 0.82 and PHP 5.4.16?
Temporary Defeat
I've rolled back to PHP 5.3.x for now, FreeTDS works fine on that version. I'm not sure that it will make a difference with the little bit of code I am actually delivering to the client. This was intended to be a "double" check to make sure it all works perfectly, but since I'll be on site during the install I can fix any issues if they come up.
I would like to find a solution eventually since more and more of the systems I work with every day are going to be upgraded to php 5.4 and beyond.