thinkphp部署+常见伪静态问题

thinkphp 部署

1:windows下载Composer-Setup.exe,
linux根据文档上提供命令下载composer,
也可直接去下载tp5的文件
2:在网站根目录输入以下命令,
composer create-project topthink/think tp5 dev-master --prefer-dist
3:完成后网站指向public文件下,
进入网站看到十年磨一剑就表示部署成功了!!!‘

中间composer部署出现的问题
composer提示[ErrorException]proc_get_status() has been disabled for security reasons的解决方法
从错误提示信息中可以看到是因为关闭了PHP的proc_get_status()函数,那么如何解决这个问题呢?

打开php.ini文件,搜索 disable_functions,找到如下类似内容:
disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_get_status,proc_open,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,找到proc_get_status并删除然后重启php服务。

解决上面的提示后继续使用composer又出现了新的错误提示:[Symfony\Component\Process\Exception\RuntimeException] The Process class relies on proc_open,

这个是缺少了PHP的proc_open函数,解决方法同样是打开php.ini文件搜索disable_functions,删除disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server中的proc_open并重启php服务。

然后使用composer就正常了,上面两个问题可以看出用composer来安装drupal8模块需开启proc_open和proc_open这两个PHP函数。

关于在网上下载的模板找不到页面问题,需要重写伪静态

重写文件默认是在项目public 下改
apache 是 .htaccess文件
nginx 是 nginx.htaccess文件
apache伪静态

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] 
</IfModule>  

伪静态填入信息,有些下载的模板需要在index.php后加一个?号

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>

nginx伪静态

location / {
		if (!-e $request_filename){
		rewrite  ^(.*)$  /index.php?s=$1  last;   break;
		}
}

注意:宝塔面板部署的模板要去掉防跨站攻击的选项

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值