Here is my configuration:
Window Server 2016 build 14393
From phpinfo:
PHP Version 8.1.5
Architecture X64
Server API CGI/FastCGI
Loaded configuration file: D:\php\php.ini (expected)
PHP API: 20210902
PHP Extension: 20210902
from php.ini
extension=oci8_12c ; Use with Oracle Database 12c Instant Client
Notes:
This php.ini file works on my laptop and another windows 16 server (both running Apache). On this server, we are running php over IIS
many of the extension sections are missing from phpinfo listing including oci8 and odbc.
If I do a php --ri I get screenful of warnings telling me for example:
PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: d:\php\ext\curl (The specified module could not be found), d:\php\ext\php_curl.dll (The specified module could not be found)) in Unknown on line 0
but in every case I tested, the 'missing' dll does exist in the specified folder.
execution of tnsping from d:\app\oracle\product\12.2.0\client_1\bin\tnsping.exe:
TNS Ping Utility for 64-bit Windows: Version 12.2.0.1.0 - Production on 28-APR-2022 16:51:58
first part of path:
PATH=C:\Windows\system32\inetsrv;
D:\app\oracle\product\12.2.0\client_1\bin;
C:\Windows\system32;
I did not determine root cause for why my extensions were not loading. However, I was able to get them to load. Here is what I did:
removed php-cgi entry from IIS fast-cgi section
removed php-cgi entry from IIS http-mapping section
deleted d:\php folder
From IIS manager, added php 7.4 (64 bit) [latest version available in platform manager] using platform manager
enabled OCI8_12c using IIS/PHP Manager -- at this point, my application works
unzipped php 8.15 to d:\php
used IIS/PHP Manager to register new version, pointing to d:\php\php-cgi.ee
used IIS/PHP Manager to enable OCI8_19
restarted IIS -- now my application works fine as php 8.15 under IIS
Related
I am trying to deploy OCI8 with PHP7 and Apache 2.4.
The database does not reside in my local pc. It is on a different server with Oracle 11g Enterprise version and 64bit architecture as well.
I am unable to load oci8 on my local PC with the following settings
extension=php_oci8_11g.dll
extension_dir = c:\php\ext
The path in system variables is properly updated with c:\php;
I have followed the instructions carefully https://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html
I am using all versions with 64bit as my PC is running 64bit:
mod_fcgid
instantclient
php7
apache 2.4
phpinfo() shows perfectly on my browser but it does not show a table for oci8. I then run the command php -m in cmd to double check the status, but I get the following popup:
The program cannot start because php7.dll is missing from your computer.
Try reinstalling the program to fix the problem.
And the cmd window shows the following error:
Warning: PHP Startup: Unable to load dynamic library 'php_oci8_11g'
(tried: C:\php\ext\php_oci8_11g (The specified module could not be
found.), C:\php\ext\php_php_oci8_11g.dll (The specified module could
not be found.)) in Unknown on line 0
What could be the problem?
I had it working with extension=oci8_12c instead. It turned out that even if the remote Oracle Database I am trying to connect with is of version 11g, the latest oci8 version supports 11g as well.
This worked: https://www.oracle.com/technetwork/articles/dsl/technote-php-instant-12c-2088811.html
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'm currently setting up a Windows 10 Pro x64 machine to work with Apache, PHP and its oci8 extension.
I successfully managed to get oci8 working on OSX 10.11 and Windows 2012 Server before, so I thought I knew what to do. But this was 32bit – now it's 64.
The software now installed is:
Apache 2.4.18 x64
PHP 7.0.3 TS x64
Oracle Instant Client x64 (instantclient-basic-windows.x64-12.1.0.2.0)
oci8 2.1.0 TS x64
I don't get it to work. The error message is:
Warning: PHP Startup: Unable to load dynamic library
'ext\php_oci8_12c.dll' - Das angegebene Modul wurde nicht gefunden. (Module not found.)
in Unknown on line 0
Extension 'oci8' not present.
I installed the Oracle Instant Client by writing its directory into the PATH variable and copied the php_oci8_12c.dll file to the PHP ext dir and uncommented the corresponding line in the php.ini. Shouldn't that be enough?
I've read many postings here on Stackoverflow and other websites about similar problems, things I've tried:
Moving all DLLs to C:\Windows\system32
Include the PHP extension dir in the PATH variable
Re-checked that every component is 64bit
Created ORACLE_HOME and ORACLE_BASE variables (which shouldn't be necessary)
If I change the php_oci8_12c.dll x64 to the 32bit one, I get a different error message:
Warning: PHP Startup: Unable to load dynamic library 'ext\php_oci8_12c.dll' - %1 ist keine zulässige Win32-Anwendung. (%1 is not a valid Win32 program.)
in Unknown on line 0
Extension 'oci8' not present.
Any ideas what's wrong with all that?
Thank You!
To sum it all up,
One more thing... NTS assumes that PHP does not run as Apache module,
is that correct? Are you using FastCGI? – Álvaro González
was the way to go. If anyone's having troubles with the same, here are the exact steps I took:
PHP 7.0.3 VC14 x64 Thread Safe from windows.php.net/download/
Apache 2.4.18 x64 from apachehaus.com/cgi-bin/download.plx
Oracle Instant Client 12.1.0.2.0 x64 from oracle.com/technetwork/topics/winx64soft-089540.html
(Get the current Thread Safe oci8 DLL from pecl.php.net/package/oci8, but PHP comes with a version of it - worked with either for me)
Install PHP as an Apache module. Unzip the Instant Client and move it to your desired location. Add this location to your PATH system variable. Restart your machine and it should show up under 'PATH' in your phpinfo().
Then I had to make the PHP extension_dir an absolute path. So no 'ext', but 'C:/Program Files/php-7.0.3/ext'. With only 'ext' set to the extension_dir I could connect to a remote Oracle DB via 'php.exe filename.php'. But Apache would throw me an error in error.log that it cannot find the DLL.
No DLL copying is needed if you choose to keep the oci DLL that comes with PHP. No more environment variables than PATH have to be changed/created.
At least in my case :-)
I found lots of articles about this problem, however none of them helped me.
Here is a I list of what I 've already tried:
uncomment the semicolon on php.ini
add the dependence file (libmcrypt.dll) on php folder, windows and
windows/system32
I 've restarted the IIS Server after each attempt
I cannot use this method, it was installed with a zip file.
On IIS Manager the extension is shown as enabled but checking the php error log I found this message multiple times:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\v5.3\ext\php_mcrypt.dll' - %1 is not a valid Win32 application. in Unknown on line 0
Here is a the screenshot of phpinfo()
I have Windows Server 2008 R2 64bit with IIS 7.5 and PHP 5.3.10. Maybe the file (php_mcrytp.dll) is not the good one, where can I download it? On php site I cannot find the php_mcrytp.dll file under ext folder.
Thank you
If you downloaded PHP for Windows from php.net and are running the FastCGI version of PHP (as you should with PHP 5.3.x and IIS), mcrypt library is already compiled statically in the PHP engine. You don't need to install any extra DLL.
If you see the mcrypt section in phpinfo's output then it means mcrypt is already enabled (otherwise the mcrypt section would be missing).
And that's also the reason there is no mcrypt DLL.