环境布置脚本

  1. Laravel框架
yum install -y systemd-devel  libxml2-devel openssl-devel 

php-7.2.32
按照Laravel官网给出的安装要求:
https://laravel.com/docs/6.x,结合php-docker配置文件的安装路径
得到下面的编译选项

./configure \
--with-libdir=/lib64 \
--with-config-file-path=/usr/local/etc/php \
--with-config-file-scan-dir=/usr/local/etc/php/conf.d \
--enable-cli \
--disable-cgi \
--enable-fpm \
--with-fpm-systemd \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-phar \
--with-pear  \
--disable-all \
--enable-pdo  \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-bcmath\
--enable-ctype\
--enable-fileinfo\
--enable-json\
--enable-mbstring\
--with-openssl\
--enable-tokenizer\
--enable-xml

然后提示

Configuring PEAR
checking whether to install PEAR... yes
configure: error: 
                    PEAR requires XML to be enabled.     Add --enable-xml to the configure line.


configure: error: XML extension requires LIBXML extension, add --enable-libxml

最新版

./configure --with-libdir=/lib64\
--with-config-file-path=/usr/local/etc/php\
--with-config-file-scan-dir=/usr/local/etc/php/conf.d\
--enable-cli\
--disable-cgi\
--enable-fpm\
--with-fpm-systemd\
--with-fpm-user=nginx\
--with-fpm-group=nginx\
--enable-phar\
--with-pear\
--disable-all\
--enable-pdo\
--enable-mysqlnd\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--enable-bcmath\
--enable-ctype\
--enable-fileinfo\
--enable-json\
--enable-mbstring\
--with-openssl\
--enable-tokenizer\
--enable-xml\
--enable-libxml

安装完成后

php -m

[PHP Modules]
bcmath
Core
ctype
date
fileinfo
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
Phar
Reflection
SPL
standard
tokenizer
xml

[Zend Modules]

在安装目录下就有php.ini-development
cp /usr/local/php-7.2.32/php.ini-development /usr/local/etc/php/php.ini

有一个问题:/usr/local/etc 这个目录在编译php前存在么?

然后,安装composer

curl -sS https://getcomposer.org/installer | php

得到

Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The filter extension is missing.
Install it or recompile php without --disable-filter

The hash extension is missing.
Install it or recompile php without --disable-hash

然后,我们的PHP编译参数变为如下版本:

./configure\
--with-libdir=/lib64\
--with-config-file-path=/usr/local/etc/php\
--with-config-file-scan-dir=/usr/local/etc/php/conf.d\
--enable-cli\
--disable-cgi\
--enable-fpm\
--with-fpm-systemd\
--with-fpm-user=nginx\
--with-fpm-group=nginx\
--enable-phar\
--with-pear\
--disable-all\
--enable-pdo\
--enable-mysqlnd\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--enable-bcmath\
--enable-ctype\
--enable-fileinfo\
--enable-json\
--enable-mbstring\
--with-openssl\
--enable-tokenizer\
--enable-xml\
--enable-libxml\
--enable-filter\
--enable-hash\

然后,成功安装composer

curl -sS https://getcomposer.org/installer | php
Downloading...

Composer (version 1.10.9) successfully installed to: /usr/local/php-7.2.32/ext/hash/composer.phar
Use it: php composer.phar

Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:

The zlib extension is not loaded, this can slow down Composer a lot.
If possible, install it or recompile php with --with-zlib

The php.ini used by your command-line PHP is: /usr/local/etc/php/php.ini
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.

于是,最新版的编译参数为

./configure\
--with-libdir=/lib64\
--with-config-file-path=/usr/local/etc/php\
--with-config-file-scan-dir=/usr/local/etc/php/conf.d\
--enable-cli\
--disable-cgi\
--enable-fpm\
--with-fpm-systemd\
--with-fpm-user=nginx\
--with-fpm-group=nginx\
--enable-phar\
--with-pear\
--disable-all\
--enable-pdo\
--enable-mysqlnd\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--enable-bcmath\
--enable-ctype\
--enable-fileinfo\
--enable-json\
--enable-mbstring\
--with-openssl\
--enable-tokenizer\
--enable-xml\
--enable-libxml\
--enable-filter\
--enable-hash\
--with-zlib\

然后composer global require laravel/installer报错,貌似是缺少zip
dom

xmlwriter

你可能感兴趣的:(环境布置脚本)