PHP没有在Apache上的VirtualHost中运行

时间:2017-04-22 00:57:03

标签: php linux apache centos plesk

我必须从旧服务器Parallel.ForEach(...)迁移到新服务器(Plesk 14; CentOS 5; Apache 2.2; PHP 5.3.5)

除自定义虚拟主机外,一切正常。

在旧服务器上,在(Plesk Onyx 17; CentOS 7.3; Apache 2.4; PHP 7)我有以下内容并且它正在运行:

etc/httpd/conf/httpd.conf

如果我没有<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> php_admin_flag engine on,那么只需将php文件下载为文本。

在新服务器上,我尝试了完全相同,它只是下载php文件。

我还尝试在AddHandler中添加以下内容但没有成功:

<Directory>

值得一提的是,在这个Plesk上有多个PHP版本。当我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 时,我得到php -v但是当我在页面中使用PHP 5.3.5 (cli)时,我会得到&#34; PHP版本7.0.18&#34;。

我的猜测是它与此有关。

在Plesk的“管理员”面板上,它显示phpinfo()

plesk-php-fpm

这是run PHP 7 as FPS Application https://pste.eu/p/BGpI.html

的快照

知道它会是什么吗?

1 个答案:

答案 0 :(得分:1)

嗨Miro,

你是否考虑过从MPM-EVENT到MPM-PREFORK的SWITCH,以便能够使用libapache2-PHP模块?

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.

<强> =&GT; HOME&gt;工具&amp;设置&gt; Apache Web服务器&gt; (选项)MPM模式