因此可以直接在自己的工作空间运行程序,但当用到eclipse3.7和PDT3.0.2的集成时居然不允许在base url栏填写自己工作空间的目录了,网上查阅包括英文仍无办法,因此只得另想办法。
这个版本的PDT只允许填写不同端口号的base url 的服务器,所以我就在nginx另作一个不同于主端口号的服务端口,把这个端口号的主目录定位到eclipse的工作空间,然后把eclipse的php服务器设置为这个端口号,以后在eclipse工作空间的工程都能自动运行了。
于是修改nginx.conf添加以下几行:
#eclipse web port:
#
server {
listen 5000;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root "C:/Program Files/eclipse-php/workspace";
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME c:/PROGRA~1/eclipse-php/workspace$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}
如果你有ssl设置,可以再添加:
server {
listen 5443;
server_name localhost;
ssl on;
ssl_certificate akann.crt;
ssl_certificate_key akann.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
location / {
root "C:/Program Files/eclipse-php/workspace";
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME c:/PROGRA~1/eclipse-php/workspace$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
include fastcgi_params;
}
}
这里记住"C:/Program Files/eclipse-php/workspace"和c:/PROGRA~1/eclipse-php/workspace就是你工作空间的目录,我用的是windows,unix目录自行修改。
另外再修改eclipse的php服务器设置:
一切ok.