简体   繁体   English

同一页面在不同端口上的结果不同:cakephp

[英]Different result for same page on different ports : cakephp

I am new to cakephp, and following the 'Bookmarkers Tutorial'. 我是Cakephp的新手,并且关注“书签指南”。 I get to know that I can access the project using two kind of urls(I am using apache and the folder is located at /var/www/html/bookmarker): 我知道我可以使用两种URL来访问该项目(我正在使用apache,并且该文件夹位于/ var / www / html / bookmarker):

localhost:8765 本地主机:8765

and

localhost/bookmarker 本地主机/书签

Now, when I use the first url, I get the following warning message on top: 现在,当我使用第一个网址时,我会在顶部得到以下警告消息:

warning(2) : file_put_contents(/var/www/html/bookmarker/logs/error.log): failed to open stream: Permission denied [CORE/src/Log/Engine/FileLog.php, line 133] 警告(2):file_put_contents(/var/www/html/bookmarker/logs/error.log):无法打开流:权限被拒绝[CORE / src / Log / Engine / FileLog.php,第133行]

But is not the case with the second url ! 但是第二个URL并非如此!

Why is there such a difference b/w these two urls? 为什么这两个网址有这样的区别? Which one should be used? 应该使用哪一个? And how to resolve that message appearance? 以及如何解决该消息出现? Any help is greatly appreciated! 任何帮助是极大的赞赏!

It's two servers here. 这里是两个服务器。 "localhost:8765" is the server built-in by CakePHP when you run the command: "bin/cake server" but you already have Apache web server at "localhost", so you don't need it. 当运行命令:“ bin / cake server”时,“ localhost:8765”是CakePHP内置的服务器,但是您已经在“ localhost”处具有Apache Web服务器,因此不需要它。

And 2 servers being ran by 2 users: 2个服务器由2个用户运行:

  • localhost:8765 is you 本地主机:8765是你
  • localhost is apache 本地主机是Apache

That's why you don't have permission to write log file (owned by apache) Just stop the server built-in (bin/cake server), and use Apache server (2nd URL) 这就是为什么您没有写日志文件(apache拥有)的权限的原因,只需停止内置的服务器(bin / cake服务器),然后使用Apache服务器(第二个URL)

In case you want to use the server built-in, stop Apache server and remove everything inside "/var/www/html/bookmarker/logs/", the error message will gone. 如果要使用内置服务器,请停止Apache服务器并删除“ / var / www / html / bookmarker / logs /”中的所有内容,该错误消息将消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM