• 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

Resolved php files rendering shown as text after migration

ibertrix

New Pleskian
We have migrated domains from one server to another. Same onyx configuration with Apache but Nginx disabled:

Product version: Plesk Onyx 17.5.3 Update #50
Update date: 2018/06/07 06:25
Build date: 2017/03/17 16:00
OS version: Ubuntu 16.04
Revision: 55d1b49a272f44666e1920eca8b6e4da449a38cd
Architecture: 64-bit
Wrapper version: 1.2

All domains have been successfully migrated and work with no intervention but there are two domains that are interpreting html files well but php files are shown as text.

In the logs I get:

[Thu Jun 07 15:47:54.304326 2018] [fcgid:warn] [pid 53051] [client xxx.xxx.xxx.xxx:52988] mod_fcgid: stderr: PHP Fatal error: Class 'XTemplate' not found in /var/www/vhosts/mydomain.com/httpdocs/Plano.php on line 6, referer: http://mydomain.com/index0.html

I have checked the httpd.conf file under /var/www/vhosts/system/mydomain.com/conf and I don´t see any difference between configurations from old server and new server.

I have read around articles from KB and this forum but I don´t see where the issue is.
 
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS

GENERATED.
#IF YOU REQUIRE TO APPLY CUSTOM MODIFICATIONS, PERFORM THEM IN THE

FOLLOWING FILES:
#/var/www/vhosts/system/mydomain.com/conf/vhost.conf
#/var/www/vhosts/system/mydomain.com/conf/vhost_ssl.conf
<IfModule mod_ssl.c>

<VirtualHost 111.111.111.111:443 >
ServerName "mydomain.com:443"
ServerAlias "www.mydomain.com"
ServerAlias "ipv4.mydomain.com"
ServerAdmin "[email protected]"
UseCanonicalName Off

DocumentRoot "/var/www/vhosts/mydomain.com/httpdocs"
CustomLog

/var/www/vhosts/system/mydomain.com/logs/access_ssl_log plesklog
ErrorLog

"/var/www/vhosts/system/mydomain.com/logs/error_log"

<IfModule mod_suexec.c>
SuexecUserGroup "generalcourier" "psacln"
</IfModule>
<IfModule mod_userdir.c>

UserDir

"/var/www/vhosts/mydomain.com/web_users/*"
</IfModule>

<IfModule mod_sysenv.c>

SetSysEnv PP_VHOST_ID "59e97482-b25f-4e7b-bdb2-1bb3c4c9e4e0"
</IfModule>
Alias "/plesk-stat"

"/var/www/vhosts/system/mydomain.com/statistics"
<Location /plesk-stat/>
Options +Indexes </Location>
<Location /plesk-stat/logs/>

Require valid-user
</Location> Alias /webstat

/var/www/vhosts/system/mydomain.com/statistics/webstat

Alias /webstat-ssl

/var/www/vhosts/system/mydomain.com/statistics/webstat-ssl

Alias /ftpstat

/var/www/vhosts/system/mydomain.com/statistics/ftpstat

Alias /anon_ftpstat

/var/www/vhosts/system/mydomain.com/statistics/anon_ftpstat
Alias /awstats-icon /usr/share/awstats/icon

SSLEngine on SSLVerifyClient none
SSLCertificateFile

/opt/psa/var/certificates/certD7ULavP

<IfModule mod_fcgid.c>

FcgidInitialEnv PP_CUSTOM_PHP_INI

/var/www/vhosts/system/mydomain.com/etc/php.ini

FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php56-fastcgi
FcgidMaxRequestLen 134217728
</IfModule>

<Directory /var/www/vhosts/mydomain.com/httpdocs>

<IfModule mod_fcgid.c>

<Files ~ (\.fcgi$)>
SetHandler fcgid-script

Options +ExecCGI
</Files>

</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.php$)>
SetHandler fcgid-script

FCGIWrapper /var/www/cgi-

bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
</Files>
</IfModule>

SSLRequireSSL

Options -Includes -ExecCGI

</Directory>
<Directory

"/var/www/vhosts/system/mydomain.com/statistics">
AuthType Basic
AuthName "EstadÃsticas de dominio"

AuthUserFile

"/var/www/vhosts/system/mydomain.com/pd/d..httpdocs@plesk-stat"
require valid-user
</Directory>

Alias /error_docs

/var/www/vhosts/mydomain.com/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
ErrorDocument 405 /error_docs/method_not_allowed.html
ErrorDocument 406 /error_docs/not_acceptable.html
ErrorDocument 407

/error_docs/proxy_authentication_required.html
ErrorDocument 412

/error_docs/precondition_failed.html
ErrorDocument 414

/error_docs/request_uri_too_long.html
ErrorDocument 415

/error_docs/unsupported_media_type.html
ErrorDocument 501 /error_docs/not_implemented.html
ErrorDocument 502 /error_docs/bad_gateway.html

ErrorDocument 503 /error_docs/maintenance.html
DirectoryIndex "index.html" "index.cgi" "index.pl"

"index.php" "index.xhtml" "index.htm" "index.shtml"

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www

\.generalcourier\.eu$ [NC]
RewriteRule ^(.*)$ https://mydomain.com$1

[L,R=301]
</IfModule>

<Directory /var/www/vhosts/mydomain.com>

AllowOverride AuthConfig FileInfo Indexes Limit

Options=Indexes,SymLinksIfOwnerMatch,MultiViews,FollowSymLinks,ExecCG

I,Includes,IncludesNOEXEC
</Directory>

<IfModule mod_headers.c>
</IfModule>

</VirtualHost>

</IfModule>

<VirtualHost 111.111.111.111:80 >
ServerName "mydomain.com:80" ServerAlias

"www.mydomain.com"
ServerAlias "ipv4.mydomain.com"
ServerAdmin "[email protected]"
UseCanonicalName Off

DocumentRoot "/var/www/vhosts/mydomain.com/httpdocs"

CustomLog /var/www/vhosts/system/mydomain.com/logs/access_log

plesklog
ErrorLog "/var/www/vhosts/system/mydomain.com/logs/error_log"
<IfModule mod_suexec.c>
SuexecUserGroup "generalcourier" "psacln"
</IfModule>

<IfModule mod_userdir.c>

UserDir "/var/www/vhosts/mydomain.com/web_users/*"
</IfModule>

<IfModule mod_sysenv.c>
SetSysEnv PP_VHOST_ID "59e97482-b25f-4e7b-bdb2-

1bb3c4c9e4e0"
</IfModule>

Redirect permanent /plesk-stat https://mydomain.com/plesk-

stat
Redirect permanent /webstat https://mydomain.com/webstat
Redirect permanent /webstat-ssl

https://mydomain.com/webstat-ssl
Redirect permanent /ftpstat https://mydomain.com/ftpstat
Redirect permanent /anon_ftpstat

https://mydomain.com/anon_ftpstat
Redirect permanent /awstats-icon

https://mydomain.com/awstats-icon

<IfModule mod_ssl.c>
SSLEngine off
</IfModule>

<IfModule mod_fcgid.c> FcgidInitialEnv

PP_CUSTOM_PHP_INI /var/www/vhosts/system/mydomain.com/etc/php.ini
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX plesk-php56-

fastcgi
FcgidMaxRequestLen 134217728
</IfModule>

<Directory /var/www/vhosts/mydomain.com/httpdocs>

<IfModule mod_fcgid.c>
<Files ~ (\.fcgi$)>
SetHandler fcgid-script
Options +ExecCGI
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.php$)>
SetHandler fcgid-script

FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper

.php
Options +ExecCGI
</Files>
</IfModule>
Options -Includes -ExecCGI

</Directory>

<Directory "/var/www/vhosts/system/mydomain.com/statistics">
AuthType Basic
AuthName "EstadÃsticas de dominio"

AuthUserFile

"/var/www/vhosts/system/mydomain.com/pd/d..httpdocs@plesk-stat"
require valid-user
</Directory>

Alias /error_docs /var/www/vhosts/mydomain.com/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
ErrorDocument 405 /error_docs/method_not_allowed.html
ErrorDocument 406 /error_docs/not_acceptable.html
ErrorDocument 407

/error_docs/proxy_authentication_required.html
ErrorDocument 412 /error_docs/precondition_failed.html
ErrorDocument 414 /error_docs/request_uri_too_long.html
ErrorDocument 415 /error_docs/unsupported_media_type.html
ErrorDocument 501 /error_docs/not_implemented.html
ErrorDocument 502 /error_docs/bad_gateway.html
ErrorDocument 503 /error_docs/maintenance.html
DirectoryIndex "index.html" "index.cgi" "index.pl"

"index.php" "index.xhtml" "index.htm" "index.shtml" <IfModule

mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.generalcourier\.eu$

[NC]
RewriteRule ^(.*)$ http://mydomain.com$1 [L,R=301]
</IfModule>

<Directory /var/www/vhosts/mydomain.com>

AllowOverride AuthConfig FileInfo Indexes Limit

Options=Indexes,SymLinksIfOwnerMatch,MultiViews,FollowSymLinks,ExecCG

I,Includes,IncludesNOEXEC
</Directory>

<IfModule mod_headers.c>
</IfModule>

</VirtualHost>
 
- Are you using the exact same PHP settings as on the old server?
- When you run the "phpinfo" link from the Plesk PHP settings page (to the right of the drop down box where you can select the PHP service to use), does this display the phpinfo content correctly or does this fail, too?
- On Tooles & Settings > General > PHP Settings: Are all the PHP versions activated?
- Do your script files start with "<?php", or do some only start with "<?"?
 
1.- Which PHP settings do you refer? I use fastcgi in both and php 5.5 (I tried also with 5.6 and 7.0)
2- It works. I created an individual phpinfo.php too in each site.
3.- What do you mean? I see several PHP versions available.
4.- <?php

After more careful check, it´s not showing the content of the php file but what it seems part of the XTemplate class. This is the start of what I am getting what I am getting:

14-march-2001 latest stable & CVS version always available @ PHP XTemplate tested with php 3.0.11 and 4.0.4pl1 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details at GNU Lesser General Public License v3.0 - GNU Project - Free Software Foundation You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. $Id: xtpl.p,v 1.1 2004/01/03 11:58:18 imanzano Exp $ */ /***[ variables ]***********************************************************/ var $filecontents=""; /* raw contents of template file */ var $blocks=array(); /* unparsed blocks */ var $parsed_blocks=array(); /* parsed blocks */ var $block_parse_order=array(); /* block parsing order for recursive parsing (sometimes reverse:) */ var $sub_blocks=array(); /* store sub-block names for fast resetting */ var $VARS=array(); /* variables array */ var $file_delim="/\{FILE\s*\"([^\"]+)\"\s*\}/m"; /* regexp for file includes */ var $block_start_delim=""; /* block end delimiter */ var $block_start_word="BEGIN:"; /* block start word */ var $block_end_word="END:"; /* block end word */ /* this makes the delimiters look like: if you use my syntax. */ var $NULL_STRING=array(""=>""); /* null string for unassigned vars */ var $NULL_BLOCK=array(""=>""); /* null string for unassigned blocks */ var $mainblock=""; var $ERROR="";
 
3. I meant whether some of the PHP versions are installed but inactive (you can see that by the gray or green dot. Green = active.

But never mind, it is definitely not a PHP issue, but an issue with your content file. I suggest to look at error_log as this will probably contain a number of logged PHP errors that can help narrowing the issue down to the root cause.
 
The only error I am getting on error_log I have already pasted it here:

[Thu Jun 07 15:47:54.304326 2018] [fcgid:warn] [pid 53051] [client xxx.xxx.xxx.xxx:52988] mod_fcgid: stderr: PHP Fatal error: Class 'XTemplate' not found in /var/www/vhosts/mydomain.com/httpdocs/Plano.php on line 6, referer: http://mydomain.com/index0.html
 
It seems that your website is not installed properly. Make sure that all your website files and directories are in place where they belong.
 
Ok, I got it! xtpl.p Xtemplate class referred was starting with <? instead of <?php.

You gave me the clue! Thanks!
 
Back
Top