CentOS 5.5源码安装apache+mysql+php
来源:互联网 发布:ios8cydia添加软件源 编辑:程序博客网 时间:2024/06/06 14:12
禁用SeLinux
selinux可能会致使编译安装失败,先禁用它
1.sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config //永久禁用,需要重启生效
2.setenforce 0 //临时禁用,不需要重启
mkdir -p /usr/local/soft
cd /usr/local/soft
下载安装包
wget -c http://apache.etoak.com//httpd/httpd-2.2.22.tar.bz2
wget -c ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.1/mysql-5.1.65.tar.gz
wget -c http://cn.php.net/distributions/php-5.2.17.tar.bz2
wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
wget -c http://pecl.php.net/get/memcache-2.2.6.tgz
wget -c http://pecl.php.net/get/imagick-3.0.1.tgz
wget -c http://cdnetworks-kr-1.dl.sourceforge.net/project/imagemagick/6.7.8-sources/ImageMagick-6.7.8-8.tar.bz2
wget -c http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
wget -c http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
wget -c http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download
wget -c http://pecl.php.net/get/APC-3.1.7.tgz
wget -c http://nchc.dl.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz
wget -c http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2/download
wget -c http://pear.php.net/go-pear.phar
1.安装MySql
tar zxvf mysql-5.1.56.tar.gz
cd mysql-5.1.56
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
./configure \
"--prefix=/usr/local/mysql" \
"--localstatedir=/data/mysql/data/" \
"--with-comment=Source" \
"--with-mysqld-user=mysql" \
"--without-debug" \
"--with-big-tables" \
"--with-charset=gbk" \
"--with-collation=gbk_chinese_ci" \
"--with-extra-charsets=all" \
"--with-pthread" \
"--enable-static" \
"--enable-thread-safe-client" \
"--with-client-ldflags=-all-static" \
"--with-mysqld-ldflags=-all-static" \
"--enable-assembler" \
"--with-plugins=all" \
"--without-ndb-debug"
make
make install
useradd mysql -d /data/mysql -s/sbin/nologin
/usr/local/mysql/bin/mysql_install_db --user=mysql
cd /usr/local/mysql
chown -R root:mysql .
chown -R mysql /data/mysql/data
cp share/mysql/my-huge.cnf /etc/my.cnf
cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
/etc/rc.d/init.d/mysqld start
cd /usr/local/mysql/bin
for i in *; do ln -s /usr/local/mysql/bin/$i /usr/bin/$i; done
2.安装Apache
tar jxvf httpd-2.2.22.tar.bz2
cd httpd-2.2.22.tar.bz2
./configure --prefix=/usr/local/apache2 \
--with-mpm=prefork \
--enable-deflate \
--enable-so \
--enable-rewrite \
--enable-speling \
--enable-sslmake
make install
设置开机启动
在/etc/rc.d/rc.local中增加启动apache的命令:/usr/local/apache/bin/apachectl start
echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local
设置apache为系统服务
ln -s /usr/local/apache2/bin/apachectl /etc/init.d/httpd
编辑/etc/init.d/httpd,在#!/bin/bash后加入
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server
添加服务
chkconfig --add httpd
检查设置是否生效
chkconfig --list httpd
3.安装php库文件
编码转换库
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/
make && make install
加密算法库
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr
make && make install
/sbin/ldconfig
cd libltdl/
./configure --prefix=/usr --enable-ltdl-install
make && make install
哈希函数库
tar jxvf mhash-0.9.9.9.tar.bz2
cd mhash-0.9.9.9
./configure --prefix=/usr
make && make install
加解密算法库
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
./configure --prefix=/usr
make && make install
字体引擎库
tar jxvf freetype-2.1.10.tar.bz2
cd freetype-2.1.10
./configure --prefix=/usr
make && make install
4.安装php
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql/ \
--with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/ \
--with-pdo-mysql=/usr/local/mysql/ \
--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/ \
--enable-xml --disable-rpath --enable-discard-path --enable-bcmath \
--enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers \
--enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring \
--with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl \
--enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/php/etc/php.ini
安装php扩展模块(无特殊需求,以下扩展模块无需安装)
tar zxvf memcache-2.2.6.tgz
cd memcache-2.2.6
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
cd ..
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/
make && make install
cd ..
tar jxvf ImageMagick-6.6.9-6.tar.bz2
cd ImageMagick-6.6.9-6
./configure
make && make install
cd ..
tar zxvf imagick-3.0.1.tgz
cd imagick-3.0.1
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
5.配置修改
修改/usr/local/php/etc/php.ini启用扩展库文件(编译php时如果已经启用--with-pdo-mysql,这步可直接略过)
找到”extension_dir = “./”"此行,
修改为:extension_dir = “/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/”
添加如下3行:
extension=”pdo_mysql.so”
验证php加载模块使用 /usr/local/php/bin/php -m
修改/usr/local/apache/conf/httpd.conf
添加如下
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .html
安装好php时,启动apache报错
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load
/usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot
restore segment prot after reloc: Permission denied
selinux安全模式导致的,解决办法如下:
setenforce 0
chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache2/modules/libphp5.so
setenforce 1
重启apache
- CentOS 5.5源码安装apache+mysql+php
- CentOS下源码安装php+apache+mysql
- CentOS源码安装Apache+php
- CentOS 5.5 编译安装Apache+MySQL+PHP
- CentOS 5.5(Apache+PHP+Mysql)安装
- CentOS 4.4下源码编译安装apache+php+mysql
- CentOS 下源码编译安装apache+php+mysql
- CentOS 源码编译安装LAMP(Apache MySQL PHP)
- CentOS 源码编译安装LAMP(Apache MySQL PHP)
- CentOS 6.5 系统 LAMP(Apache+MySQL+PHP)源码安装步骤
- CentOS 安装 mysql apache php
- centos安装php mysql apache
- CentOS 安装apache、mysql、php
- CentOS 安装 Apache + PHP + MySQL
- Centos安装Apache Mysql Php
- centos 安装 apache mysql php
- centos 安装Apache、MySQL、PHP
- CentOS安装apache,MysqL,PHP
- 一分钟明白 VS manifest 原理
- php二维数组按指定列排序
- 转战Android之NDK(jni, java调用c/c++)
- C#中对于溢出的处理
- S3C2440如何设置系统时钟
- CentOS 5.5源码安装apache+mysql+php
- 咏春拳解
- hdu1059(分珠宝)
- MongoDB的Replica Set POC验证
- linux 定时器
- 蛇形排列 非递归
- 无锡江南精武咏春拳馆训练内容
- HTTP权威指南(HTTP:The Definitive Guide) 期待一下
- heru 1280 Turn the corner(08哈尔滨网赛 三分)