有幾個步驟一定要記得:1. 到 /etc/php/php.ini
把相關的 extension 打開。2. 建立 ~/.composer/vendor/bin/
資料夾。3. 安裝相關的 php 套件。
1. 安裝相關套件
yaourt -S php composer php-mcrypt
2. 在 /etc/php/php.ini 打開 php extension
找到以下幾個 extension, 將前面的 ;
給去除
extension=mcrypt.so
extension=pdo_mysql.so
extension=mysqli.so
extension=xmlrpc.so
extension=zip.so
注意,你不需要把 openssl.so 給打開,在 php7 已經內建。打開的話會觸發錯誤:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/openssl.so’ – /usr/lib/php/modules/openssl.so: cannot open shared object file: No such file or directory in Unknown on line 0
3. 建立 composer 資料夾
mkdir -p ~/.composer/vendor/bin/
export $PATH=$PATH:~/.composer/vendor/bin/
沒有建立資料夾的話,在安裝 lavarel 的時候 composer global require "laravel/installer"
會觸發下列錯誤:
➜ laravel composer global require “laravel/installer”
Changed current directory to /home/grd/.config/composer
Using version ^1.3 for laravel/installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.Problem 1
– The requested package laveral/installer could not be found in any version, there may be a typo in the package name.Potential causes:
– A typo in the package name
– The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
Leave a Reply