Can't execute PHP files

7 posts / 0 new
Last post
#1 Tue, 06/14/2016 - 15:15
Lisandro1987

Can't execute PHP files

Hi There,

This is the second time that I made a fresh/clean installation of Virtualmin on Ubuntu 16.04 and I had the same problem when I accessed the sub servers that I created.

Rather than run the PHP file the browser download it as a file.

To solve this problem I have to modify the file nano /etc/apache2/sites-available/{subserver}.{user}.conf, delete or comment the line "php_admin_value engine Off" and restart Apache (sudo systemctl restart apache2.service).

Is there any solution to create a new sub server without modify any file?

Regards, Lisandro.

Tue, 06/21/2016 - 15:00
Lisandro1987

To solve this problem I have to modify the file nano /etc/apache2/sites-available/{subserver}.{user}.conf, delete or comment the line "php_admin_value engine Off" and restart Apache (sudo systemctl restart apache2.service).

Is there any solution to create a new sub server without modify any file?

Tue, 06/21/2016 - 15:25
andreychek

Howdy,

The newest install.sh script should resolve that issue on new installations. However, if you're seeing that on existing installs, you may want to ensure that in /etc/apache2/mods-available/php7.0.conf, comment out any line starting with SetHandler, then restart Apache.

Does that resolve your issue?

-Eric

Wed, 06/22/2016 - 12:42
Lisandro1987

Thanks so much for your reply. I commented out these lines on the existing install, the news sub servers I created after that were working fine, but the sub servers created before that were not working. So I had to restore it:

<FilesMatch ".+\.ph(p[3457]?|t|tml)$">
    ### SetHandler application/x-httpd-php >>> commented out
</FilesMatch>
<FilesMatch ".+\.phps$">
    ### SetHandler application/x-httpd-php-source >>> commented out
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(p[3457]?|t|tml|ps)$">
    Require all denied
</FilesMatch>

# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_flag engine Off
    </Directory>
</IfModule>

Is this ok?

Regards, Lisandro.

Fri, 06/24/2016 - 08:10
Lisandro1987

I tried to comment out the line 'php_admin_flag engine Off' but it didn't work...

Fri, 06/24/2016 - 08:16
andreychek

What you shared above in your config file looks good.

What's happening in your existing sub-servers at the moment, same problem as earlier? And do you see any errors in the Apache error logs for them?

-Eric

Thu, 06/30/2016 - 08:36
Lisandro1987

Hi there,

Thanks for your reply. In existing sub-servers the same problem ocurred, the browser try to download the file. I delete the subserver, but I think that the log was:

[Wed Jun 22 14:30:07.554589 2016] [fcgid:warn] [pid 15391] (104)Connection reset by peer: [client 127.0.0.1:52612] mod_fcgid: error reading data from FastCGI server
[Wed Jun 22 14:30:07.554619 2016] [core:error] [pid 15391] [client 127.0.0.1:52612] End of script output before headers: index.php
[Wed Jun 22 14:30:08.212100 2016] [fcgid:warn] [pid 15423] (104)Connection reset by peer: [client 127.0.0.1:52613] mod_fcgid: error reading data from FastCGI server
[Wed Jun 22 14:30:08.212127 2016] [core:error] [pid 15423] [client 127.0.0.1:52613] End of script output before headers: index.php
[Wed Jun 22 14:30:08.537673 2016] [fcgid:warn] [pid 15428] (104)Connection reset by peer: [client 127.0.0.1:52614] mod_fcgid: error reading data from FastCGI server
[Wed Jun 22 14:30:08.537705 2016] [core:error] [pid 15428] [client 127.0.0.1:52614] End of script output before headers: index.php
[Wed Jun 22 14:31:04.335011 2016] [fcgid:warn] [pid 15952] (104)Connection reset by peer: [client 127.0.0.1:52670] mod_fcgid: error reading data from FastCGI server
[Wed Jun 22 14:31:04.335065 2016] [core:error] [pid 15952] [client 127.0.0.1:52670] End of script output before headers: index.php
[Wed Jun 22 14:54:05.462339 2016] [fcgid:warn] [pid 19304] (104)Connection reset by peer: [client 127.0.0.1:52891] mod_fcgid: error reading data from FastCGI server
[Wed Jun 22 14:54:05.462391 2016] [core:error] [pid 19304] [client 127.0.0.1:52891] End of script output before headers: index.php
[Wed Jun 22 14:54:05.530465 2016] [fcgid:warn] [pid 19305] (104)Connection reset by peer: [client 127.0.0.1:52892] mod_fcgid: error reading data from FastCGI server
[Wed Jun 22 14:54:05.530512 2016] [core:error] [pid 19305] [client 127.0.0.1:52892] End of script output before headers: index.php
[Wed Jun 22 14:54:06.286959 2016] [fcgid:warn] [pid 19306] (104)Connection reset by peer: [client 127.0.0.1:52904] mod_fcgid: error reading data from FastCGI server
[Wed Jun 22 14:54:06.287012 2016] [core:error] [pid 19306] [client 127.0.0.1:52904] End of script output before headers: index.php

Regards, Lisandro.

Topic locked