zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    Maven 环境的配置
    zTree的简单例子
    plsql免安装客户端的配置
    HDU 1232 畅通工程
    HDU 5698 瞬间移动
    Codeforces 1015E1 Stars Drawing (Easy Edition)
    Codeforces 784B Santa Claus and Keyboard Check
    Codeforces 500C New Year Book Reading
    NSarray 赋值 拷贝 等问题记录
    UINavigationController 操作记录
  • 原文地址:https://www.cnblogs.com/Genesis2018/p/9079810.html
Copyright © 2011-2022 走看看