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.
1. Download Oracle Instant Client
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:\oracle\instantclient_23_6
.
2. Add Environment Variable
To make the Oracle Instant Client accessible system-wide, we need to register the Instant Client path to our system.
- Search for Edit the system environment variables and then click on the Environment Variables button.
- In the System variables section, click on Path and edit.
- Add a new value,
C:\oracle\instantclient_23_6
, and click OK.
You can close all the windows now.
For the changes to take effect, restart your computer.
3. Download PHP 8.3
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:\laragon\bin\php\php-8.3.14-Win32-vs16-x64
.
4. Upgrade Apache for PHP 8.3 Compatibility
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-VS17\Apache24
folder to the parent folder httpd-2.4.62-240904-win64-VS17
.
We can safely delete the Apache24
folder.
5. Configure Laragon
Open the Laragon application to change the Apache and enable OCI8 extension. Stop all services first, just to be safe.
Apache
Select the new Apache version using the menu Apache > Version > httpd-2.4.62-240904-win64-VS17.
OCI8 extension
Enable OCI8 extension by using the menu PHP > Extensions > oci8_19.
Now we can start all services and test.
6. 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! 🚀
Top comments (1)
switch to nginx, don't need to do additional setup like apache.