# How to Set the PHP Version per Directory in cPanel

## How to Set the PHP Version per Directory in cPanel

If you want to use different PHP versions for specific directories, cPanel makes this easy using the `.htaccess` file.

### Steps to Set PHP Version per Directory:

* Log in to your cPanel account.
* In the **Software** section, click on **MultiPHP Manager**.

<figure><img src="/files/K5TcYifVNcA3QHm62kzy" alt=""><figcaption></figcaption></figure>

* Scroll down to the bottom of the page. Select your domain from the left side.
* Choose the desired PHP version from the drop-down menu and click on **Apply**.

<figure><img src="/files/eDz3uLcXuTcKePYH3sHR" alt=""><figcaption></figcaption></figure>

* Open the <mark style="color:orange;">`/public_html/.htaccess`</mark> file in the cPanel File Manager. You will find the code generated by cPanel.

<figure><img src="/files/zNUeLHEgkNPCqxo8Auei" alt=""><figcaption></figcaption></figure>

* To set PHP 8 in the directory `forums`, create a `.htaccess` file in the `/forums/` directory and paste the code generated in the previous step.
* **Congratulations!** Your `forums` directory is now using PHP 8. To apply the same PHP version to other directories, simply copy the code from the `.htaccess` file and paste it into the new directory.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clouduxe.com/cpanel-control-panel/how-to-set-the-php-version-per-directory-in-cpanel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
