The program cannot start because php7.dll is missing from your computer - php

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

Related

php throws exception "Call to undefined function oci_connect()"

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

WAMPSERVER 3.1.3 32 bit, PHP 7.2.4 Oracle Client 11g issue

I have installed Wampserver 3.1.3 32 bit on Windows 7 machine(32 bit). Wamp server has been installed correctly, getting a green icon on startup.
I have installed Oracle 32 client 11g on Windows machine and system environment variable path has been set c:\app\USER\product\11.2.0\client_1\bin;, where OCI.dll resides.
For work with Oracle queries, I had enabled extension=php_oci8_11g in my php.ini file. Have verified, that php_oci8_11g.dll exists at C:\wamp\bin\php\php7.2.4\ext. And also verified, that extension_dir has been set to extension_dir ="c:/wamp/bin/php/php7.2.4/ext/" in my php.ini.
Whenever I start Wamp server, the icon changes to green, but errors are generated in PHP_ERROR log file
[24-Apr-2018 18:10:07 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'oci8_11g' (tried: c:/wamp/bin/php/php7.2.4/ext/oci8_11g (The specified module could not be found.), c:/wamp/bin/php/php7.2.4/ext/php_oci8_11g.dll (The specified module could not be found.)) in Unknown on line 0
Because of provided error my Oracle queries are not working.
Tried number of solution available but none of them have been worked so far. Had anyone faced the same issue? Can anyone help me with this?

OCI8 with PHP7 - module not found

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 :-)

Is there MSSQL Server Driver for PHP on a 64-bit environment?

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

PHP loading extensions error

I'm trying to get PHP to load some extensions (sqlsrv driver for PHP PDO).
I'm using a wamp server, With PHP 5.4, Apache 2.4.4.
In my PHP.ini file, i've entered the following line:
extension_dir = C:\wamp\bin\php\php5.4.16\ext
...
extension=php_pdo_sqlsrv_54.nts.dll
However in the apache error log, whenever I restart the apache service, I get the error message:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.16/ext/php_pdo_sqlsrv_54_nts.dll' - The specified module could not be found.\r\n in Unknown on line 0
Now, I know for a fact, this error is incorrect. If I copy the file location directly from the error log, (C:\wamp\bin\php\php5.4.16\ext\php_pdo_sqlsrv_54_nts.dll) and paste it into windows explorer, it finds the file fine.
I've added the ext directory to windows PATH environment variable, still no success.
Any ideas what to try next?
Thanks
Your problem is that you are trying to run a NTS 'Not Thread Safe' dll with a PHP that is 'Thread Safe', so initially try downloading the Thread Safe version of the sqlsrv DLL.
BIG NOTE and possibly your next problems solution:
As far as I know the sqlserver database interface dlls are only available as 32bit. So if you have installed the 64bit WAMPServer you will have to uninstall and install the 32bit WAMPServer.

Categories