Linux下composer及laravel的安装

1、安装composer

(1)安装composer,管道后面是你的php的安装路径,如果是yum或sudo安装的php,直接写php,我是源码编译的

[root@localhost php-7.0.14]# curl -sS https://getcomposer.org/installer | /usr/local/php-7.0.14/bin/php

(2)安装成功后,会在当前目录下,出现一个composer.phar的文件,移动composer.phar以便于全局使用

[root@localhost php-7.0.14]# mv composer.phar /usr/local/bin/composer

(3)测试,输入composer,出现以下便成功

[root@localhost php-7.0.14]# composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.5.5 2017-12-01 14:42:57

Usage:
  command [options] [arguments]

(4)切换国内源,使用composer下载会更快

[root@localhost php-7.0.14]# composer config -g repo.packagist composer https://packagist.phpcomposer.com


2、安装laravel

(1)使用composer安装

[root@localhost www]# composer create-project --prefer-dist laravel/laravel MRedis
(2)安装成功后,将根目录下的server.php改为index.php

(3)nginx的全部配置

  location / {
        # root   /usr/share/nginx/html;
        # index  index.html index.htm;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ .*\.(js|css|png|jpg|woff2|woff|ttf|log)$ {
        root            /data/www/MRedis;
    }

    location ~ \.php$ {
        root           /data/www/MRedis;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

(4)访问,出错

The stream or file "/data/www/MRedis/storage/logs/laravel.log" could not be opened: failed to open s
解决办法:

[root@localhost conf.d]# chmod 777 /data/www/MRedis/storage
[root@localhost conf.d]# chmod 777 /data/www/MRedis/storage/logs

(5)再次访问,还是出错

The stream or file "/data/www/MRedis/storage/framework/views/xxxxxxx" could not be opened: failed to open s
终极解决办法:将storage下的所有目录的权限全都改为777

[root@localhost conf.d]# chmod -R 777 /data/www/MRedis/storage
(6)再次访问,成功








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值