【问题标题】:CakePHP can not find webroot/css/js filesCakePHP 找不到 webroot/css/js 文件
【发布时间】:2015-12-04 13:46:37
【问题描述】:

我只是通过 svn controle 版本将一个 CakePHP 2.5.2 应用程序下载到测试服务器。

数据库配置后,应用不会打开位于app/webroot dir(bootstrap、jquery、main.css)的css文件。

是一些额外的配置参数吗?

我尝试更改所有者,但没有成功。

【问题讨论】:

  • 确保 app/tmp 是可写的,并且 /app/Config/core.php Configure::write('debug', 2);987654322@中的调试至少为 2
  • 它们是位于 app/webroot/css 还是像你在 app/webroot 中写的那样?
  • @Yash 这是一个普通的 cakephp 安装没什么特别的
  • @WayNe 他们在 app/webroot/css 。文件确实存在
  • @InigoFlores 调试已配置为级别 2

标签: cakephp cakephp-2.5 cakephp-2.x


【解决方案1】:

看起来像mod_rewrite 问题。

确保您的DocumentRoot 中有.htaccess,并且您的Apache 服务器配置正确。

CookBook 中详细描述了所有内容。

CakePHP 2.x URL Rewriting


编辑:如 cmets 中所述,OP 通过将 apache vhost 配置文件 (/etc/apache2/sites-available/default.conf) 中的 Directory 定义替换为以下内容来解决此问题:

<Directory /var/www/> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride FileInfo 
    Order Allow,Deny
    Allow from all 
</Directory>

【讨论】:

  • mod_rewrite 已启用使用 apache2ctl -M 进行检查,这些是 .htacces 中存在的规则:&lt;IfModule mod_rewrite.c&gt; RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] &lt;/IfModule&gt;
  • 解决了!编辑 /etc/apache2/sites-available/default.conf 后添加:&lt;Directory /var/www/&gt; Options Indexes FollowSymLinks MultiViews # changed from None to FileInfo AllowOverride FileInfo Order allow,deny allow from all &lt;/Directory&gt; 感谢支持。
  • 是的!对于使用 apache 2.4+ 的用户,它将是 apache2.confhttps.conf。遵循docs的更多说明
猜你喜欢
  • 2013-07-24
  • 1970-01-01
  • 2011-08-29
  • 1970-01-01
  • 2012-08-16
  • 2013-03-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多