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
(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)再次访问,成功