• Linux:安装php


    一、环境准备(lamp环境:linux+apache+php+mysql)

    1、安装php之前,首先要检查一下相关lib库

    rpm -qa  zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel 

    如果没有安装的,要安装上 yum install  zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel  

    yum install openssl-devel -y

    yum install libxslt-devel -y

    2、安装libiconv,下载安装包libiconv-1.14.tar.gz,

    安装

    tar zxvf libiconv-1.14.tar.gz

    cd libiconv-1.14

    ./configure --prefix=/usr/local/libiconv

    make

    make install

    安装libmcrypt(非必须)

    tar zxvf libmcrypt-2.5.8.tar.gz
    cd libmcrypt-2.5.8
    ./configure
    make
    make install
    sleep 2
    /sbin/ldconfig
    cd libltdl/
    ./configure --enable-ltdl-install
    make
    make install
    cd ../../

    安装mhash 

    tar zvxf mhash-0.9.9.9.tar.gz
    cd mhash-0.9.9.9
    ./configure
    make
    make install
    sleep 2
    cd ../

    rm -f /usr/lib64/libmcrypt.*
    rm -f /usr/lib64/libmhash*
    ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la
    ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so
    ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
    ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
    ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a
    ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la
    ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so
    ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2
    ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
    ln -s /usr/local/lib64/libmcrypt-config /usr/lib64/libmcrypt-config

    安装mcrypt:

    tar zxvf mcrypt-2.6.8.tar.gz
    cd mcrypt-2.6.8/
    /sbin/ldconfig
    ./configure LD_LIBRARY_PATH=/usr/local/lib
    make
    make install
    cd ../
    sleep 2

    3、安装好apache和mysql

    二、安装php

    1、下载安装包php-5.3.27.tar.gz

    2、解压并进入目录

    tar zxvf php-5.3.27.tar.gz

    cd php-5.3.27

    3、安装

    编译

    ./configure
    --prefix=/application/php5.3.27             php安装路径
    --with-apxs2=/application/apache/bin/apxs         apache下的apxs路径,通过apxs增加php扩展模块到apache中
    --with-mysql=/application/mysql             mysql安装路径
    --with-xmlrpc
    --with-openssl
    --with-zlib
    --with-freetype-dir
    --with-gd
    --with-jpeg-dir
    --with-png-dir
    --with-iconv=/usr/local/libiconv
    --enable-short-tags
    --enable-sockets
    --enable-zend-multibyte
    --enable-soap
    --enable-mbstring
    --enable-static
    --enable-gd-native-ttf
    --with-curl
    --with-xsl
    --enable-ftp
    --with-libxml-dir

    编译完成后,make && make install

    4、创建链接

    ln -s /application/php5.3.27/ /application/php

    5、检查

    安装后,查看/application/apache/modules/ ,可以看到由apxs将php模块插入apache中

     并且在apache配置文件中,也有相关配置

    php的配置文件由2个,一个时开发环境,一个生产环境。他们的区别在于开发环境很多错误日志可以显示出来。生产环境不让显示

    php默认配置文件在/application/php/lib/php.ini

    拷贝一份生产环境配置文件替换默认配置文件  cp php.ini-production /application/php/lib/php.ini

  • 相关阅读:
    VSCode集成TypeScript编译
    http模拟登陆及发请求
    1​1​.​0​5​9​2​M​晶​振​与12M晶振
    单片机定时器2使用
    Altium Designer 小记
    sql-mysql
    java英文缩写
    Altium Design
    Tomcat使用
    jar/war/ear文件的区别
  • 原文地址:https://www.cnblogs.com/bendouyao/p/10144869.html
Copyright © 2020-2023  润新知