简体   繁体   English

x-httpd-php5s <-s! 在Bluehost上

[英]x-httpd-php5s <— s! on Bluehost

I'm trying to replicate a web-site on a test-server. 我正在尝试在测试服务器上复制一个网站。 However, on the test-server, .php files don't get interpreted. 但是,在测试服务器上,不会解释.php文件。 I found that the cause is a .htaccess file in the document root. 我发现原因是文档根目录中的.htaccess文件。 Its contents: 其内容:

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
RewriteEngine On
#RewriteRule ^$ index.php [QSA]
RewriteRule ^(.*)$    /web/$1

How do I configure Apache2/PHP5 to support the handler application/x-httpd-php5s ? 如何配置Apache2 / PHP5以支持处理程序application/x-httpd-php5s Is there any software-package which makes this handler available? 是否有任何软件包可使该处理程序可用?

Update: It may be a handler specific to Bluehost.com. 更新:它可能是特定于Bluehost.com的处理程序。 Am currently investigating this... 目前正在对此进行调查...

Update 2: To avoid having to change the .htaccess file, which would introduce inconsistencies, I added a handler "application/x-httpd-php5s" to Apache: 更新2:为避免更改.htaccess文件(这会引入不一致),我向Apache添加了一个处理程序“ application / x-httpd-php5s”:

AddHandler application/x-httpd-php5s .php
Action application/x-httpd-php5s /cgi-bin/php5

However, that handler will not behave as on the production server, where it causes the PHP interpreter to use a php.ini in the document root and use it for all subdirectories. 但是,该处理程序在生产服务器上的行为将不尽如人意,在处理服务器上,该处理程序将导致PHP解释器在文档根目录中使用php.ini并将其用于所有子目录。 A somewhat ugly workaround is, for example, to symlink that php.ini to the global php.ini on the test-server. 例如,某种难看的解决方法是将php.ini符号链接到测试服务器上的全局php.ini

I have been using Bluehost for a long time. 我已经使用Bluehost很长时间了。 What you are talking about is only the php.ini file that gets loaded. 您正在谈论的只是被加载的php.ini文件。

AddHandler application/x-httpd-php5s .php AddHandler应用程序/ x-httpd-php5s .php

Loads a single php.ini file for all sites hosted on there server. 为该服务器上托管的所有站点加载一个php.ini文件。 That php.ini file is usually found in the public_html folder. 通常在public_html文件夹中找到该php.ini文件。

If you change it to; 如果更改为

AddHandler application/x-httpd-php5 .php AddHandler应用程序/ x-httpd-php5 .php

Then the server will look for php.ini in the same folder as your .htaccess file. 然后,服务器将在与.htaccess文件相同的文件夹中查找php.ini。

The "s" at the after the 5 means single. 5后面的“ s”表示单。

AddHandler application/x-httpd-php5s is the source handler. AddHandler application / x-httpd-php5s是处理程序。

All you have to do is change it to AddHandler application/x-httpd-php5 .php 您所要做的就是将其更改为AddHandler application/x-httpd-php5 .php

I have since convinced my client to move away from Bluehost, for performance reasons. 从那以后,出于性能原因,我说服我的客户离开Bluehost。 So it's a non-issue for us now. 因此,这对我们来说现在不是问题。 However, from what I've seen, I am pretty certain that x-httpd-php5s this is a Bluehost specific handler. 但是,根据我所看到的,我可以肯定的是x-httpd-php5s是Bluehost特定的处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM