ThinkPHP5框架
2018-07-25 本文已影响0人
Super三脚猫
ThinkPHP5 + Lamp
ThinkPHP-Logo.jpg安装省心的 Lamp命令:
(虽然看上去是Lnmp 但是它是Lamp,留意最后字母)
wget http://soft.vpser.net/lnmp/lnmp1.5beta.tar.gz -cO lnmp1.5beta.tar.gz && tar zxf lnmp1.5beta.tar.gz && cd lnmp1.5 && ./[install.sh](install.sh) lamp
ThinkPHP5用Composer安装命令看官网文档
安装完配置项目
域名配置不用说了,
配置apache :
<VirtualHost *:80>
ServerAdmin webmaster@example.com
php_admin_value open_basedir "/vagrant/tp5/:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/vagrant/tp5/public"
ServerName www.tp5.com
ServerAlias tp5.com
#ErrorLog "/home/wwwlogs/www.tp5.com-error_log"
#CustomLog "/home/wwwlogs/www.tp5.com-access_log" combined
<Directory "/vagrant/tp5/public">
SetOutputFilter DEFLATE
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
配置好域名了项目打不开?
第一步:
第一种打开报错办法:
打开 php.ini 的 disable_errors 改为 On;
或者第二种办法:
在入口文件index.php中加入
error_reporting(E_ALL);
ini_set('display_errors', '1');
>转载CSDN[TP5项目500错误](https://blog.csdn.net/kchangfu/article/details/78148796)
下面的报错近似于Laravel,但是Laravel在
composer update
时候最起码有报错提醒,TP5如果不在入口文件里加代码是出现不了报错的,让你很迷茫的500错误!
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/mz.kchangfu.cn/thinkphp/start.php) is not within the allowed path(s): (/home/wwwroot/mz.kchangfu.cn/public/:/tmp/:/proc/) in /home/wwwroot/mz.kchangfu.cn/public/index.php on line 22
Warning: require(/home/wwwroot/mz.kchangfu.cn/thinkphp/start.php): failed to open stream: Operation not permitted in /home/wwwroot/mz.kchangfu.cn/public/index.php on line 22
Fatal error: require(): Failed opening required '/home/wwwroot/mz.kchangfu.cn/public/../thinkphp/start.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/mz.kchangfu.cn/public/index.php on line 22
第二步:
打开
apache
的配置文件vhost
你的域名.conf 文件 搜索open_basedir
执行下面操作
php_admin_value open_basedir "/vagrant/tp5/public:/tmp/:/var/tmp/:/proc/"
修改为
php_admin_value open_basedir "/vagrant/tp5/:/tmp/:/var/tmp/:/proc/"
就是去掉了'public'的路径就能访问了
重启apache:service httpd restart
第三步:看到页面
十年磨一剑.png访问项目报错缓存cache
runtime.png类似于Laravel的
storage
文件夹,需要给予权限sudo chmod -R 777 runtime
*附
Linux 定时命令
【设置】crontab -e
【demo】0 8 * * * curl https://xxxx/xxxx >> /cron.log
【查看】crontab -u root -l