V
V
Vadimqa2021-01-21 10:16:25
PHP
Vadimqa, 2021-01-21 10:16:25

How to make php run as Apache module (centos 8, virtualmin 6.14)?

For many years I didn’t mess with servers, as far as I remember, I used to do it very simply:

AddType application/x-httpd-php .php
#AddHandler fcgid-script .php
#AddHandler fcgid-script .php5
#FCGIWrapper /home/vadya/fcgi-bin/php5.fcgi .php
#FCGIWrapper /home/vadya/fcgi-bin/php5.fcgi .php5


From the panel, as I understand it, this can not be done. Now virtualmin adds virtual hosts in this format:

<VirtualHost 111:80>
    SuexecUserGroup "#1001" "#1001"
    DirectoryIndex index.php index.php4 index.php5 index.htm index.html
    <Directory /home/111/public_html>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch 
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted
    </Directory>
    <Directory /home/111/cgi-bin>
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted    
    </Directory>
    RemoveHandler .php
    RemoveHandler .php7.2
<FilesMatch \.php$>
    SetHandler proxy:fcgi://localhost:8000
</FilesMatch>

</VirtualHost>
<VirtualHost 111:443>
    SuexecUserGroup "#1001" "#1001"
    DirectoryIndex index.php index.php4 index.php5 index.htm index.html
    <Directory /home/111/public_html>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch 
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted
    </Directory>
    <Directory /home/111/cgi-bin>
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted   
    </Directory>
    RemoveHandler .php
    RemoveHandler .php7.2
<FilesMatch \.php$>
    SetHandler proxy:fcgi://localhost:8000
</FilesMatch>
</VirtualHost>

I think you just need to change this line to the correct one: SetHandler proxy:fcgi://localhost:8000
But I might have forgotten some important detail. It's strange, but I couldn't google anything on this issue, maybe I'm getting old)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question