用composer 安装 laravel 的时候总是提示需要安装一大堆拓展

问答中心分类: PHP用composer 安装 laravel 的时候总是提示需要安装一大堆拓展
密码很简单 提问 3周 前

To enable extensions, verify that they are enabled in your .ini files:
– /etc/php/7.2/cli/php.ini
– /etc/php/7.2/cli/conf.d/10-opcache.ini
– /etc/php/7.2/cli/conf.d/10-pdo.ini
– /etc/php/7.2/cli/conf.d/20-calendar.ini
– /etc/php/7.2/cli/conf.d/20-ctype.ini
– /etc/php/7.2/cli/conf.d/20-exif.ini
– /etc/php/7.2/cli/conf.d/20-fileinfo.ini
– /etc/php/7.2/cli/conf.d/20-ftp.ini
– /etc/php/7.2/cli/conf.d/20-gettext.ini
– /etc/php/7.2/cli/conf.d/20-iconv.ini
– /etc/php/7.2/cli/conf.d/20-json.ini
– /etc/php/7.2/cli/conf.d/20-phar.ini
– /etc/php/7.2/cli/conf.d/20-posix.ini
– /etc/php/7.2/cli/conf.d/20-readline.ini
– /etc/php/7.2/cli/conf.d/20-shmop.ini
– /etc/php/7.2/cli/conf.d/20-sockets.ini
– /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
– /etc/php/7.2/cli/conf.d/20-sysvsem.ini
– /etc/php/7.2/cli/conf.d/20-sysvshm.ini
– /etc/php/7.2/cli/conf.d/20-tokenizer.ini
You can also run `php –ini` inside terminal to see which files are used by PHP in CLI mode.

3 问题
oneinstack 回答 3周 前
/usr/local/php/bin/php composer
密码很简单 回答 3周 前

要用php的绝对路径安装composer才能解决方案

/usr/local/php/bin/php  -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
/usr/local/php/bin/php  -r "if (hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
/usr/local/php/bin/php  composer-setup.php
./composer.phar composer create-project --prefer-dist laravel/laravel alimama 5.6.*

如果中途碰见了:

  The Process class relies on proc_open, which is not available on your PHP installation.

那么可以在/usr/local/php/etc  下面的php.ini中寻找到disable_functions选项(disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen),然后把后面一堆选项注释掉,然后重启 service php-fpm restart  再执行

./composer.phar composer create-project --prefer-dist laravel/laravel alimama 5.6.*
oneinstack 回答 3周 前

是要绝对路径,默认composer不会找路径/usr/local/php/bin