编译安装最新PHP 7.4 alpha

编译安装

  • wget https://downloads.php.net/~derick/php-7.4.0alpha1.tar.gz
  • 解压 tar xvf php-7.4.0alpha1.tar.gz
  • 进入目录
  • 然后 ./buildconf
  • 因为我要安装 PHP 到目录 /www/server/php/74,你可以改成其他目录(如 /usr/local/php/74),也可以用这个目录。
  • ./configure --prefix=/www/server/php/74 --with-config-file-path=/www/server/php/74/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-openssl=/usr/local/openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-gettext --enable-fileinfo --enable-opcache --with-sodium
  • 安装配置选项1:

    ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql  --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-openssl --enable-pdo_mysql --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip

    安装配置选项2:

    ./configure --prefix=/www/server/php/74 --with-config-file-path=/www/server/php/74/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-openssl=/usr/local/openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-gettext --enable-fileinfo --enable-opcache --with-sodium
    
  • 这个过程中,提示:No package 'sqlite3' found
  • 百度 谷歌查找解决办法 yum install sqlite-devel
  • 再次运行上方的 configure 命令
  • 此时提示 No package 'oniguruma' found
  • 安装 oniguruma,可以参考 https://github.com/kkos/oniguruma#install
    • yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm
    • yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm
  • 此时回到 PHP 源码目录,make clean
  • 再次执行上方提到的 configure 的命令
  • 此时执行成功,随后执行 make -j4
  • make install
  • 如果没有出现 error,表明安装成功!
  • 如果你要把这新安装的 PHP 作为默认的 PHP 环境,可以建立软连接,链接到 /usr/bin 下

 

ln -s /www/server/php/74/bin/php /usr/bin/php;
ln -s /www/server/php/74/bin/phpize /usr/bin/phpize;
ln -s /www/server/php/74/bin/php-config /usr/bin/php-config;
ln -s /www/server/php/74/bin/phpdbg /usr/bin/phpdbg;
ln -s /www/server/php/74/bin/php-cgi /usr/bin/php-cgi;

参考资料

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值