I had to migrate from an old server (Plesk 14; CentOS 5; Apache 2.2; PHP 5.3.5)
to a new one (Plesk Onyx 17; CentOS 7.3; Apache 2.4; PHP 7)
Everything works fine with the exception of the custom Virtual Hosts.
On the old server, in my etc/httpd/conf/httpd.conf
I had the following and it was working:
<VirtualHost XX.XX.XX.XX:80>
DocumentRoot /var/www/vhosts/mycompany.com/httpdocs/myproject
ServerName myproject.com
ServerAlias www.myproject.com
<Directory /var/www/vhosts/mycompany.com/httpdocs/myproject>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode on
</IfModule>
<IfModule mod_php5.c>
php_admin_flag safe_mode off
php_admin_value upload_tmp_dir "/tmp"
php_admin_value session.save_path "/tmp"
</IfModule>
php_admin_flag engine on
AddHandler php5-script .php
</Directory>
</VirtualHost>
If I didn't have the php_admin_flag engine on
and the AddHandler
it would just download the php file as text.
On the new server I tried the exact same and it just downloads the php file.
I also tried adding the following in <Directory>
with no success:
LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so
#Error: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
php_admin_flag engine on
# Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not included in the server configuration
AddType text/html .php
#I used this to make sure AddType works. It does - PHP displayed as HTML
AddType application/x-httpd-php .php
#Downloads the file as text
AddHandler application/x-httpd-php .php
#Downloads the file as text
AddType php5-script .php
#Shows php as plain text
Something worth mentioning is that on this Plesk there are multiple PHP versions. When I do php -v
I get PHP 5.3.5 (cli)
but when I use phpinfo()
in a page I get "PHP Version 7.0.18".
My guess is that it has something to do with that.
On the Admin panel in Plesk it says run PHP 7 as FPS Application
Here's a snapshot of the phpinfo()
https://pste.eu/p/BGpI.html
Any idea what could it be?
Hi Miro,
did you consider to SWITCH from MPM-EVENT to MPM-PREFORK, in order to be able to USE the libapache2 - PHP - module ?
LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so
#Error: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
=> HOME > Tools & Settings > Apache Web Server > ( option ) MPM mode