本文共 2267 字,大约阅读时间需要 7 分钟。
PHP官网www.php.net
当前主流版本为5.6/7.1cd /usr/local/src/ wget tar zxf php-5.6.30.tar.gzcd php-5.6.30./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif--prefix= 指定安装目录 --with-apxs2=Apache的工具,不需要人工的干涉,自动的把扩展模块放到modules模块里,并且在配置文件里加一行loadmoduls,能够httpd -M的时候把模块加载出来。所以要先安装Apache,要指定这个工具地址make && make installcp php.ini-production /usr/local/php/etc/php.ini //配置文件路径/usr/local/php/etc因为这下面是空的(开发环境可使用php.ini-development)
/usr/local/php/bin/php -i|less //查看php相关信息
Loaded Configuration File => /usr/local/php/etc/php.inils /usr/local/php/bin/ //php核心二进制文件
pear peardev pecl phar phar.phar php php-cgi php-config phpizedu -sh /usr/local/apache2.4/modules/libphp5.so //php扩展模块。Apache需要
37M /usr/local/apache2.4/modules/libphp5.so/usr/local/php/bin/php -m //查看加载的模块有哪些(显示静态文件,也可动态扩展模块安装)
[root@lsx-001 php-5.5.38]# du -sh /usr/local/php
77M /usr/local/php[root@lsx-001 php-5.5.38]# du -sh /usr/local/apache2/modules/libphp5.so 35M /usr/local/apache2/modules/libphp5.so Apache结合php依赖libphp5[root@lsx-001 php-5.5.38]# /usr/local/php/bin/php –m 查看加载的模块(静态的)
[PHP Modules] bz2CorectypedateApache配置文件
[root@lsx-001 php-5.5.38]# vi /usr/local/apache2/conf/httpd.conf错误:
1.error: xml2-config not found. Please check your libxml2 installation.解决办法:yum list|grep libxml2yum install -y libxml2-devel.x86_642.error: Cannot find OpenSSL's <evp.h>
yum list|grep OpenSSL -iyum install -y openssl-devel.x86_643.error: Please reinstall the BZip2 distribution
yum install -y bzip2-devel.x86_644.error: jpeglib.h not found.
yum install -y libjpeg-turbo-devel.x86_645.error: png.h not found.
yum install -y libpng-devel.x86_646.error: freetype-config not found.
yum install -y freetype-devel.x86_647.error: mcrypt.h not found. Please reinstall libmcrypt.
yum install -y epel-releaseyum install -y libmcrypt-devel转载于:https://blog.51cto.com/lsxme/2051885