Heim  >  Artikel  >  Backend-Entwicklung  >  Linux下的PHP开发环境_PHP教程

Linux下的PHP开发环境_PHP教程

WBOY
WBOYOriginal
2016-07-20 11:14:18831Durchsuche

 

一、Eclipse PHP

 

先试着安装Eclipse,遇到各种问题,把workspace目录放到/var/www/html目录下,解决了一些问题。但最终还是没解决。后来又安装了Zend提供的Eclipse,问题依旧。放弃!

 

Installing Eclipse PHP

 

Install Zend plugin:

 

http://code.google.com/p/zend-sdk/wiki/ZendSdkEclipsePlugin

 

 

 

二、NetBeans

 

看到网上有很多网友盛赞netbeans,于是安装了一个

 

1. 安装NetBeans

 

 

 

1)下载sh文件,

 

https://netbeans.org/downloads/

 

2) 执行安装

 

下载完后执行: chmod +x netbeans-7.3-linux.sh; ./ netbeans-7.3-linux.sh;

 

开始安装,提示jdk找不到,后来在/usr/jvm/lib/jd****,找到好几个版本,但netbeans还是提示版本过低。

 

于是:下载了jdk最新版jdk_1.7.0_21。然后一路安装下去。

 

3)运行

 

安装完后,到安装目录(默认:/usr/local/netbeans-7.3/bin/)下,双击netbeans图标启动netbeans

 

4)创建一个PHP项目

 

创建后,source folder默认目录是在/var/www下,而不是/var/www/html,更改httpd conf 文件中有“/var/www/html”的两处,为““/var/www”。即可正常运行。

 

或者不改httpd conf文件,更改项目对应的source folder和project folder也可。

 

 

 

Debuger好像还有点慢,等等看如何,再等很久,还是waiting,呵呵,看来有问题。这么解决:

 

 

 

2. 安装xdebug

 

https://github.com/xdebug/xdebug

 

 

 

1) Unpack the tarball: tar -xzf xdebug-2.2.x.tgz.  Note that you do
not need to unpack the tarball inside the PHP source code tree.
Xdebug is compiled separately, all by itself, as stated above.

2) cd xdebug-2.2.x

3) Run phpize: phpize
   (or /path/to/phpize if phpize is not in your path).

4) ./configure --enable-xdebug (or: ../configure --enable-xdebug
   --with-php-config=/path/to/php-config if php-config is not in your
   path)

5) Run: make

6) cp modules/xdebug.so /to/wherever/you/want/it

7) add the following line to php.ini:
   zend_extension="/wherever/you/put/it/xdebug.so"

 

   #The following is my config:

 

   zend_extension = /usr/lib64/xdebug.so
   xdebug.remote_enable=on
   xdebug.remote_log="/var/log/xdebug.log"
   xdebug.remote_host=localhost
   xdebug.remote_handler=dbgp
   xdebug.remote_port=9000

 


 

8) Restart your webserver.(since php is part of webserver)

9) Write a PHP page that calls "phpinfo();" Load it in a browser and
   look for the info on the xdebug module.  If you see it, you have been
   successful!

 

 

 

按照上述步骤完成后,发现phpinfo页面多了xdeug的表格,表明成功

 

但是遗憾的是netbeans的debug按钮们依然是灰色的。无法debug;查看日志:/var/log/httpd/error_log,发现里面竟然有selinux,到/etc/sysconfig/security里disabled掉selinux,然后重启系统。还是没解决。

 

 

 

把php.ini文件中的端口改为9001,重启httpd;然后把netbeans的端口也改为9001。ok!

 

很奇怪,于是又把php.ini和netbeans--debug--options-php-debug中的端口改回为9000. 也可以正常工作了。

 

至此,netbeans下的php运行,debug都ok。

 

本文转自 Linux下的PHP开发环境

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440314.htmlTechArticle一、Eclipse PHP 先试着安装Eclipse,遇到各种问题,把workspace目录放到/var/www/html目录下,解决了一些问题。但最终还是没解决。后来又安装了...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn