Apache
yum install -y zlib zlib-devel apr* gcc gcc-c++
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.27.tar.gz
tar zxvf httpd-2.2.27.tar.gz
cd httpd-2.2.27
./configure --prefix=/application/apache2.2.27 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite
make
make install
ln -s /application/apache2.2.27/ /application/apache
/application/apache/bin/apachectl -t
/application/apache/bin/apachectl graceful
Netstat –lnt|grep 80
Ps –ef|grep http
------------------------------------------------------------------------------------------
mysql5.1
groupadd mysql
useradd mysql -g mysql -M -s /sbin/nologin
yum install -y ncurses-devel
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
#--with-plugin-PLUGIN \
make
make install
-------------------如果mysql不在同一台机器上,到些为止-----------------------------------------------
ln -s /application/mysql5.1.72 /app/mysql
cp mysql/support-files/my-small.cnf /etc/my.cnf
mkdir -p /application/mysql/data
chown -R mysql.mysql /app/mysql
chmod -R 1777 /tmp
/application/mysql5.1.72/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
vi /etc/profile
在最后加入一段
PATH="/application/mysql/bin/:$PATH"
再运行. /etc/profile 立即生效
/application/mysql//bin/mysqld_safe & #以安全模式启动,最好是以下面的mysqld脚本启动
就可以直接运行mysql -u root@localhost
mysql -uroot -ppassword #设置好密码后,用这个登陆
8.设置启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
/etc/init.d/mysqld start
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list mysql
netstat -lntup |grep mysql #有3306 代表ok了
-------------------------------------------------------------------------------------------------------------------------
PHP 5.6.20
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y
yum install -y openssl openssl-devel libxslt-devel
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ../
./configure \
--prefix=/application/php5.6.20 \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=/application/mysql \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/usr/local/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--enable-gd-native-ttf \
--with-curl \
--with-xsl \
--enable-ftp \
yum install -y zlib zlib-devel apr* gcc gcc-c++
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.27.tar.gz
tar zxvf httpd-2.2.27.tar.gz
cd httpd-2.2.27
./configure --prefix=/application/apache2.2.27 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite
make
make install
ln -s /application/apache2.2.27/ /application/apache
/application/apache/bin/apachectl -t
/application/apache/bin/apachectl graceful
Netstat –lnt|grep 80
Ps –ef|grep http
------------------------------------------------------------------------------------------
mysql5.1
groupadd mysql
useradd mysql -g mysql -M -s /sbin/nologin
yum install -y ncurses-devel
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
#--with-plugin-PLUGIN \
make
make install
-------------------如果mysql不在同一台机器上,到些为止-----------------------------------------------
ln -s /application/mysql5.1.72 /app/mysql
cp mysql/support-files/my-small.cnf /etc/my.cnf
mkdir -p /application/mysql/data
chown -R mysql.mysql /app/mysql
chmod -R 1777 /tmp
/application/mysql5.1.72/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
vi /etc/profile
在最后加入一段
PATH="/application/mysql/bin/:$PATH"
再运行. /etc/profile 立即生效
/application/mysql//bin/mysqld_safe & #以安全模式启动,最好是以下面的mysqld脚本启动
就可以直接运行mysql -u root@localhost
mysql -uroot -ppassword #设置好密码后,用这个登陆
8.设置启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
/etc/init.d/mysqld start
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list mysql
netstat -lntup |grep mysql #有3306 代表ok了
-------------------------------------------------------------------------------------------------------------------------
PHP 5.6.20
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y
yum install -y openssl openssl-devel libxslt-devel
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ../
./configure \
--prefix=/application/php5.6.20 \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=/application/mysql \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/usr/local/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--enable-gd-native-ttf \
--with-curl \
--with-xsl \
--enable-ftp \
--with-libxml-dir
ln -s /application/php5.6.20 /application/php
一定要先装apache和mysql, 再装PHP, 否则用不了了,装好之后,apache里会插入一些模块
开发环境更多是开启日志,调试信息,而生产环境都是关闭状态
cp /home/you/php-5.6.20/php.ini-production /application/php/lib/php.ini
vi httpd.conf
User www
Group www
DirectoryIndex index.php
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
vi index.php
<?
phpinfo();
?>