看到源码是因为你的apache不能解析php代码。
修改apache/conf/httpd.conf,添加下面的内容: ScriptAlias /php/ "E:/php/" //你本机的php的目录
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php/php.exe" 至于文件存放目录,如果你不想放在htdocs下,只要把apache/conf/httpd.conf中的DocumentRoot改成你放php文件的目录即可。如:
DocumentRoot "E:/webroot"关于虚拟目录的设置,可以参考apache/conf/httpd.conf中的设置,照样改一下就可以了。如下:#<VirtualHost *>
# ServerAdmin [email protected]
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>配置好后将前面的注释符号(#)删除就可以了。不过你的情况应该还不需要使用虚拟目录。
修改apache/conf/httpd.conf,添加下面的内容: ScriptAlias /php/ "E:/php/" //你本机的php的目录
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php/php.exe" 至于文件存放目录,如果你不想放在htdocs下,只要把apache/conf/httpd.conf中的DocumentRoot改成你放php文件的目录即可。如:
DocumentRoot "E:/webroot"关于虚拟目录的设置,可以参考apache/conf/httpd.conf中的设置,照样改一下就可以了。如下:#<VirtualHost *>
# ServerAdmin [email protected]
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>配置好后将前面的注释符号(#)删除就可以了。不过你的情况应该还不需要使用虚拟目录。
The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.
--------------------------------------------------------------------------------Apache/2.0.43 Server at localhost Port 80
建议使用Apache 1.3.2x
我用的是apache_2.0.43-win32-x86-no_ssl.exe,不好吗?哪里有Apache 1.3.2x下载?
win下建议使用apache 1.3.2x
Alias /虚拟目录名称/ "G:/实际虚拟目录名称/"
ScriptAlias /php/ "d:/PHP安装目录/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"