Hi @Vazquez Zabdiel thanks for the question.
Yes, it is possible to install the Oracle client in an Azure Linux Web App running PHP 8.2. However, there are some limitations to consider.
Azure Linux Web Apps run in a sandboxed environment, which means that you cannot install software directly on the host operating system. Instead, you can install software in the application's file system or in a custom container.
To install the Oracle client in your Azure Linux Web App, you can follow these general steps:
- Create a custom container that includes the Oracle client. You can use a Dockerfile to create the container. Here's an example Dockerfile:
FROM php:8.2-apache
# Install Oracle client dependencies
RUN apt-get update && \
apt-get install -y libaio1 && \
rm -rf /var/lib/apt/lists/*
# Copy Oracle client files to container
COPY instantclient_19_8 /usr/local/instantclient
# Set environment variables for Oracle client
ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient
# Install PHP OCI8 extension
RUN docker-php-ext-configure oci8 --with-oci8=instantclient,/usr/local/instantclient && \
docker-php-ext-install oci8
- This Dockerfile installs the Oracle client dependencies, copies the Oracle client files to the container, sets environment variables for the Oracle client, and installs the PHP OCI8 extension.
- Build the custom container and push it to a container registry. You can use Azure Container Registry or another container registry of your choice.
- Configure your Azure Linux Web App to use the custom container. You can do this by setting the
DOCKER_CUSTOM_IMAGE_NAME
application setting to the name of the custom container in the container registry. - For example, if you pushed the custom container to Azure Container Registry with the name
myregistry.azurecr.io/mycontainer:latest
, you would set theDOCKER_CUSTOM_IMAGE_NAME
application setting tomyregistry.azurecr.io/mycontainer:latest
. - You can set the application setting in the Azure portal or using the Azure CLI: `az webapp config appsettings set --resource-group <resource-group-name> --name <web-app-name> --settings DOCKER_CUSTOM_IMAGE_NAME=myregistry.azurecr.io/mycontainer:latest
`
Note that you may also need to set other environment variables for the Oracle client, such as TNS_ADMIN
and NLS_LANG
, depending on your specific configuration.
Lastly, there is different approach you can try which is shared here in this related Stack Overflow thread
Hope that helps.
-Grace