• PHP编译安装


    下载php

    [root@localhost ~]# cd /usr/local/src
    [root@localhost src]# ls
    httpd-2.2.31          mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz
    httpd-2.2.31.tar.bz2
    [root@localhost src]# wget http://cn2.php.net/distributions/php-5.6.24.tar.gz
    [root@localhost src]# ls
    httpd-2.2.31          mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz
    httpd-2.2.31.tar.bz2  php-5.6.24.tar.gz
    

    解压

    [root@localhost src]# tar zxf php-5.6.24.tar.gz
    [root@localhost src]# ls
    httpd-2.2.31                               php-5.6.24
    httpd-2.2.31.tar.bz2                       php-5.6.24.tar.gz
    mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz
    

    配置编译参数

    [root@localhost src]# cd php-5.6.24
    [root@localhost php-5.6.24]# ./configure 
    > --prefix=/usr/local/php 
    > --with-apxs2=/usr/local/apache2/bin/apxs 
    > --with-config-file-path=/usr/local/php/etc  
    > --with-mysql=/usr/local/mysql 
    > --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 
    > --disable-ipv6
    

    错误1

    configure: error: xml2-config not found. Please check your libxml2 installation.

    解决方案

    yum install -y libxml2-devel

    错误2

    configure: error: Cannot find OpenSSL's <evp.h>

    解决方案

    yum install -y openssl openssl-devel

    错误3

    checking for BZip2 in default path... not found
    configure: error: Please reinstall the BZip2 distribution
    

    解决方案

    yum install -y bzip2 bzip2-devel

    错误4

    configure: error: png.h not found.

    解决方案

    yum install -y libpng libpng-devel

    错误5

    configure: error: freetype.h not found.

    解决方案

    yum install -y freetype freetype-devel

    错误6

    configure: error: jpeglib.h not found.

    解决方案

    [root@localhost php-5.6.24]# yum install -y libjpeg-devel

    错误7

    configure: error: mcrypt.h not found. Please reinstall libmcrypt.

    解决方案

    cd /usr/local/src
    wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
    tar -zxvf libmcrypt-2.5.7.tar.gz
    cd libmcrypt-2.5.7
    ./configure --prefix=/usr/local
    make
    make install
    
    

    重新配置编译参数

    [root@localhost src]# cd /usr/local/src/php-5.6.24/
    [root@localhost php-5.6.24]# ./configure 
    > --prefix=/usr/local/php 
    > --with-apxs2=/usr/local/apache2/bin/apxs 
    > --with-config-file-path=/usr/local/php/etc  
    > --with-mysql=/usr/local/mysql 
    > --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 
    > --disable-ipv6
    

    编译

    [root@localhost php-5.6.24]# make
    [root@localhost php-5.6.24]# echo $?
    0

    安装

    [root@localhost php-5.6.24]# make install
    [root@localhost php-5.6.24]# echo $?
    0
    

    查看

    [root@localhost php-5.6.24]# ls /usr/local/php/
    bin  etc  include  lib  php
    

    模块

    [root@localhost php-5.6.24]# /usr/local/php/bin/php –m

    配置信息

    [root@localhost php-5.6.24]# /usr/local/php/bin/php –i

    如果Apache在运行,重启Apache

    [root@localhost ~]# /usr/local/apache2/bin/apachectl restart

    如果没有运行Apache,启动Apache

    [root@localhost ~]# /usr/local/apache2/bin/apachectl start

    修改Apache配置文件

    [root@localhost htdocs]# vim /usr/local/apache2/conf/httpd.conf

    找到
    AddType application/x-gzip .gz .tgz
    在该行下面添加
    AddType application/x-httpd-php .php
    找到

    DirectoryIndex index.html

    将该行改为

    DirectoryIndex index.html index.htm index.php

    找到

    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

    改为

    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all

    [root@localhost htdocs]# /usr/local/apache2/bin/apachectl -t
    Syntax OK
    [root@localhost htdocs]# /usr/local/apache2/bin/apachectl graceful
    

    拷贝php配置文件

    [root@localhost htdocs]# cp /usr/local/src/php-5.6.24/php.ini-production  /usr/local/php/etc/php.ini
    [root@localhost htdocs]# /usr/local/apache2/bin/apachectl graceful
    
  • 相关阅读:
    python新建以时间命名的目录
    selenium跳过https的问题
    selenium修改控件属性
    selenium遍历控件集合
    知识库系统confluence5.8.10 安装与破解
    python3 遍历文件
    mysql更新密码为空
    CentOS7下安装配置vncserver
    Centos7搭建php+mysql环境(整理篇)
    centos7上安装与配置Tomcat7(整理篇)
  • 原文地址:https://www.cnblogs.com/Genesis2018/p/8304730.html
Copyright © 2020-2023  润新知