Home >Backend Development >PHP Tutorial >How to install PHP with OCIn Laragon
In this tutorial, we’ll walk through the steps to install and configure the OCI8 extension on Laragon with PHP 8.3. The OCI8 extension allows PHP to connect to Oracle databases, and setting it up can be a bit tricky.
To use the OCI8 extension, you need to download the Oracle Instant Client. Go to the Oracle Instant Client for Windows x64 downloads page and get the following:
Once the downloads are completed, extract both files and move the contents to C:oracleinstantclient_23_6.
To make the Oracle Instant Client accessible system-wide, we need to register the Instant Client path to our system.
You can close all the windows now.
For the changes to take effect, restart your computer.
By default, Laragon shipped with PHP 8.1 only, but we can add other PHP versions easily.
Head to PHP for Windows and get your preferred version. In this tutorial, we will download the following:
Once the download is complete, extract the file on your computer. Then, move the folder php-8.3.14-Win32-vs16-x64 to C:laragonbinphpphp-8.3.14-Win32-vs16-x64.
Now we need to upgrade Apache bundled with Laragon to the latest version to prevent the httpd.exe - Entry Point Not Found error.
Visit Apache Lounge and download the latest version of Apache, at the time of writing, the latest version is httpd-2.4.62-240904-win64-VS17.
Once downloaded, extract the file and move all files and folders inside this httpd-2.4.62-240904-win64-VS17Apache24 folder to the parent folder httpd-2.4.62-240904-win64-VS17.
We can safely delete the Apache24 folder.
Open the Laragon application to change the Apache and enable OCI8 extension. Stop all services first, just to be safe.
Select the new Apache version using the menu Apache > Version > httpd-2.4.62-240904-win64-VS17.
Enable OCI8 extension by using the menu PHP > Extensions > oci8_19.
Now we can start all services and test.
To verify that OCI8 is installed and working, create a new blank project in Laragon by using Quickapp > Blank.
Create a new file inside this project and add the following codes:
<?php if (function_exists('oci_connect')) { echo "OCI is installed"; } else { echo "OCI is not installed"; }
Run the project in your web browser and you should see OCI is installed.
Congratulations! You’ve successfully installed and configured the OCI8 extension on Laragon with PHP 8.3. You can now connect your PHP applications to Oracle databases.
If you encounter any issues, double-check the steps above or consult the official documentation for further assistance.
Happy coding! ?
The above is the detailed content of How to install PHP with OCIn Laragon. For more information, please follow other related articles on the PHP Chinese website!