最近才發現,原來Netbeans真的很強大,也很好用。作業要求做一個網站,卻只字不提IDE的選用,看來本意是要我們用notepad++了。
本著一切項目都在Linux下做的原則,我裝了Netbean Linux版。之後遇到各種不順,耐著性子從網上找到解決方案,總結成這篇日志。
相關閱讀:Ubuntu 10.04 下安裝 NetBeans 最新版全程圖解 http://www.linuxidc.com/Linux/2010-06/26861.htm
裝完之後,在浏覽器地址欄輸入:http://localhost
回車,顯示
為了能從localhost訪問本地網頁文件,需要啟用Apache server的userdir module,終端輸入:a2enmod userdir
創建public_html文件夾以存放網頁文件:mkdir public_html
重啟Apache web server,在root權限下輸入:/etc/init.d/apache2 restart
這時,在浏覽器地址欄輸入http://localhost/~programmer/ (這裡的programmer是ubuntu的用戶名,需要手動更改)會出現
在public_html文件夾下新建一個名叫index.php的文件,內容為
為了啟用debug功能,需要用root權限修改這個文件:/etc/php5/conf.d/xdebug.ini
在文件裡加入一行:xdebug.remote_enable=on
再次重啟apache web server:sudo /etc/init.d/apache2 restart
到這一步php環境搭建完畢,接下來要進行netbeans的設置了。