PHP编译安装
2018-02-04 15:25 親親宝贝 阅读(303) 评论(0) 编辑 收藏 举报前提:必须先安装好MySQL以及Apache
1.准备好源码包并配置好yum源,需要的源码包包括:
libmcrypt-2.5.8-9.el6.x86_64.rpm libmcrypt-devel-2.5.8-9.el6.x86_64.rpm mhash-0.9.9.9-3.el6.x86_64.rpm mhash-devel-0.9.9.9-3.el6.x86_64.rpm php-5.5.33.tar.gz
2.安装依赖环境包:
rpm -ivh libmcrypt-2.5.8-9.el6.x86_64.rpm rpm -ivh libmcrypt-devel-2.5.8-9.el6.x86_64.rpm rpm -ivh mhash-0.9.9.9-3.el6.x86_64.rpm rpm -ivh mhash-devel-0.9.9.9-3.el6.x86_64.rpm yum install libxml2 -y yum install libxml2-devel -y yum install bzip2 -y yum install bzip2-devel yum install libjpeg -y yum install libjpeg-devel -y yum install libpng -y yum install libpng-devel -y yum install libcurl -y yum install libcurl-devel -y yum install readline-devel -y yum install t1lib-devel -y yum install libXpm -y yum install libXpm-devel -y yum install freetype -y yum install freetype-devel -y
3.解包并编译
tar -xf php-5.5.33.tar.gz && cd php-5.5.33 ./configure \ --prefix=/usr/local/php55 \ --with-mysql=/usr/local/mysql \ --with-openssl \ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --enable-mbstring \ --with-gd \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-xpm-dir \ --with-t1lib \ --enable-gd-native-ttf \ --enable-gd-jis-conv \ --with-libxml-dir=/usr \ --enable-xml \ --enable-sockets \ --with-mcrypt \ --with-config-file-path=/usr/local/php55/etc \ --with-config-file-scan-dir=/usr/local/php55/etc/php.d \ --with-bz2 \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mhash \ --enable-zip \ --enable-ftp \ --with-curl \ --enable-pcntl \ --enable-shmop \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-bcmath \ --enable-soap \ --with-iconv \ --enable-inline-optimization \ --with-gettext \ --enable-shared \ --enable-opcache \ --enable-maintainer-zts \ --with-apxs2=/usr/local/httpd/bin/apxs \ --with-readline
预处理完成是下面这个样子
然后我们就可以 make && make install 了
过程会比较漫长,请耐心等待...
编译安装完成:
4.收尾工作
cp php.ini-production /usr/local/php55/etc/php.ini echo 'export PATH=$PATH:/usr/local/php55/bin' >> /etc/profile.d/php.sh
配置Apache支持php
vim /etc/httpd/httpd.conf
配置php.ini
vim /usr/local/php55/etc/php.ini
5.编辑测试php文件,重启Apache测试
vim /usr/local/httpd/htdocs/index.php <?php phpinfo(); ?>
service httpd restart
到此,php编译安装成功。
我心里一直有个梦,想去嵩山少林学武功... QQ:1976883731