2015-08-15 107 views
1

我可以用composer安裝laravel 5.0,沒有任何問題。但是當我嘗試安裝laravel 5.1時,我被拒絕了權限。Laravel 5.1從作曲家問題安裝 - 權限被拒絕

這是我所得到的,如果我跑:

composer create-project laravel/laravel MyProjectName 

Installing laravel/laravel (v5.1.4) 
    - Installing laravel/laravel (v5.1.4) 
    Loading from cache 

Created project in schoollege 
> php -r "copy('.env.example', '.env');" 
Loading composer repositories with package information 
Installing dependencies (including require-dev) 
    - Installing vlucas/phpdotenv (v1.1.1) 
    Loading from cache 

    - Installing symfony/var-dumper (v2.7.3) 
    Loading from cache 

    - Installing symfony/translation (v2.7.3) 
    Loading from cache 

    - Installing symfony/routing (v2.7.3) 
    Loading from cache 

    - Installing symfony/process (v2.7.3) 
    Loading from cache 

    - Installing psr/log (1.0.0) 
    Loading from cache 

    - Installing symfony/debug (v2.7.3) 
    Loading from cache 

    - Installing symfony/http-foundation (v2.7.3) 
    Loading from cache 

    - Installing symfony/event-dispatcher (v2.7.3) 
    Loading from cache 

    - Installing symfony/http-kernel (v2.7.3) 
    Loading from cache 

    - Installing symfony/finder (v2.7.3) 
    Loading from cache 

    - Installing symfony/dom-crawler (v2.7.3) 
    Downloading: 100%   



    [ErrorException]                                 
    copy(/home/myusername/.composer/cache/files/symfony/dom-crawler/9dabece63182e95c42b06967a0d929a5df78bc35.zip): failed to open stream: Permission denied                                   



create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [package] [directory] [version] 

/var/www/html文件夾內這樣做。該/var/www文件夾在www-data組已經上市www-data有權限drwxrwxr-x

解決方案我試過,但沒有他們的工作:

  • 作曲家clearcache
  • 作曲家創建項目laravel/laravel MyProjectName 5.1
  • 作曲家自我更新

什麼可能是我可能的ssue?

P.S:我在Ubuntu 14.04 LTS x64位架構上使用LAMP。

回答

1

當您運行artisan命令時,您不是作爲www-data用戶運行,而是作爲您的用戶運行。如果您的用戶不是root,你應該sudo執行該命令,或者su www-data,或者(更好的),您可以將您的用戶名添加到WWW的數據組,就像這樣:

sudo useradd -g www-data youruser 

希望它能幫助。 ;)

0

由於作曲家已經過半在「權限被拒絕」的地步,你需要先清除緩存以下拉斐爾的指令:

php artisan cache:clear 
composer dump-autoload 

(從https://stackoverflow.com/a/24369509/1627732

,然後做:

sudo useradd -g www-data yourusername