custom virtualhost configuration for php website

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hostsp
    Junior Member
    • Jul 2025
    • 3

    #1

    custom virtualhost configuration for php website

    Hello, I am trying to configure custom virtualhost on cloudlinux 10 without any panel here the configuration but when i check domain example.com/index.php instead of executing php code it showing php source code in browser. what correct configuration will execute php in browser

    <VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/html/example



    <Directory /var/www/html/example>
    Options +ExecCGI
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>


    # Load alt-PHP 8.1
    <FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
    SetHandler application/x-lsphp81
    </FilesMatch>


    </VirtualHost>
  • bogdan.sh
    Administrator
    • Nov 2016
    • 1265

    #2
    Hello,

    Do you have the mod_lsapi installed? I guess you are just missing the php handler for the SetHandler application/x-lsphp81 definition. The easiest way to check if the file exist, e.g.:

    HTML Code:
    /opt/alt/php81/usr/bin/lsphp -v

    Comment

    Working...