# Different php version for directory

**URL:** <https://forum.hestiacp.com/t/different-php-version-for-directory/4838>\
**Category:** Community Support\
**Created:** [November 1, 2021, 12:37pm UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838 "2021-11-01T12:37:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hansjj](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/h/76d3ee/32.png) [@hansjj](https://forum.hestiacp.com/u/hansjj)\
**Post date:** [November 1, 2021, 12:37pm UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838/1 "2021-11-01T12:37:04Z")

</div>

Hello, right now it is possible to have different versions of PHP installed on the server, however, my question is whether it can be forced in a particular directory to be able to use a specific PHP version.

Let’s imagine that for the domain [www.domain.com](http://www.domain.com), the PHP version is 7.4, but there is a folder within that domain, where version 8.0 is required. Is it possible to do it perhaps by forcing the loading of said version of PHP with some .htaccess?

Thanks

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [November 1, 2021, 12:56pm UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838/2 "2021-11-01T12:56:38Z")

</div>

It might work with a special apache2 / nginx config  
We do the same for phpmyadmin config.

> <https://github.com/hestiacp/hestiacp/blob/main/install/deb/pma/apache.conf>

---

<div class="post-metadata">

**Author:** ![hansjj](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/h/76d3ee/32.png) [@hansjj](https://forum.hestiacp.com/u/hansjj)\
**Post date:** [November 2, 2021, 10:40am UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838/3 "2021-11-02T10:40:30Z")

</div>

puff…very complex (i think…), i’m plesk with openlitespeed it’s very easy:

For php7.4  
\<FilesMatch “.(php4|php5|php3|php2|php|phtml)$”\>  
SetHandler x-httpd-lsphp-74

For php7.3  
\<FilesMatch “.(php4|php5|php3|php2|php|phtml)$”\>  
SetHandler x-httpd-lsphp-73

For php7.2  
\<FilesMatch “.(php4|php5|php3|php2|php|phtml)$”\>  
SetHandler x-httpd-lsphp-72

any solution similar is it possible?  
Thanks

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [November 2, 2021, 10:41am UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838/4 "2021-11-02T10:41:40Z")

</div>

It should be possible if you are using apache…

You can try it offcourse

---

<div class="post-metadata">

**Author:** ![hansjj](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/h/76d3ee/32.png) [@hansjj](https://forum.hestiacp.com/u/hansjj)\
**Post date:** [November 2, 2021, 11:01am UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838/5 "2021-11-02T11:01:58Z")

</div>

i’ve this error with this:

[Tue Nov 02 11:55:26.354787 2021] [proxy:error] [pid 606318:tid 140280174982912] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.4-fpm.sock (\*) failed

```auto
<IfModule !mod_php7.c>
    <FilesMatch ".+\.ph(ar|p|tml)$">
        SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
    </FilesMatch>
</IfModule>

```

---

<div class="post-metadata">

**Author:** ![hansjj](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/h/76d3ee/32.png) [@hansjj](https://forum.hestiacp.com/u/hansjj)\
**Post date:** [November 10, 2021, 9:15am UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838/6 "2021-11-10T09:15:40Z")

</div>

hi, any @admin can help me with this?  
Thanks

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [November 10, 2021, 6:03pm UTC](https://forum.hestiacp.com/t/different-php-version-for-directory/4838/7 "2021-11-10T18:03:10Z")

</div>

Default folder is /var/run/php/
