Please help! i have a mistake:
Fatal error: Uncaught Error: Call to undefined function oci_connect() in C:Apache24htdocsincludedb.php:6 Stack trace: #0 {main} thrown in C:Apache24htdocsincludedb.php on line 6
and errors in apache log:
[Mon Dec 25 15:20:41.681765 2023] [mpm_winnt:notice] [pid 5916:tid 396] AH00422: Parent: Received shutdown signal — Shutting down the server.
[Mon Dec 25 15:20:43.701697 2023] [mpm_winnt:notice] [pid 6748:tid 360] AH00364: Child: All worker threads have exited.
[Mon Dec 25 15:20:43.733503 2023] [mpm_winnt:notice] [pid 5916:tid 396] AH00430: Parent: Child process 6748 exited successfully.
PHP Warning: PHP Startup: Unable to load dynamic library ‘oci8_19’ (tried: extoci8_19 (The specified module could not be found), extphp_oci8_19.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘oci8’ (tried: extoci8 (The specified module could not be found), extphp_oci8.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘openssl’ (tried: extopenssl (The specified module could not be found), extphp_openssl.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql’ (tried: extpdo_mysql (The specified module could not be found), extphp_pdo_mysql.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘php_pdo_oci’ (tried: extphp_pdo_oci (The specified module could not be found), extphp_php_pdo_oci.dll (The specified module could not be found)) in Unknown on line 0
[Mon Dec 25 15:20:45.294072 2023] [mpm_winnt:notice] [pid 1584:tid 344] AH00455: Apache/2.4.58 (Win64) PHP/8.0.29 configured — resuming normal operations
[Mon Dec 25 15:20:45.294072 2023] [mpm_winnt:notice] [pid 1584:tid 344] AH00456: Apache Lounge VS17 Server built: Oct 18 2023 13:03:18
[Mon Dec 25 15:20:45.294072 2023] [core:notice] [pid 1584:tid 344] AH00094: Command line: ‘C:Apache24binhttpd.exe -d C:/Apache24’
[Mon Dec 25 15:20:45.309698 2023] [mpm_winnt:notice] [pid 1584:tid 344] AH00418: Parent: Created child process 728
PHP Warning: PHP Startup: Unable to load dynamic library ‘oci8_19’ (tried: extoci8_19 (The specified module could not be found), extphp_oci8_19.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘oci8’ (tried: extoci8 (The specified module could not be found), extphp_oci8.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘openssl’ (tried: extopenssl (The specified module could not be found), extphp_openssl.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql’ (tried: extpdo_mysql (The specified module could not be found), extphp_pdo_mysql.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘php_pdo_oci’ (tried: extphp_pdo_oci (The specified module could not be found), extphp_php_pdo_oci.dll (The specified module could not be found)) in Unknown on line 0
But I have all of these scripts placed in php and in ext folder. I put all of this extensions in php.ini
and php and instannt client are matching x64 php 8.0 and instant client 19.
Also, i put all PATHS in environmental variables. php & apache are working but this oci connect does not
2
Answers
Also, i put all PATHS in environmental variables. php & apache are working but this oci connect does not
🚀
I’m ready to help you troubleshoot the oci_connect() error. Here’s a guide, incorporating insights from expert reviews and addressing potential issues:
Double-check locations: Ensure php_oci8_19.dll (or the appropriate extension for your PHP version) is present in both the ext folder within your PHP installation and the extension_dir specified in your php.ini file.
Confirm path accuracy: Verify that the paths to these extensions in your php.ini file are correct and use forward slashes (/) for consistency.
2. Inspect Extension Loading in phpinfo():
Create a phpinfo.php file: Write a simple PHP script with <?php phpinfo(); and access it in your browser to view loaded extensions.
Confirm OCI8 loading: Look for oci8 or oci8_19 in the list. If absent, proceed to the next steps.
3. Address Missing Dependencies:
Install Visual C++ Redistributable for Visual Studio: Download and install the appropriate version (likely 2017 for PHP 8.0) from Microsoft’s website.
Install other dependencies: If prompted for additional libraries during extension setup, install those as well.
4. Recheck Instant Client Configuration:
Verify architecture compatibility: Ensure your Instant Client matches your PHP’s architecture (x64 in this case).
Set environment variables: Double-check that the PATH environment variable includes the Instant Client’s bin directory, and that TNS_ADMIN (if using TNSNAMES.ORA) points to the correct location.
5. Restart Apache:
Save changes: After any modifications to php.ini or environment variables, restart Apache for them to take effect.
Additional Troubleshooting Steps:
Check file permissions: Ensure the web server has read access to the extension files and Oracle client libraries.
Run php –ini: Verify which php.ini file is being used and make adjustments accordingly.
Review Apache logs: Look for more specific error messages that could provide clues.
Consider a clean installation: If issues persist, consider reinstalling PHP and the OCI8 extension to ensure a clean setup.
If the error continues after these steps, provide more details about your environment (OS, PHP version, Instant Client version, installation method) and any other relevant information for further assistance.