• 多个PHP版本环境搭建(nginx,php)


    下载多个php版本 下载地址

    扩展一下rpm源

    wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm  (rpm文件可能有更新)
    rpm -ivh epel-release-7-2.noarch.rpm
    yum update
    yum ...
    

    安装依赖库 freetype gd zlib mcrypt(通过yum search找到对应的依赖源 devel)

    yum -y install aspell-devel

    ./buildconf

    configure

    ./configure --prefix=/usr/local/php55 --enable-opcache --enable-fpm --enable-pdo --enable-sockets --enable-exif --enable-soap --enable-ftp --enable-wddx --enable-pcntl --enable-soap --enable-bcmath --enable-mbstring --enable-dba --enable-gd-native-ttf --enable-gd-jis-conv --enable-zip --enable-calendar --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-mysqli --with-pdo-mysql --with-pdo-sqlite --with-iconv --with-gmp  --with-gettext --with-xmlrpc --with-openssl --with-mhash --with-mcrypt --with-xsl --with-curl --with-pcre-regex --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --with-gettext --with-zlib --with-bz2 --with-recode --with-ldap --with-pear --with-readline
    
    

    added to Makefile to EXTRA_LIBS at the end "-llber" (报错 ber_scanf

    生成的Makefile文件 找到首字为EXTRA_LIBS 加上 -llber选项

    make

    make install (可能有个phar.phar报错,按照错误提示将源码中的文件cp过来即可)

    检查是否成功

    /usr/local/php55/bin/php -v
    成功截图
    /usr/local/php55/sbin/php-fpm
    报错,没有找到fpm配置文件。
    sudo find / -name php-fpm.conf*
    sudo cp /usr/local/php55/etc/php-fpm.conf.default /usr/local/php55/etc/php-fpm.conf
    sudo /usr/local/php55/sbin/php-fpm 成功启动

    php配置文件需要cp
    /soft/php-5.5.37/php.ini-development //编译目录
    /usr/local/php55/lib/php.ini


    其他版本的php安装

    其他版本的安装只要改configure 的prefix选项(安装位置)
    定义不同的php-fpm启动端口

    php7多一个操作 sudo cp -r /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
    sudo vim /usr/local/php7/etc/php-fpm.d/www.conf 修改默认端口 9000


    端口开发 以及nginx配置

    location ~ .php$ {
    
    root html;
    
    fastcgi_pass 127.0.0.1:9000;
    
    fastcgi_index index.php;
    
    fastcgi_param SCRIPT_FILENAME web根目录$fastcgi_script_name;
    
    include fastcgi_params;
    
    }
    

    查看防火墙开放端口

    iptables -vnL

    开放端口命令

    sudo iptables -I INPUT -p tcp --dport 9001 -j ACCEPT

    查看本地开发端口 netstat -tpln


    其他问题的一些报错###

    编译php5.3报错:
    error: libXpm.(a|so) not found.
    ln -s /usr/lib64/libXpm.so* /usr/lib/

    You need autoconf 2.59 or lower to build this version of PHP.
    yum install autoconf213
    export PHP_AUTOCONF=/usr/bin/autoconf-2.13

    configure: error: Please reinstall the mysql distribution
    --with-mysql-dir=/usr/bin/mysql --with-mysql=/usr/bin/mysql

  • 相关阅读:
    Python函数参数学习笔记
    Python基础笔记
    winform碎片
    常用sql语句
    《零基础入门学习Python》学习过程笔记【021匿名函数】
    统计下边这个长字符串中各个字符出现的次数并找到小甲鱼送给大家的一句话
    《零基础入门学习Python》学习过程笔记【020函数的局部变量和全全局变量内部函数和闭包】
    编写一个函数,分别统计出传入字符串参数(可能不止一个参数)的英文字母,空格,数字和其他字符的个数
    写一个函数,判断一个字符串是否为回文联
    《零基础入门学习Python》学习过程笔记【019函数返回值问题】
  • 原文地址:https://www.cnblogs.com/canbefree/p/5663090.html
Copyright © 2020-2023  润新知