Integrating OCI8 with a PHP environment can be challenging, but recent updates have simplified the process significantly. Follow this guide to get everything set up seamlessly.
Adding OCI8 support to PHP
Oracle has streamlined the process for adding OCI8 support to PHP. Clear, user-friendly instructions are available in this Gist. Follow the steps outlined to prepare your PHP environment for OCI8.
Setting up Oracle XE in Docker
Once your PHP environment is ready, you can move on to Docker setup. We’ll use the Oracle XE image available on Docker Hub: gvenzl/oracle-xe.
Installing Colima
First, ensure you have Colima installed. Installation is straightforward using Homebrew:
brew install colima
After installing Colima, start it with the following command:
colima start --arch x86_64 --memory 4
Configuring Docker Context
Next, switch the Docker context to Colima:
docker context use colima
Running the Oracle XE Docker Image
Finally, run the Oracle XE container using the command below:
docker run -d --name oracle-xe -p 1521:1521 \
-e ORACLE_RANDOM_PASSWORD=true \
-e APP_USER=ORACLE \
-e APP_USER_PASSWORD=ORACLE \
gvenzl/oracle-xe
Conclusion
That’s it! With OCI8 support in PHP and Oracle XE running in Docker, your environment is ready.