When using PHP to connect to the Oracle database, when calling the oci_parse() function in the code, the following error may occur:
PHP Fatal error: Call to undefined function oci_parse()
This is an error caused by PHP not having the Oracle extension installed. In order to solve this problem, we need to perform the following steps:
When PHP connects to the Oracle database, you need to use Oracle Instant Client. Therefore, we need to install Oracle Instant Client.
Download the corresponding version of Oracle Instant Client from the Oracle official website and extract it to any directory.
PECL is a PHP extension library, and OCI8 is an extension for PHP to connect to the Oracle database. Therefore, we need to install the PECL OCI8 extension first.
You can install it by running the following command:
pecl install oci8
During the installation process, you may be asked to enter the installation path of Oracle Instant Client, just enter it.
After the installation is complete, add the following code to the php.ini file:
extension=oci8.so
Save and close the php.ini file.
After the installation is complete, you need to restart Apache for the changes to take effect.
Run the following command to restart Apache:
service apache2 restart
or
service httpd restart
In this way, we successfully solved the problem The PHP Fatal error: Call to undefined function oci_parse() problem has been solved, and the oci_parse() function can be used to connect to the Oracle database normally.
The above is the detailed content of Solution to PHP Fatal error: Call to undefined function oci_parse(). For more information, please follow other related articles on the PHP Chinese website!