为了账号安全,请及时绑定邮箱和手机立即绑定

cetos 编译安装php

标签:
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./configuremakemake install#安装mhash(解压过程略)wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2./configuremakemake install#安装libmcrypt(解压过程略)wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz./configuremakemake 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-zlibmake ZEND_EXTRA_LIBS='-liconv'make install

制定扩展文件目录:

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

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

设置环境变量:

vim /etc/profile#内容类似于PATH=/opt/php/bin:/opt/php/sbin:$PATHexport PATH#保存关闭后source /etc/profile

安装ImageMagick与Imagick

下载ImageMagick

下载Imagick

先安装ImageMagick,再安装Imagick。

ImageMagick安装:

./configure --prefix=/opt/ImageMagickmakemake 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-configmakemake 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-configmakemake install

配置eAccelerator

如果开启了Selinux,请运行:

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

创建缓存目录:

mkdir /var/cache/eacceleratorchmod 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文件就懂了。


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 1
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消