zoukankan      html  css  js  c++  java
  • PHP安装linux

    PHP 7.1.26 安装

    1、 下载安装包 例php-7.1.26.tar.gz 下载地址:http://cn2.php.net/downloads.php

    2、 放入/root

    3、 切换目录 #cd /usr/local/src

    4、 解压缩文件 #tar -zxvf  /root/php-7.1.26.tar.gz

    5、 进入压缩的文件 #cd php-7.1.26/

    6、 创建路径 mkdir /usr/local/php

    7、 查看readme、install #vim README

    8、 (防止各种报错,安装以下用到的工具)

    yum -y install openssl
    yum -y install openssl-devel
    yum -y install curl
    yum -y install curl-devel
    yum -y install libjpeg
    yum -y install libjpeg-devel
    yum -y install libpng
    yum -y install libpng-devel
    yum -y install freetype
    yum -y install freetype-devel
    yum -y install pcre
    yum -y install pcre-devel
    yum -y install libxslt
    yum -y install libxslt-devel
    yum -y install bzip2
    yum -y install bzip2-devel
    配置安装路径等信息  # ./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip

    9、 编译 #make

    10、 测试一下 #make test (测试完之后报了几个BUG,没理会继续下一步)

    11、 安装 #make install

    12、 配置:

    #cp php.ini-production /usr/local/php/lib/php.ini
    #cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
    #cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
    # cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    # chmod +x /etc/init.d/php-fpm
    13、添加环境变量 
    #vim /etc/profile.d/php.sh
    末尾添加 
    export PATH=$PATH:/usr/local/php/bin/:usr/local/php/sbin/
    保存并退出 :wq
    #source /etc/profile.d/php.sh   <==使用source立即生效刚刚添加的PHP环境变量

    # /etc/init.d/php-fpm start

    显示Starting php-fpm done (启动成功)

    14、 增加到自启动

    # chkconfig --add php-fpm

    # chkconfig php-fpm on

    # chkconfig --list | grep php-fpm <==查看是否自启动

    #  php-fpm -t

    NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful

    出现上面的提示也就是测试配置文件通过没有问题, 可以正式使用php服务了 

    # systemctl start php-fpm.service 

    # systemctl status php-fpm.service

     如果报错:ERROR: unable to bind listening socket for address

     '127.0.0.1:9000': Address already in use (98)

    netstat -lntup | grep 9000 <==查看端口是否开启

    # killall php-fpm    <==关闭进程

    # systemctl start php-fpm.service     <==启动

    # systemctl status php-fpm.service

    启动成功:

  • 相关阅读:
    Java RunTime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. ......
    UVA 1597 Searching the Web
    UVA 1596 Bug Hunt
    UVA 230 Borrowers
    UVA 221 Urban Elevations
    UVA 814 The Letter Carrier's Rounds
    UVA 207 PGA Tour Prize Money
    UVA 1592 Database
    UVA 540 Team Queue
    UVA 12096 The SetStack Computer
  • 原文地址:https://www.cnblogs.com/webttt/p/10308476.html
Copyright © 2011-2022 走看看