How does php7.2 connect to oracle database? The following article will introduce to you the method of installing OCI8 extension to support oracle database in php7.2, I hope it will be helpful to you!
When working on a project, the remote oracle database provides us with an intermediate table. Some data in my business needs to be queried from this intermediate table in the oracle database.
PHP connects to oracle database. An extension to OCI8 is required. I am ashamed to say that I have worked for so many years and have not used the oracle database seriously.
The syntax of the mysql database is different from that of the oracle database. Don’t use the mysql syntax to operate the oracle database like me… a bit embarrassing…
Today we will roughly record the installation process of the OCI8 extension.
1: Download the file
1: Download address from oracle official website:
Download the file (spotted the file name):
2 : PHP official website download address:
It is recommended to put the above three files in the /opt directory. Of course, it is your freedom to put them in the specific place. Just find it.
1 : Install the oracle plugin
May report an error:
ImportError: libaio.so.1: cannot open shared object file: No such file or directory”
The reason for the error has been given above, the libiao plugin is missing, the solution:
2 : Install the OCI8 plugin
(1): Unzip the tar package:
(2): Enter the decompression directory
(3): Run the following command:
There may be an error when running: Can’t find PHP headers in /usr/include/php The php-devel package is required for use
(4): Use $ORACLE_HOME or Instant Client to configure the software package
(5): Execute compile and install:
There may be an error here:
make: *** No rule to make target
build', needed by default’. Stop.
1: Install the following configuration:
2 : Reconfigure
(6): Configure php.ini
We add in the PHP configuration file php.ini
Restart the web server (nginx, apache, etc.).
Check it out
PHPinfo();as shown below:
Then, you can configure multiple database links in your PHP framework.
Recommended study: ” PHP Video Tutorial “
The above is how php7.2 connects to oracle database? For more details on the installation of the OCI8 extension, please pay attention to other related articles on the php Chinese website!