ubuntu lamp(apache+mysql+php)環境搭建

來源:互聯網
上載者:User


ubuntu lamp(apache+mysql+php)環境搭建 一、環境安裝1.安裝apache2  sudo apt-get install apache2  安裝後在瀏覽器中開啟:http://localhost/或者http://127.0.0.1  如果出現It works!證明apache安裝成功。  www.2cto.com  2.安裝PHP  sudo apt-get install php5  sudo apt-get install libapache2-mod-php5  sudo /etc/init.d/apache2 restart  
 測試:  sudo vi /var/www/testphp.php  寫入php works!儲存退出vi。  然後在瀏覽器中輸入http://127.0.0.1/testphp.php或者http://localhost/testphp.php  如果顯示出php works!表示php配置成功。  3.安裝MYSQL  sudo apt-get install mysql-server  安裝過程中按提示設定root密碼即可。  
 註:修改密碼:  mysql -uroot -p  mysql>use mysql;  mysql>update user set password=PASSWORD('new password') WHERE user='root';  mysql>exit  重啟mysql,或是重新整理許可權也行  重啟即可: sudo /etc/init.d/mysql restart 或是 restart mysql  
 4、讓apache、php支援mysql  sudo apt-get install libapache2-mod-auth-mysql  sudo apt-get install php5-mysql  sudo /etc/init.d/apache2 restart  至此Ubuntu+apache2+php 5+mysql的安裝完成。  提示:  /etc/apache2/下:  1、apache2.conf 是主設定檔,httpd.conf 使用者設定檔  2、虛擬目錄在 httpd.conf 中  DocumentRoot “路徑”  ServerName 名稱  #Listen 127.0.0.1:80 #注意這個檔案中不能寫上監聽,如果必須要寫,那就需要先去apache2.conf下將include /etc/apache2/ports.conf 給注釋掉,因為ports.conf中已經監聽來80連接埠  
 3、目錄設定在 /etc/apache2/sites-enabled/000-default 可以設定虛擬機器主機  4、php.ini: /etc/php5/apache2/php.ini  5、mysql.cnf: /etc/mysql/my.cnf  4、重啟apache : /etc/init.d/apache2 restart  5、重啟mysql: sudo /etc/init.d/mysql restart 或是 restart mysql  6、記錄檔: /var/log/apache2/  
 二、GD庫安裝 sudo apt-get install php5-gd  sudo /etc/init.d/apache2 restart  三、curl擴充安裝   sudo apt-get install php5-curl  sudo /etc/init.d/apache2 restart 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.