Red Hat Enterprise Linux 7 高薪入门pdf下载
以下是编译安装, 最后是用Centos的yum安装PHP5.3
安装GIT
sudo yum install gettext-devel expat-devel cpio perl openssl-devel zlib-devel
wget https://www.kernel.org/pub/software/scm/git/git-1.9.0.tar.gz
tar -zxvf git-1.9.0.tar.gz
cd git-1.9.0
./configure
sudo make
sudo make install
git –version
Install memcached
sudo yum install libevent-devel
wget http://www.memcached.org/files/memcached-1.4.17.tar.gz
tar -zxvf memcached-1.4.17.tar.gz
./configure –prefix=/opt/memcache
sudo make
sudo make install
sudo cp scripts/memcached.sysv /etc/rc.d/init.d/memcached
sudo vim /etc/rc.d/init.d/memcached
Two places need change:
==1======
PORT=11211
USER=memcached
MAXCONN=1024
CACHESIZE=64
OPTIONS=”"
==2======
start () {
echo -n $”Starting $prog: ”
# insure that /var/run/memcached has proper permissions
chown $USER /opt/memcache/bin/memcached
daemon /opt/memcache/bin/memcached -d -p $PORT -u $USER -m $CACHESIZE -c $M
AXCONN -P /opt/memcache/bin/memcached/memcached.pid $OPTIONS
yum -y install bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype-devel libmcrypt libmcrypt-devel libxml2-devel
./configure –prefix=/opt/php –with-apxs2=/opt/apache2/bin/apxs –with-libxml-dir=/usr/lib64 –with-mysql=/opt/mysql –with-mysqli=/opt/mysql/bin/mysql_config –with-gd –enable-gd-native-ttf –with-zlib –with-mcrypt –with-pdo-mysql=/opt/mysql –enable-shmop –enable-soap –enable-sockets –enable-wddx –enable-zip –with-xmlrpc –enable-fpm –enable-mbstring –with-zlib-dir –with-bz2 –with-curl –enable-exif –enable-ftp –with-jpeg-dir=/usr/lib64 –with-png-dir=/usr/lib64 –with-freetype-dir=/usr/lib64
sudo cp /data/backup/php-5.4.26/php.ini-production /opt/php/etc/php.ini
上面这个不对, 如果不指定路径(–with-config-file-path=/opt/php/etc )的话, 从phpinfo可以看到, 这个路径是指向/opt/php/lib的, 所以得放到/opt/php/lib下去, 否则后面的修改不起作用
sudo vim conf/httpd.conf
1. 添加php支持。
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
2. 添加默认索引页面index.php,再找到“DirectoryIndex”,在index.html后面加上“ index.php”
DirectoryIndex index.html index.php
3. 不显示目录结构,找到“Options Indexes FollowSymLinks”,修改为
Options FollowSymLinks
4. 开启Apache支持伪静态,找到“AllowOverride None”,修改为
AllowOverride All
安装memcached php扩展
sudo yum install gcc44 gcc44-c++ libstdc++44-devel
tar -zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
CC=gcc44 CXX=g++44 ./configure
sudo make
sudo make install
sudo yum install autoconf
wget http://pecl.php.net/get/memcached-2.1.0.tgz
tar -zxvf memcached-2.1.0.tgz
cd memcached-2.1.0
/opt/php/bin/phpize
./configure –enable-memcached –with-php-config=/opt/php/bin/php-config –with-libmemcacheddir=/usr/local/lib
上面的是错的, 妈的试了半天, 参数不对以外, 这个目录也有讲究, 必须包含的文件是: include/libmemcached/memcached.h (注意路径!), 不然会报错: error: Can’t find libmemcached 1.0.x headers
下面的才是对的:
./configure –enable-memcached –with-php-config=/opt/php/bin/php-config –with-libmemcached-dir=/usr/local/
安装phalcon
git clone –depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/
cd build/
sudo ./install
在运行install之前, 需要修改install 脚本:
主要是: 两处phpize的路径, 一处增加–with-php-config=/opt/php/bin/php-config
如下:
#Clean current compilation
if [ -f Makefile ]; then
make clean
/opt/php/bin/phpize –clean
fi
#Perform the compilation
/opt/php/bin/phpize && ./configure –with-php-config=/opt/php/bin/php-config –e
nable-phalcon && make && make install && echo -e “\nThanks for compiling Phalcon
!\nBuild succeed: Please restart your web server to complete the installation”
安装 yaf
wget https://github.com/laruence/php-yaf/archive/yaf-2.2.9.tar.gz
mv yaf-2.2.9 yaf-2.2.9.tar.gz
cd php-yaf-yaf-2.2.9/
sudo /opt/php/bin/phpize
sudo ./configure –with-php-config=/opt/php/bin/php-config
sudo make
sudo make install
安装eAccelerator: make出错, 放弃
安装APC
sudo /opt/php/bin/pecl install apc
然后修改php.ini
安装 GraphicsMagick
wget http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fgraphicsmagick%2Ffiles%2Fgraphicsmagick%2F1.3.19%2F&ts=1394559460&use_mirror=ncu
tar -zxvf GraphicsMagick-1.3.19.tar.gz
cd GraphicsMagick-1.3.19
./configure –prefix=/opt/GraphicsMagick –enable-shared=yes
没有最后那个参数的话, php的扩展编译会出错
sudo make
sudo make install
/opt/GraphicsMagick/bin/gm
/opt/GraphicsMagick/bin/gm convert -list formats
安装graphicsmagick的php扩展:
因为是RC, 所以必须用channel 指定安装
sudo /opt/php/bin/pecl install gmagick channel://pecl.php.net/gmagick-1.1.7RC1
用yum 安装centos 自带版本:
sudo yum install php-pecl-memcache
sudo yum install php-pecl-apc
安装ImageMagick 比较麻烦, 按如下顺序:
sudo yum install ImageMagick
sudo yum install ImageMagick-devel -- 必须安装
sudo yum install php-devel -- 必须安装, 要用到 phpnize
sudo yum install php-pear -- 检查下 php-pear 是否安装, 然后才可以用pecl命令
sudo pecl install imagick
上一步完成后, 检查imagick.so 是否已经生成, 默认位置在 /usr/lib64/php/modules , 从前面安装的显示信息里能看到, 然后加到php.ini 里面
我用的这个版本的php, extension不是放在php.ini里面的, 而是放在 /etc/php.d/*.ini 里面, 所以在里面新建了一个 imagick.ini , 把extension 写进去
sudo vi imagick.ini
; Enable imagick extension module
extension=imagick.so
然后重启httpd 就可以了