我必须在现有的Web主机上设置PHP。 我做了一个虚拟主机条目,但由于某种原因,Apache发送PHP到浏览器,而不是parsing..从谷歌search看起来这是一个与mimetypes的问题,但我不是一个Apache专家,所以如果任何人都可以帮助,将不胜感激…
我在我的httpd.conf中有以下内容:
AddHandler php5-script php DirectoryIndex index.html index.phtml index.php index.phps AddType application/x-httpd-php .phtml AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
PHP模块被加载到Apache中:
/usr/sbin/apachectl -M
加载模块:
core_module (static) mpm_prefork_module (static) http_module (static) so_module (static) auth_basic_module (shared) auth_digest_module (shared) authn_file_module (shared) authn_alias_module (shared) authn_anon_module (shared) authn_dbm_module (shared) authn_default_module (shared) authz_host_module (shared) authz_user_module (shared) authz_owner_module (shared) authz_groupfile_module (shared) authz_dbm_module (shared) authz_default_module (shared) ldap_module (shared) authnz_ldap_module (shared) include_module (shared) log_config_module (shared) logio_module (shared) env_module (shared) ext_filter_module (shared) mime_magic_module (shared) expires_module (shared) deflate_module (shared) headers_module (shared) usertrack_module (shared) setenvif_module (shared) mime_module (shared) dav_module (shared) status_module (shared) autoindex_module (shared) info_module (shared) dav_fs_module (shared) vhost_alias_module (shared) negotiation_module (shared) dir_module (shared) actions_module (shared) speling_module (shared) userdir_module (shared) alias_module (shared) rewrite_module (shared) proxy_module (shared) proxy_balancer_module (shared) proxy_ftp_module (shared) proxy_http_module (shared) proxy_connect_module (shared) cache_module (shared) suexec_module (shared) disk_cache_module (shared) file_cache_module (shared) mem_cache_module (shared) cgi_module (shared) version_module (shared) fcgid_module (shared) perl_module (shared) php5_module (shared) proxy_ajp_module (shared) ssl_module (shared)
这是我的虚拟主机条目:
<VirtualHost 10.16.140.113:80> ServerName viridor-cms.co.uk ServerAlias www.viridor-cms.co.uk UseCanonicalName Off DocumentRoot /var/www/vhosts/viridor-cms.co.uk/httpdocs CustomLog /var/www/vhosts/viridor-cms.co.uk/cms-access_log common ErrorLog /var/www/vhosts/viridor-cms.co.uk/cms-error_log DirectoryIndex index.php index.html <IfModule sapi_apache2.c> php_admin_flag engine on php_admin_flag safe_mode on </IfModule> <IfModule mod_php5.c> php_admin_flag engine on php_admin_flag safe_mode on </IfModule> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </VirtualHost>
请帮忙,我的头痛得要撞在桌子和墙上!
感谢您的回应.. 🙂
我已经添加了你的build议
[警告]模块php5_module已经加载,跳过
停止httpd:[确定]启动httpd:[Mon May 24 15:02:27 2010] [warn]模块php5_module已经加载,跳过[OK]
但服务器仍然在向浏览器发送应用程序/ a-httpd-php文件。
该url是http://viridor-cms.co.uk和本地主机文件条目需要:
89.206.183.89 viridor-cms.co.uk
谢谢 :)
在你的httpd.conf或apache2.conf中添加亲爱的行
<IfModule mod_php5.c> AddType application/x-httpd-php .php .phtml .php3 </IfModule>
&移除addhandler行AddHandler php5-script php
然后重新启动Apache。
Apache将理解PHP引擎将被用于.php扩展名的这一行应用程序/“x-httpd-php”
你是否在不重启Apache的情况下对Apacheconfiguration文件进行了修改?
# /etc/init.d/httpd restart
另外,尝试添加这一行(虽然PHP模块似乎被加载):
LoadModule php5_module modules/libphp5.so
您可能必须将modules / libphp5.soreplace为PHP模块的绝对path。