--- title: "Example: PHP Executor with the SQLSRV Module" slug: "example-php-executor-with-the-sqlsrv-module" updated: 2024-09-09T02:42:07Z published: 2024-09-09T02:42:07Z canonical: "docs.processmaker.com/example-php-executor-with-the-sqlsrv-module" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.processmaker.com/llms.txt > Use this file to discover all available pages before exploring further. # Example: PHP Executor with the SQLSRV Module Follow an example to configure a PHP executor with the SQLSRV module. ## Overview > [!NOTE] > **Intended audience:** ProcessMaker Administrators, coding engineers > > **Tags:** Script Executor; PHP; SQLSRV This example outlines best practices when creating a PHP [script executor](/v1/docs/script-executor-management) with the [SQLSRV](https://www.php.net/manual/en/book.sqlsrv.php) module in ProcessMaker. This example ensures a seamless integration of the SQL Server functionality into your scripts. ## Configure PHP Executor with the SQLSRV Module Follow the next steps to configure the PHP executor with the SQLSRV module: 1. [View your Script Executors](/v1/docs/script-executor-management#view-script-executors). The **Script Executors** page displays. 2. Click the **+Script Executor** button. The **Add New Script Executor** screen displays. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/053a0867-3d3a-4204-a482-060b003300be.png) 3. In the **Name** setting, enter the unique name for the Script Executor. This name displays from Script configuration settings, so enter a descriptive name so that Process designers configuring their Scripts understand what customization this Script Executor provides. For example, you can enter **PHP + SQLSRV**. 4. In the **Description** setting, enter a description for the Script Executor. 5. From the **Language** setting, select the PHP programming language that the Script Executor uses to run the Script. After selecting the programming language, the default [Dockerfile](https://docs.docker.com/engine/reference/builder/#:~:text=A%20Dockerfile%20is%20a%20text,can%20use%20in%20a%20Dockerfile%20.) content to run Scripts using that language displays in the **Dockerfile** setting. The Dockerfile content includes the SDK for that language. 6. From the **Dockerfile** setting, append the default Dockerfile content with the [Docker commands](https://docs.docker.com/engine/reference/commandline/docker/) the Script Executor runs when it builds the Docker container. Consider following [best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/). For this example, enter the following code to integrate correctly the SQL Server functionality. ```plaintext ENV ACCEPT_EULA=Y # Fix debconf warnings upon build ARG DEBIAN_FRONTEND=noninteractive # Install selected extensions and other tools RUN apt-get update \ && apt-get -y --no-install-recommends install apt-utils libxml2-dev gnupg apt-transport-https \ && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* # Install curl and git RUN apt-get update \ && apt-get -y install git curl\ && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* # Install MS ODBC Driver for SQL Server RUN curl | apt-key add - \ && curl > /etc/apt/sources.list.d/mssql-release.list \ && apt-get update \ && apt-get -y --no-install-recommends install msodbcsql unixodbc-dev mssql-tools\ && pecl install pdo_sqlsrv-5.8.1 \ && pecl install sqlsrv-5.8.1 \ && echo "extension=pdo_sqlsrv.so" >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini \ && echo "extension=sqlsrv.so" >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-sqlsrv.ini \ && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* # Check installation RUN php -m ``` 7. Click **Save and Build** to build the Docker container from which the Script Executor runs Scripts. The **Build Command Output** setting displays below the **Dockerfile** setting as the Script Executor builds the Docker container in real-time. If the Docker container builds successfully, the following message displays: **Executor Successfully Built. You can now close this window**. If building the Docker container is unsuccessful, the following message displays: **Error Building Executor. See Output Above.**. The **Build Command Output** setting displays the Dockerfile error. 8. Click **Close**. The PHP Script Executor with the SQLSRV module is now available in the list of languages when creating a new script.