centos5.6下 PHP5.4.0 安装笔记--整合apache 与php
2012-08-17 14:22
519 查看
2.编译安装PHP 5.4.0所需的支持库
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure
make
make install
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
3.安装mysql
4.编译php
安装依赖包
yum install ncurses-devel libxml2-devel bzip2-devel libcurl-devel curl-devel libjpeg-devel libpng-devel freetype-devel net-snmp-devel
tar xvzf php-5.4.0.tar.gz
cd php-5.4.0
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/ --with-iconv-dir=/usr/local --enable-fpm
--disable-phar --with-fpm-user=www-data --with-fpm-group=www-data --with-pcre-regex --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml
--disable-rpath --enable-shmop --enable-sockets --enable-zip --enable-bcmath --disable-ipv6
make ZEND_EXTRA_LIBS='-liconv'
make test ==> error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
make install
cp php.ini-production /usr/local/php5/etc/php.ini
cd ../
5.编译安装PHP5扩展模块
tar zxvf memcache-3.0.6.tgz
cd memcache-3.0.6
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install
cd ../
tar xvzf memcached-1.4.13.tar.gz
cd memcached-1.4.13
/usr/local/php5/bin/phpize # If it's already installed, specify its path using --with-libevent=/dir/
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install
cd ../
tar zxvf ImageMagick-6.7.6-5.tar.gz
cd ImageMagick-6.7.6-5
./configure
make
make install
cd ../
tar zxvf imagick-3.1.0RC1.tgz
cd imagick-3.1.0RC1
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make #error
make install
6.修改配置
vi /usr/local/php5/etc/php.ini
最后增加:
;change for hugwww
extension_dir = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/
extension = "memcache.so"
extension = "memcached.so"
;extension = "imagick.so"
修改为:
cgi.fix_pathinfo=0
open_basedir = /tmp:/www/web
expose_php = Off
allow_url_fopen = Off
disable_functions =phpinfo,passthru,ini_restore,eval #not found
cp /usr/local/php5/etc/php.ini /etc/php.ini
完成!
7、整合apache 与php
# vi /usr/local/apache2/conf/httpd.conf
在最后一行加上:
AddType application/x-httpd-php .php
查找:(设置 WEB 默认文件)
DirectoryIndex index.html
替换为:
DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件,httpd 就会执行 /var/www/error/noindex.html
找到这一段:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride none
更改为AllowOverride all
允许apache rewrite
# 监听443端口,支持https连接
#取消注释 httpd.conf 中的 Include conf/extra/httpd-ssl.conf
保存httpd.conf,退出。
# /usr/local/apache2/bin/apachectl restart //重启 Apache
=======================================================================================
./configure –build=i686-RedHat-linux-gnu –host=i686-redhat-linux-gnu \
–target=i686-RedHat-linux-gnu –with-apxs2=/usr/sbin/apxs \
–prefix=/usr/local –exec-prefix=/usr/local –with-exec-dir=/usr/local/bin \
–sysconfdir=/etc –libdir=/usr/local/lib/php –with-libdir=lib \
–sbindir=/usr/local/sbin –sharedstatedir=/usr/com –datadir=/usr/local/share \
–includedir=/usr/local/include –libexecdir=/usr/local/libexec \
–localstatedir=/var –cache-file=../config.cache \
–mandir=/usr/local/share/man –infodir=/usr/local/share/info \
–with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d \
–with-pic –with-curl=shared –with-freetype-dir –with-png-dir \
–with-gettext –with-gmp –with-iconv –with-jpeg-dir –with-png-dir \
–with-openssl –with-layout=GNU –with-libxml-dir \
–with-pcre-regex=/usr \
–with-mcrypt=shared –with-mhash –with-zlib –with-bz2=shared \
–with-pdo-mysql –with-mysql –with-mysql-sock=/var/lib/mysql/mysql.sock \
–with-pgsql –with-pdo-pgsql –with-sqlite=shared –with-pdo-sqlite=shared \
–enable-sqlite-utf8 –with-kerberos –with-imap –with-imap-ssl \
–with-pear –with-gd –enable-gd-native-ttf –enable-calendar=shared \
–enable-exif –enable-ftp –enable-sockets –enable-bcmath \
–enable-sysvsem –enable-sysvshm –enable-sysvmsg –enable-intl \
–enable-mbstring –enable-zend-multibyte –enable-zip \
–without-unixODBC –disable-tokenizer \
非RHEL/CentOS系统可以省略 –build,–host,–target 参数,程序会自动判断(LINUX一般为i686-pc-linux-gnu)。如果没安装pgsql或者不需要pgsql的支持可以删除相关参数(共2个)。 bz2, calendar, curl, mcrypt, pdo_sqlite, sqlite 这些模块采用动态编译,可采用下面将会提到的方法加载。
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure
make
make install
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
3.安装mysql
4.编译php
安装依赖包
yum install ncurses-devel libxml2-devel bzip2-devel libcurl-devel curl-devel libjpeg-devel libpng-devel freetype-devel net-snmp-devel
tar xvzf php-5.4.0.tar.gz
cd php-5.4.0
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/ --with-iconv-dir=/usr/local --enable-fpm
--disable-phar --with-fpm-user=www-data --with-fpm-group=www-data --with-pcre-regex --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml
--disable-rpath --enable-shmop --enable-sockets --enable-zip --enable-bcmath --disable-ipv6
make ZEND_EXTRA_LIBS='-liconv'
make test ==> error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
make install
cp php.ini-production /usr/local/php5/etc/php.ini
cd ../
5.编译安装PHP5扩展模块
tar zxvf memcache-3.0.6.tgz
cd memcache-3.0.6
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install
cd ../
tar xvzf memcached-1.4.13.tar.gz
cd memcached-1.4.13
/usr/local/php5/bin/phpize # If it's already installed, specify its path using --with-libevent=/dir/
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install
cd ../
tar zxvf ImageMagick-6.7.6-5.tar.gz
cd ImageMagick-6.7.6-5
./configure
make
make install
cd ../
tar zxvf imagick-3.1.0RC1.tgz
cd imagick-3.1.0RC1
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make #error
make install
6.修改配置
vi /usr/local/php5/etc/php.ini
最后增加:
;change for hugwww
extension_dir = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/
extension = "memcache.so"
extension = "memcached.so"
;extension = "imagick.so"
修改为:
cgi.fix_pathinfo=0
open_basedir = /tmp:/www/web
expose_php = Off
allow_url_fopen = Off
disable_functions =phpinfo,passthru,ini_restore,eval #not found
cp /usr/local/php5/etc/php.ini /etc/php.ini
完成!
7、整合apache 与php
# vi /usr/local/apache2/conf/httpd.conf
在最后一行加上:
AddType application/x-httpd-php .php
查找:(设置 WEB 默认文件)
DirectoryIndex index.html
替换为:
DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件,httpd 就会执行 /var/www/error/noindex.html
找到这一段:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride none
更改为AllowOverride all
允许apache rewrite
# 监听443端口,支持https连接
#取消注释 httpd.conf 中的 Include conf/extra/httpd-ssl.conf
保存httpd.conf,退出。
# /usr/local/apache2/bin/apachectl restart //重启 Apache
=======================================================================================
./configure –build=i686-RedHat-linux-gnu –host=i686-redhat-linux-gnu \
–target=i686-RedHat-linux-gnu –with-apxs2=/usr/sbin/apxs \
–prefix=/usr/local –exec-prefix=/usr/local –with-exec-dir=/usr/local/bin \
–sysconfdir=/etc –libdir=/usr/local/lib/php –with-libdir=lib \
–sbindir=/usr/local/sbin –sharedstatedir=/usr/com –datadir=/usr/local/share \
–includedir=/usr/local/include –libexecdir=/usr/local/libexec \
–localstatedir=/var –cache-file=../config.cache \
–mandir=/usr/local/share/man –infodir=/usr/local/share/info \
–with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d \
–with-pic –with-curl=shared –with-freetype-dir –with-png-dir \
–with-gettext –with-gmp –with-iconv –with-jpeg-dir –with-png-dir \
–with-openssl –with-layout=GNU –with-libxml-dir \
–with-pcre-regex=/usr \
–with-mcrypt=shared –with-mhash –with-zlib –with-bz2=shared \
–with-pdo-mysql –with-mysql –with-mysql-sock=/var/lib/mysql/mysql.sock \
–with-pgsql –with-pdo-pgsql –with-sqlite=shared –with-pdo-sqlite=shared \
–enable-sqlite-utf8 –with-kerberos –with-imap –with-imap-ssl \
–with-pear –with-gd –enable-gd-native-ttf –enable-calendar=shared \
–enable-exif –enable-ftp –enable-sockets –enable-bcmath \
–enable-sysvsem –enable-sysvshm –enable-sysvmsg –enable-intl \
–enable-mbstring –enable-zend-multibyte –enable-zip \
–without-unixODBC –disable-tokenizer \
非RHEL/CentOS系统可以省略 –build,–host,–target 参数,程序会自动判断(LINUX一般为i686-pc-linux-gnu)。如果没安装pgsql或者不需要pgsql的支持可以删除相关参数(共2个)。 bz2, calendar, curl, mcrypt, pdo_sqlite, sqlite 这些模块采用动态编译,可采用下面将会提到的方法加载。
相关文章推荐
- CentOS5.6安装Apache Mysql PHP笔记
- centos 5.8 64位 安装apache+mysql+php 笔记
- PHP自学笔记1——安装(整合Apache)
- 在CentOS 5.1上安装Apache 2.2 + PHP 5.2笔记
- CentOS6.5 PHP5.4.0+Apache2.4.1+MySQL5.5.21 编译安装
- CentOS6.5 PHP5.4.0+Apache2.4.1+MySQL5.5.21 编译安装
- centos6.5下安装php+mysql+apache并整合的具体流程
- 在centos6.4 上安装apache (httpd-2.2.29.tar.gz) 和php(php-5.6.8.tar.gz)
- [推荐]centos6.0 安装apache php mysql subversion(svn) swftools(pdf转换swf)
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- CentOS下安装Apache PHP MySql
- CentOS安装 LAMP -- Linux Apache MySQL PHP
- CentOS 下安装 Apache 和 PHP 并开启 mcrypt 扩展
- php服务安装和配置以及和apache整合
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- CentOS 6.7配置安装(Apache+PHP5+MySQL)LAMP服务器
- centos7下安装apache,mysql,php 合集
- CentOS环境下yum安装LAMP(Linux+Apache+Mysql+php)
- centos 6.8/7.3版本安装php5.6mysql5.7apache2.4(已亲测绝对能用教程)
- centos手动编译安装apache、php、mysql