Linux下的PHP開發環境_PHP教程

來源:互聯網
上載者:User
一、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 donot 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.x3) 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: make6) cp modules/xdebug.so /to/wherever/you/want/it7) 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開發環境

http://www.bkjia.com/PHPjc/440314.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/440314.htmlTechArticle一、Eclipse PHP 先試著安裝Eclipse,遇到各種問題,把workspace目錄放到/var/www/html目錄下,解決了一些問題。但最終還是沒解決。後來又安裝了...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.