我在webfaction上托管了越来越多的网站.好提供者!我遇到了一些我认为与Linux有关的问题.希望有人能提供帮助.
SSH命令php -v
默认为较旧版本的php,所以我在my中创建了一个别名.bash_profile
:
alias composer="php70 $HOME/composer.phar" alias php="php70"
当我预先形成一个php -v
现在它返回PHP 7.0.到现在为止还挺好!
PHP 7.0.0 (cli) (built: Dec 4 2015 12:58:58) ( NTS )
但现在当我运行一个作曲家安装并php -v
在我的composer.json
文件中放入一个脚本 - > post-install-cmd列表时:
{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.5.9", "laravel/framework": "5.1.*" }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.*", "phpunit/phpunit": "~4.0", "phpspec/phpspec": "~2.1" }, "autoload": { "classmap": [ "database" ], "psr-4": { "App\\": "app/" } }, "autoload-dev": { "classmap": [ "tests/TestCase.php" ] }, "scripts": { "post-install-cmd": [ "php -v", "php artisan clear-compiled", "php artisan optimize" ], "pre-update-cmd": [ "php artisan clear-compiled" ], "post-update-cmd": [ "php artisan optimize" ], "post-root-package-install": [ "php -r \"copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "php artisan key:generate" ] }, "config": { "preferred-install": "dist" }
}
现在tt再次返回旧的PHP版本,请看这个截图:
也许这对你们/女孩来说似乎是完全逻辑的,但我被困在这里.
好吧,Composer不使用你的别名来执行PHP.
您可以使用php70 -v
in composer.json
,但最好将较新的PHP版本符号链接/bin/php
,以便Composer可以选择它:
创建一个~/bin
文件夹
mkdir ~/bin
然后将较新的PHP版本符号链接/usr/local/bin/php70
到~/bin/php
ln -s /usr/local/bin/php70 ~/bin/php
最后,添加此行以.bash_profile
将此文件夹附加到环境变量PATH.
export PATH="$HOME/bin:$PATH"