• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

index.php not processed (PHP, Apache2)

F

Feldprediger

Guest
Hi,
i've got a very strange problem with a subdomain:
When I open http://subdomain.domain.com/, the Browser (Firefox) prompts the download-window (the server didn't process the index.php) and downloads the index.php but when i open the index.php directly (http://subdomain.domain.com/index.php) all works fine.
So, where is the misconfiguration?
This problem apears only with this one domain, but I can't see anything special in the configurationfiles belong to this domain (the only special is, that it was the first domain, "delivered" with the server ;-)
Any ideas?
Hopefully,
Stephan
 
May there is something special in that index.php (with PHP you may force to download it, instead of parsing it)? May be there is .htaccess file with some ReWrite rules?
 
no, there is no .htaccess file.
it's a standard GroupOffice installation , i had never trouble with.
 
In your apache conf file what is "DirectoryIndex" set to.

The file is located at
/etc/httpd/conf/httpd.conf

on 7.5.1

If index.php is not in there (wasn't in mine on default) then put it there. Restart httpd and try viewing domain again.

Make sure you close all browser windows again before you do just to make sure it forgets the last method it accessed the website.
 
index.php is already existing in the httpd.conf at DirectoryIndex.
I've added a second domain in the virtual host and there is no problem.
There is actually no difference between the configuration for the two domains.
 
May be there is difference in permissions for index.php or directory?
 
the two domains direct to the same index.php. Here is the virtual host config:

<VirtualHost 212.227.49.119:80> ServerName office
ServerAlias office.*
DocumentRoot /home/httpd/vhosts/groupoffice/httpdocs
CustomLog /home/httpd/vhosts/mestrona.de/statistics/logs/access_log combined
ErrorLog /home/httpd/vhosts/mestrona.de/statistics/logs/error_log
ScriptAlias /cgi-bin/ /home/httpd/vhosts/groupoffice/cgi-bin/
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /home/httpd/vhosts/groupoffice/httpdocs>

<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode Off
php_admin_value open_basedir "/home/httpd/vhosts/groupoffice/httpdocs:/home/httpd/vhosts/groupoffice/userdata:/home/httpd/vhosts/groupoffice/tmp:/etc"
</IfModule>
Options +Includes +ExecCGI
</Directory>
Alias "/error_docs" "/home/httpd/vhosts/mestrona.de/error_docs"
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 401 /error_docs/unauthorized.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html
</VirtualHost>

http://office.domain1.com -> download
http://office.domain1.com/index.php -> normal
http://office.domain2.com -> normal
http://office.domain2.com/index.php -> normal
 
I've noticed this in the httpd.include file:

Code:
<IfModule sapi_apache2.c>
     AddType text/plain .php .php4 .php3 .phtml
      php_admin_flag engine off
</IfModule>

I had the same problem with one of my clients with this. I added the following into the domain's vhost.conf file:

Code:
AddType application/x-httpd-php .php .php4 .html

and restarted Apache and that did the trick. I don't know why Plesk adds text/plain for PHP. I always thought it needed AddType application/x-httpd-php. Its strange because all of my PHP files still work fine with text/plain, but this one customer had problems and I don't think he was doing anything not normal in his PHP files.
 
Code:
<IfModule sapi_apache2.c>
     AddType text/plain .php .php4 .php3 .phtml
      php_admin_flag engine off
</IfModule>
this adds plesk to your virtual host (in httpd.include), if php should not be available to your client:
php_admin_flag engine off means that php-files will not be parsed by the webserver and so apache should handle them like textfiles (AddType text/plain .php .php4 .php3)
 
Well.. May be something is screwed in Plesk or somewhere else.. Have you tried to remove that account completely (or was it subdomain?) and create again? Or may be try to disable/enable it (sometimes it could help, because Plesk rebuilds it's config files).
 
I can confirm this works. Had a frontpage domain that was goofed like this. Did a disable/re-enable and apache restart then worked again after that. :)
 
Back
Top