简体   繁体   中英

database.php not found in cakephp setup

I'm new to cakePHP, and I'm trying to make it works under linux mint.

I'have followed the cakephp website tutorial, but when I get to the database section I get this two warning on my page :

 Warning (2): include_once(/var/www/projects/app/Config/database.php) 
[function.include-once]: failed to open stream: No such file or directory 
[CORE/Cake/Model/ConnectionManager.php, line 67]

Warning (2): include_once() [function.include]: 
Failed opening '/var/www/projects/app/Config/database.php' 
for inclusion 
(include_path='/var/www/projects/lib:.:/usr/share/php:/usr/share/pear') 
[CORE/Cake/Model/ConnectionManager.php, line 67]

And I can't get how to fix them.

But my database.php still is not found when I check /localhost/myProject

You are in the wrong folder. Always navigate to your APP dir and call the cake console relativly from there

cd c:\\wamp\\www\\project\\app\\ and execute the command in this folder

\\Console\\cake [command]

在目录/ var / www / projects / app / Config /中找到文件database.php.default并将此文件重命名为database.php

Please check your .htaccess files, It should be like this :

In your projects(root) folder :

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^$ app/webroot/ [L]
   RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

In your projects/app folder :

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1    [L]
</IfModule>

In your projects/app/webroot folder :

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

Hope, this may help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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