Eclipse webserver路径映射问题与PHP项目 [英] Eclipse webserver path mapping issue with PHP project
问题描述
我一直在阅读关于这个主题的其他帖子,尝试了在帖子中提出的建议,并且仍然有同样的问题。
我可以运行我的php外部浏览器,但不在eclipse浏览器中。
htdoc目录中的工作区。
我已经走了通过调试器和运行配置。我正在运行xampp和eclipse。
所以在eclipse中我有一个php文件运行我选择作为网页运行:
这是发生了什么。
找不到对象!
在此服务器上找不到请求的URL。如果您手动输入了URL,请检查您的拼写,然后重试
如果您认为这是服务器错误,请联系网站管理员。
错误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中的项目名称。 p>
我无法弄清楚如何更改本地网址。
提前感谢任何帮助。
< DirectoryC:/ xampp / htdocs>
Options指令的可能值为None,All,
或以下任意组合:
索引包括FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
请注意,MultiViews必须明确命名* ---所有选项
不给它。
Options指令既复杂又重要。有关更多信息,请参阅
http://httpd.apache.org/docs/2.2/mod/core.htmloptions
。
选项索引FollowSymLinks包括ExecCGI
AllowOverride控制在.htaccess文件中放置的指令。
它可以是全部,无或任何组合的关键字:
选项FileInfo AuthConfig限制
AllowOverride全部
控制谁可以从这个服务器获取东西。
订单允许,拒绝
允许从所有
< / Directory>
DirectoryIndex:如果请求一个目录
,则设置Apache将提供的文件。
< 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>
以下行阻止.htaccess和.htpasswd文件从
被Web客户端查看。
< FilesMatch^ \.ht>
订单允许,拒绝
全部拒绝
满足所有
< / FilesMatch>
ErrorLog:错误日志文件的位置。
如果您不在< VirtualHost>中指定ErrorLog指令
容器,与该虚拟主机相关的错误消息将在这里记录
。如果您*为*< VirtualHost>定义错误日志文件
容器,该主机的错误将被记录在那里,而不在这里。
ErrorLoglogs / error.log
ScriptLoglogs / cgi.log
LogLevel:消息记录到error_log。
可能的值包括:debug,info,notice,warn,error,crit,
alert,emerg。
LogLevel warn
< IfModule log_config_module>
以下指令定义了一些用于
一个CustomLog指令的格式昵称(见下文)。
LogFormat%h%l%u%t \%r \%> s%b \%{Referer} i \\%{代理} i\组合
LogFormat%h%l%u%t \%r\%> s%bcommon
< IfModule logio_module> ;
您需要启用mod_logio.c才能使用%I和%O
LogFormat%h%l%u%t \%r \%> s%b \% {Referer} i\\%{User-Agent} i\%I%Ocombinedio
< / IfModule>
访问日志文件的位置和格式(通用日志文件格式)。
如果您没有在< VirtualHost>内定义任何访问日志文件
容器,他们将被记录在这里。相反,如果你* * * b $ b定义per-< VirtualHost>访问日志文件,交易将在
中记录,*不*在此文件中。
CustomLoglogs / access.logcommon
如果您喜欢具有访问,代理和参考信息的日志文件
(组合日志文件格式)可以使用以下指令。
CustomLoglogs / access.log组合
< / IfModule>
< IfModule alias_module>
重定向:允许您告知客户端您的服务器的命名空间中存在用于
的文档,但不再需要。客户端
将在新位置对文档发出新的请求。
示例:
重定向永久/ foo http:// localhost / bar
别名:将web路径映射到文件系统路径,用于
访问不在DocumentRoot下的内容。
示例:
别名/ webpath / full / filesystem / path
如果您包含一个尾随/ on / webpath,那么服务器将
要求它存在于网址。您也可能
需要提供< Directory>部分允许访问
文件系统路径。
ScriptAlias:它控制哪些目录包含服务器脚本。
ScriptAliases基本上与别名相同,只是目标目录中的
文件被视为应用程序,
由服务器在请求时运行,而不是发送到
客户端的文档。关于尾随/的相同规则适用于与Alias相关的ScriptAlias
伪指令。
ScriptAlias / cgi-bin /C:/ xampp / cgi-bin /
< / IfModule>
< IfModule cgid_module>
ScriptSock:在线程服务器上,指定用于与mod_cgid的CGI守护进程通信的UNIX
套接字的路径。
Scriptsocklogs / cgi.sock
< / IfModule>
C:/ xampp / cgi-bin应该更改为任何ScriptAliased
CGI目录存在,如果您已配置。
<目录C:/ xampp / cgi-bin>
AllowOverride无
选项无
订单允许,拒绝
允许从所有
< / Directory>
DefaultType:服务器将用于文档
的默认MIME类型,如果无法另行确定,如文件扩展名。
如果您的服务器主要包含文本或HTML文档,text / plain是
一个很好的值。如果您的大部分内容是二进制的,例如应用程序
或图像,您可能需要使用应用程序/八位字节流,而不是
使浏览器尝试显示二进制文件,就像
文字。
DefaultType text / plain
< IfModule mime_module>
TypesConfig指向包含从
文件扩展名到MIME类型的映射列表的文件。
TypesConfigconf / mime.types
AddType允许您添加或覆盖TypesConfig中为特定文件指定的MIME配置
文件类型。
AddType应用程序/ x-gzip .tgz
AddEncoding允许您使某些浏览器免费解压缩
信息。注意:并不是所有浏览器都支持这一点。
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
如果上面的AddEncoding指令被注释掉,那么你
可能应该定义这些扩展以指示媒体类型:
AddType应用程序/ x-compress .Z
AddType应用程序/ x-gzip .gz .tgz
添加 PHP2011X
作为您的网络服务器上的别名,所以Eclipse生成的地址确实有效。
另一个解决方案,但我认为Eclipse在这里真的很不灵活,是定义从项目文件路径到项目URL的映射路径。但是从我所知道的那个真的很僵硬,对我来说这并没有大部分时间。
所以我会去配置网络服务器。如果您使用apache,该指令称为别名
。
编辑: I've been reading through the other posts on this topic tried what was suggested in the post and still having the same issue. I can run my php in an external browser but not in the eclipse browser. The workspace in the htdoc directory. I have gone through the debugger and Run Configurations as well. I'm running xampp along with eclipse. So in eclipse I have a php file to run I select run as webpage: This is what happens. I know what the problem is it's the path name:
when the path is As a side note the PHP2011X is the project name in eclipse. I haven't been able to figure out how to change the local url.
Thanks in advance for any help.
Add Another solution, but I think Eclipse is really inflexible here, is to define a mapping from the project file paths to project URL paths. But from what I know that is really inflexible and it didn't work most time for me. So I would go with configuring the webserver instead. If you're using apache, the directive is called Edit:
You can try to place an Alias directive before the Related: Setting up path mapping in PHP and Eclipse 这篇关于Eclipse webserver路径映射问题与PHP项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
您可以尝试在 < DirectoryC:/ xampp / htdocs>
行之前放置Alias指令:<将Eclipse项目名称映射到webroot(SO#6690405)上:
别名/ PHP2011XC:/ xampp / htdocs
< DirectoryC:/ xampp / htdocs>
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
I get the 404
but when I take out PHP2011X it works fine.http://localhost/FreelanceProjects/CLKeenan/CLKeenanfrm.php
<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
PHP2011X
as an alias on your webserver, so the address generated by Eclipse does work.Alias
.<Directory "C:/xampp/htdocs">
line:# Map Eclipse Project Name onto webroot (SO #6690405):
Alias /PHP2011X "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">