简体   繁体   中英

php5 running as Apache module gives error 400 (bad request)

server config: VPS with Centos6.5 + Apache2.2 prefork + Php5.3

My server has now Php running as cgi, and I'd like to add another handler for .php5 files to be executed as Apache module, so part of my php.conf looks like below:

LoadModule php5_module modules/libphp5.so
AddHandler application/x-httpd-php .php5
Action application/x-httpd-php modules/libphp5.so
AddType application/x-httpd-php .php5

Php5_module is loaded:

httpd -M | grep php5 httpd -M | grep php5 gives php5_module

Then when I try run any script (phpinfo for tests) it gives me 400 bad request .

At the same time .php scripts are running fine as cgi.

Apache error_log isn't helpful, it just says:

[error] [client x.x.x.x] Invalid URI in request GET /phpinfo.php5 HTTP/1.1

I spent hours looking for solution, but found nothing...
What am I missing??

I had a similar problem (a 400 Bad Request error), and what fixed it for me was removing the underscore from ServerName ... ie sub_domain.localhost does not work, but subdomain.localhost does.

This answer solved it for me: https://unix.stackexchange.com/a/404946

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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