歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu下Netbeans+PHP開發環境的配置

Ubuntu下Netbeans+PHP開發環境的配置

日期:2017/2/28 16:05:00   编辑:Linux教程

最近才發現,原來Netbeans真的很強大,也很好用。作業要求做一個網站,卻只字不提IDE的選用,看來本意是要我們用notepad++了。

本著一切項目都在Linux下做的原則,我裝了Netbean Linux版。之後遇到各種不順,耐著性子從網上找到解決方案,總結成這篇日志。

相關閱讀:Ubuntu 10.04 下安裝 NetBeans 最新版全程圖解 http://www.linuxidc.com/Linux/2010-06/26861.htm

PHP環境搭建

打開terminal, 安裝一系列軟件,指令如下。
  1. sudo apt-get install apache2 // 安裝apache web server
  2. sudo apt-get install mysql-server // 安裝mysql server
  3. sudo apt-get install php5 // 安裝php5
  4. sudo apt-get install php5-mysql // 安裝mysql extension for php5
  5. sudo apt-get install php5-xdebug // 安裝xDebug extension for php5

裝完之後,在浏覽器地址欄輸入: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的文件,內容為

  1. <?php
  2. phpinfo();
  3. ?>
這時刷新浏覽器會看到


為了啟用debug功能,需要用root權限修改這個文件:/etc/php5/conf.d/xdebug.ini

在文件裡加入一行:xdebug.remote_enable=on

再次重啟apache web server:sudo /etc/init.d/apache2 restart

到這一步php環境搭建完畢,接下來要進行netbeans的設置了。

Copyright © Linux教程網 All Rights Reserved