linux ubuntu安装php运行环境


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

你可能感兴趣的:(apache,PHP,linux,mysql,shell,ubuntu)