Ошибка сопоставления пути веб-сервера Eclipse с проектом PHP

Я читал другие сообщения на эту тему, пробовал то, что было предложено на этом посту, и по-прежнему имеет ту же проблему.

Я могу запустить php во внешнем браузере, но не в браузере eclipse.

Рабочая область в каталоге htdoc.

Я прошел через отладчик и запустил конфигурацию. Я запускаю xampp вместе с eclipse.

Итак, в eclipse у меня есть файл php для запуска. Я выбираю run as webpage:

Вот что происходит.

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 

Добавьте PHP2011X в качестве псевдонима на ваш веб-сервер, поэтому адрес, созданный Eclipse, будет работать.

Другое решение, но я думаю, что Eclipse на самом деле негибкая здесь, заключается в определении сопоставления из путей файла проекта к URL-адресам проекта. Но из того, что я знаю, это действительно негибко, и это не сработало для меня больше всего времени.

Поэтому я бы пошел на настройку веб-сервера. Если вы используете apache, директива называется Alias .

Изменить. Вы можете попытаться установить директиву Alias перед <Directory "C:/xampp/htdocs"> :

 # Map Eclipse Project Name onto webroot (SO #6690405): Alias /PHP2011X "C:/xampp/htdocs" <Directory "C:/xampp/htdocs"> 

Связано: Настройка сопоставления путей в PHP и Eclipse