成功安裝Mysql+Apache2+php5過程

來源:互聯網
上載者:User
關鍵字 成功安裝Mysql+Apache2+php5過程
下載下列檔案至/usr/local/src/
Apache2.tar.gz
MySQL-5.0.22.tar.gz
php-5.1.2.tar.gz
解壓縮:
#tar xvzf Apache2.tar.gz
#tar xvzf mysql-5.0.22.tar.gz
#tar xvzf php-5.1.2.tar.gz

#cd ..    //在/usr/local/目錄下建立檔案夾
# mkdir apache
# mkdir mysql
# mkdir php

//Mysql安裝過程
#cd ../mysql        //找到/usr/local/mysql檔案夾
#groupadd mysql
#usseradd -g mysql mysql

#cd ../mysql-5.0.22    //找到/usr/local/src/mysql-5.0.22檔案夾
#./configure --PRefix=/usr/local/mysql --localstatedir=/var/lib/mysql/ --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-mysqld-user=mysql --enable-assembler --with-extra-charsets=all
#make ; make install

/usr/local/mysql/bin/mysql_install_db //初始化mysql
           //對mysql進行配置
#chown –R root /usr/local/mysql
#chown –R mysql /var/lib/mysql/
#chgrp –R mysql /usr/local/mysql
#cp support-files/my-medium.cnf /etc/my.cnf

/usr/local/mysql/bin/mysqld_safe –user=mysql &     //啟動mysql

/usr/local/mysql/bin/mysqladmin –u root –p passWord 123   //將密碼改為123
enter password:
       
       //測試一下新密碼
/usr/local/mysql/bin/mysql –u root –p mysql
enter password:               //如果順利的話就能進入mysql了.
   
        
//Apache安裝過程
./configure --prefix=/usr/local/apache --enable-mods=shared=all --enable-module=so --disable-info
make
make install

apache安裝過程中,遇到libiconv.so.2的問題,解決方案如下:
ln –sf /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2

//在視窗欄中敲入本機ip,如果出現著名的羽毛網頁,就算成功了….



//Php安裝過程
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-calendar --with-openssl=/usr/ --with-config-file-path=/usr/local/php
make
make install
cp /usr/local/src/php-5.1.2/php.ini-dist /usr/local/lib/php.ini


#cd usr/local/apache/conf
//然後開啟httpd.conf在相應的地方進行修改
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

DocumentRoot "/usr/local/apache/htdocs"

LoadModule php5_module modules/libphp5.so

//把測試的.php檔案放入/usr/local/apache/htdocs/,在視窗欄中如能開啟頁面,則大功告成了
//常見問題1:ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
//解決方案: 許可權問題
chown -R mysql /var/lib/mysql/
//常見問題2:Warning: MySQL Connection Failed: Can't connect to local MySQL server
// through socket '/tmp/mysql.sock' (111) in /home/httpd/html/show.php on line 9
//解決方案: 將/tmp/mysql.sock link 到 /var/lib/mysql 目錄裡即可:
linux# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
  • 相關文章

    聯繫我們

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