cetos 编译安装php

yum install bison flex libxml2-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel  freetype-devel  t1lib-devel libicu-devel

#安装libiconv(解压过程略) wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz ./configure make make install #安装mhash(解压过程略) wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2 ./configure make make install #安装libmcrypt(解压过程略) wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz ./configure make make install

./configure --prefix=/opt/php --disable-ipv6 --enable-exif --enable-fpm --enable-ftp --enable-gd-native-ttf --enable-intl --enable-mbstring --enable-mod-charset --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-zip --with-apxs2 --with-bz2 --with-config-file-path=/opt/php/etc --with-curl --with-freetype-dir --with-jpeg-dir --with-gd --with-gettext --with-mhash --with-iconv-dir --with-libxml-dir --with-mcrypt --with-mysql --with-mysql-sock --with-mysqli --with-openssl-dir --with-openssl --with-pcre-dir --with-pcre-regex --with-pdo-mysql --with-png-dir --with-pear --with-t1lib --with-zlib make ZEND_EXTRA_LIBS='-liconv' make install

制定扩展文件目录:

extension_dir = /opt/php/lib/php/extensions/no-debug-non-zts-20100525

可以通过phpinfo来查找目录名(搜索extension_dir字符串):

image

设置环境变量:

vim /etc/profile
#内容类似于
PATH=/opt/php/bin:/opt/php/sbin:$PATH
export PATH

#保存关闭后
source /etc/profile

安装ImageMagick与Imagick

下载ImageMagick

下载Imagick

先安装ImageMagick,再安装Imagick。

ImageMagick安装:

./configure --prefix=/opt/ImageMagick
make
make install

Imagick安装:

export PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig
/opt/php/bin/phpize
./configure --with-imagick=/opt/ImageMagick --with-php-config=/opt/php/bin/php-config
make
make install

imagick安装完成后,将自动把imagick.so文件复制到php的extension目录下,我的extension目录为:

/opt/php/lib/php/extensions/no-debug-non-zts-20100525/

配置Imagick:

在php.ini中加入:extension="imagick.so"

如果SELinux打开了,那么需要运行下面这个命令:

restorecon /opt/php/lib/php/extensions/no-debug-non-zts-20100525/imagick.so

eAccelerator安装

下载eAccelerator

/opt/php/bin/phpize
./configure --enable-eaccelerator=shared --with-eaccelerator-info --with-eaccelerator-disassembler --with-php-config=/opt/php/bin/php-config
make
make install

配置eAccelerator

如果开启了Selinux,请运行:

restorecon /opt/php/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so

创建缓存目录:

mkdir /var/cache/eaccelerator
chmod 777 /var/cache/eaccelerator

在php.ini中加入:

[eaccelerator]
extension = "eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

配置eAccelerator的web管理页面:

1.编译安装时,需要加上--with-eaccelerator-info参数

2.将安装目录下的control.php文件复制到web目录下,使用浏览器访问。

默认control.php集成了http验证,用户名密码可以在文件中找到,也可以关闭Http验证,这一切,使用编辑器打开control.php文件就懂了。

image


你可能感兴趣的:(PHP,LNMP)