在 centos7上安装php7.1以及composer的时候,遇到了一些坑,记录下,方便后面踩坑的人迅速定位问题。
安装php7.1:
代码语言:javascript复制yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
#其他php版本更换remi-php71即可。
yum-config-manager --enable remi-php71
yum -y install php
安装redis:
代码语言:javascript复制yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/r/redis-3.2.12-2.el7.x86_64.rpm
#启动redis:
service redis start
安装composer:
代码语言:javascript复制curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
ln -s /usr/local/php /usr/local/bin/php
安装composer之后,启动更新会报错,报错如下:
代码语言:javascript复制Problem 1
- Installation request for magento/product-enterprise-edition 2.0.2 -> satisfiable by magento/product-enterprise-edition[2.0.2].
- magento/product-enterprise-edition 2.0.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php5/cli/php.ini
- /etc/php5/cli/conf.d/05-opcache.ini
- /etc/php5/cli/conf.d/10-pdo.ini
- /etc/php5/cli/conf.d/20-curl.ini
- /etc/php5/cli/conf.d/20-imap.ini
- /etc/php5/cli/conf.d/20-json.ini
- /etc/php5/cli/conf.d/20-mcrypt.ini
- /etc/php5/cli/conf.d/20-pdo_pgsql.ini
- /etc/php5/cli/conf.d/20-pgsql.ini
- /etc/php5/cli/conf.d/20-pspell.ini
- /etc/php5/cli/conf.d/20-readline.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
解决办法:
代码语言:javascript复制yum install php71-php-process.x86_64 -y
启动php GatewayMan程序后,可能会出现以下错误:
代码语言:javascript复制php start.php start
Please install posix extension. See http://doc3.workerman.net/appendices/install-extension.html
原因是因为posix扩展缺失,解决办法:
代码语言:javascript复制yum install -y php-process
然后进行测试:
代码语言:javascript复制curl -Ss http://www.workerman.net/check.php | php
PHP Version >= 5.3.3 [OK]
Extension pcntl check [OK]
Extension posix check [OK]
最后,php start.php start启动即可。