【发布时间】:2011-07-14 08:11:41
【问题描述】:
我一直在阅读有关此主题的其他帖子,尝试了帖子中的建议,但仍然遇到同样的问题。
我可以在外部浏览器中运行我的 php,但不能在 eclipse 浏览器中运行。
htdoc 目录中的工作区。
我也完成了调试器和运行配置。我正在运行 xampp 和 eclipse。
所以在 Eclipse 中我有一个要运行的 php 文件,我选择作为网页运行:
这就是发生的事情。
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again
If you think this is a server error, please contact the webmaster.
Error 404
localhost
7/14/2011 3:49:58 AM
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
我知道问题是路径名:
当路径为http://localhost/PHP2011X/FreelanceProjects/CLKeenan/CLKeenanfrm.php
我得到了 404
但是当我取出 PHP2011X 时,它工作正常。
http://localhost/FreelanceProjects/CLKeenan/CLKeenanfrm.php
作为旁注,PHP2011X 是 eclipse 中的项目名称。
我无法弄清楚如何更改本地 url。 提前感谢您的帮助。
<Directory "C:/xampp/htdocs">
Possible values for the Options directive are "None", "All",
or any combination of:
Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
Note that "MultiViews" must be named *explicitly* --- "Options All"
doesn't give it to you.
The Options directive is both complicated and important. Please see
http://httpd.apache.org/docs/2.2/mod/core.htmloptions
for more information.
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride controls what directives may be placed in .htaccess files.
It can be "All", "None", or any combination of the keywords:
Options FileInfo AuthConfig Limit
AllowOverride All
Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>
DirectoryIndex: sets the file that Apache will serve if a directory
is requested.
<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>
The following lines prevent .htaccess and .htpasswd files from being
viewed by Web clients.
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
ErrorLog: The location of the error log file.
If you do not specify an ErrorLog directive within a <VirtualHost>
container, error messages relating to that virtual host will be
logged here. If you *do* define an error logfile for a <VirtualHost>
container, that host's errors will be logged there and not here.
ErrorLog "logs/error.log"
ScriptLog "logs/cgi.log"
LogLevel: Control the number of messages logged to the error_log.
Possible values include: debug, info, notice, warn, error, crit,
alert, emerg.
LogLevel warn
<IfModule log_config_module>
The following directives define some format nicknames for use with
a CustomLog directive (see below).
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
The location and format of the access logfile (Common Logfile Format).
If you do not define any access logfiles within a <VirtualHost>
container, they will be logged here. Contrariwise, if you *do*
define per-<VirtualHost> access logfiles, transactions will be
logged therein and *not* in this file.
CustomLog "logs/access.log" common
If you prefer a logfile with access, agent, and referer information
(Combined Logfile Format) you can use the following directive.
CustomLog "logs/access.log" combined
</IfModule>
<IfModule alias_module>
Redirect: Allows you to tell clients about documents that used to
exist in your server's namespace, but do not anymore. The client
will make a new request for the document at its new location.
Example:
Redirect permanent /foo http://localhost/bar
Alias: Maps web paths into filesystem paths and is used to
access content that does not live under the DocumentRoot.
Example:
Alias /webpath /full/filesystem/path
If you include a trailing / on /webpath then the server will
require it to be present in the URL. You will also likely
need to provide a <Directory> section to allow access to
the filesystem path.
ScriptAlias: This controls which directories contain server scripts.
ScriptAliases are essentially the same as Aliases, except that
documents in the target directory are treated as applications and
run by the server when requested rather than as documents sent to the
client. The same rules about trailing "/" apply to ScriptAlias
directives as to Alias.
ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"
</IfModule>
<IfModule cgid_module>
ScriptSock: On threaded servers, designate the path to the UNIX
socket used to communicate with the CGI daemon of mod_cgid.
Scriptsock "logs/cgi.sock"
</IfModule>
"C:/xampp/cgi-bin" should be changed to whatever your ScriptAliased
CGI directory exists, if you have that configured.
<Directory "C:/xampp/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DefaultType: the default MIME type the server will use for a document
if it cannot otherwise determine one, such as from filename extensions.
If your server contains mostly text or HTML documents, "text/plain" is
a good value. If most of your content is binary, such as applications
or images, you may want to use "application/octet-stream" instead to
keep browsers from trying to display binary files as though they are
text.
DefaultType text/plain
<IfModule mime_module>
TypesConfig points to the file containing the list of mappings from
filename extension to MIME-type.
TypesConfig "conf/mime.types"
AddType allows you to add to or override the MIME configuration
file specified in TypesConfig for specific file types.
AddType application/x-gzip .tgz
AddEncoding allows you to have certain browsers uncompress
information on the fly. Note: Not all browsers support this.
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
If the AddEncoding directives above are commented-out, then you
probably should define those extensions to indicate media types:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
【问题讨论】:
-
您在使用 PDT 吗?您可能需要手动设置路径映射设置。如果我没记错的话,可以通过服务器配置对话框(Eclipse PDT 定义的 PHP 服务器)来完成
-
是的,我正在使用 PDT,我已经在这些设置中定义了服务器的位置,但仍然遇到此问题。我在这里拔头发。
-
我的天啊,我已经准备好用我的拳头穿过我的显示器了,设置 xampp 与 eclipse 一起工作真的有这么难吗啊啊啊啊啊啊啊!!!!!!
-
我添加了 conf 文件,不确定发生了什么,但我再次发布了。
标签: php eclipse localhost http-status-code-404