linuxubuntu安裝php執行環境

填坑大人發表於2011-08-22

1. 下載

  1. 下載apache。http://httpd.apache.org/。因為我想安裝2.2.9,去這裡下載:http://archive.apache.org/dist/httpd/
  2. 下載php。http://www.php.net/downloads.php
  3. Mysql。http://dev.mysql.com/downloads/mysql/5.1.html。可能是ubuntu 10.04沒有安裝rpm,所以我下載了這個二進位制分發版安裝:mysql-5.1.58-linux-i686-glibc23.tar.gz

2. 安裝

1. 安裝apache

參考INSTALL檔案

     $ ./configure –prefix=/opt/apache
     $ make
     $ make install
     $ /opt/apache/bin/apachectl start #執行

在瀏覽器開啟:http://localhost/,顯示 “It works”,安裝成功。

2. 安裝mysql

使用二進位制分發版安裝

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /opt
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe –user=mysql &

更改許可權和密碼:

shell> mysql -uroot

shell> SET PASSWORD FOR “@`localhost` = PASSWORD(`newpwd`);

shell> SET PASSWORD FOR `root`@`localhost` = PASSWORD(`newpwd`);

3. 安裝php

shell> ./configure –prefix=/opt/php –with-apxs2=/opt/apache/bin/apxs –with-mysql=/opt/mysql –with-config-file-path=/opt/php/etc –enable-soap

shell>  make

shell>  make install

3. 附

  1. 錯誤“configure: error: xml2-config not found. Please check your libxml2 installation.”。解決辦法:從ftp://xmlsoft.org/libxml2/下載並安裝libxml2


相關文章