3

I moved a site from staging to live. Prior to moving, I logged in to the Craft admin and cleared the caches. I copied the db to the new one and moved the folders like so…

from…
home/subdomains/craft
home/subdomains/staging

to…
home/craft
home/public_html

I’m getting this in the server log…
[28-May-2017 20:01:30 UTC] PHP Fatal error: Class 'Craft\DbCommand' not found in /home/wenzelspine/craft/app/etc/db/DbConnection.php on line 28

And this in storage/runtime/logs…
2017/05/28 21:33:05 [error] [php] Declaration of Craft\DbCommand::addForeignKey() should be compatible with CDbCommand::addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = NULL, $update = NULL) (/home/wenzelspine/craft/app/etc/db/DbCommand.php:15)

2017/05/28 21:33:05 [trace] [system.CModule] Loading "errorHandler" application component

3
  • 1
    I'm confused by your example folder structure to start with. You might consider adding vastly more detail (folder structure, host configuration, actual log lines with full error messages, etc.) to this question, or dropping by #help in the Craft CMS Slack group. To me it feels vaguely like missing files, an insufficient host configuration, or something not actually Craft related—it's just hard to tell.
    – Matt Stein
    Commented May 27, 2017 at 15:43
  • Would you mind moving your comments into the question itself, Howard? The goal is to have a really solid, fleshed-out question to draw equally solid, fleshed-out answers.
    – Matt Stein
    Commented May 28, 2017 at 22:12
  • 1
    OK, I updated the question to reflect the full details. Thanks. Commented May 28, 2017 at 23:24

3 Answers 3

2

Howard, craft itself doesn't break like that, in my experience.

  • set devMode true in config/general.php
  • try the url again, then look at the logs for craft and php, in craft/storage/runtime/logs
  • if you don't see anything, look at the php log on the server..

The clue should be there.

8
  • Hmmm. So one thing I see is this… 2017/05/26 22:28:37 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in /home/wenzelspine/subdomains/craft/app/controllers/TemplatesController.php:72 Does that mean it’s still looking at the subdomain? IF so, where can I fix this? Commented May 27, 2017 at 3:33
  • Also see some PHP errors like this in debug… /home/wenzelspine/craft/app/etc/web/WebApp.php(687): CApplication­>handleError(2048, "Declaration of Craft\DbCommand::addForeignKey() should be compat...", "/home/wenzelspine/craft/app/etc/db/DbCommand.php", 15) Commented May 27, 2017 at 3:39
  • And this… Fatal error: Class 'Craft\DbCommand' not found in /home/wenzelspine/craft/app/etc/db/DbConnection.php on line 28 Commented May 27, 2017 at 3:40
  • Well, that is all pretty wierd -- and inconsistent. Some of your errors in subdomain, some apparently in main domain, given you copied in the paths texts. Maybe they are from different moments as you attempted this? I'd do the following, per Matt Stein's advice above: a) change the name of the subdomain folder, get it out of there. b) if this doesn't bring clearer errors, remove the wenzelspine/craft/app folder and replace it with assured code. Sftping the release zip to the server and unzipping there is a good way. And then if these don't lead you well, what Matt further suggests is good.... Commented May 27, 2017 at 22:10
  • code2017/05/28 19:56:38 [error] [php] Declaration of Craft\DbCommand::addForeignKey() should be compatible with CDbCommand::addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = NULL, $update = NULL) (/home/wenzelspine/craft/app/etc/db/DbCommand.php:15) code2017/05/28 19:56:38 [trace] [system.CModule] Loading "errorHandler" application component Commented May 28, 2017 at 20:12
2

Solution: I'm still having trouble getting help from my host, but after trying a clean install of Craft at public_html and getting the same error, I went elsewhere and it worked flawlessly. Thanks for all your help. Sorry it was such a wild goose chase.

1
  • 1
    Glad you;re on the air -- and at least know a better hosting provider. I think the value here is that we covered a lot of steps others might take for more ordinary Server 500 responses. Take care. Commented May 29, 2017 at 2:08
1

Howard, I'm posting another possibility here to be sure you'll be notified -- can edit it back into original answer or a comment later.

It kind of dawned on me that when you produced the second installation, quite possibly you simply copied everything over from the original. If so, you would have copied the cache content, as well as the code.

This could account for what your logs say -- parts being missing apparently, as addressed still on the subdomain code tree -- as well as Craft mysteriously just not working. That's because the pre-complied php holds the old paths.

The fix for this would be straightforward - first, cp or sftp out any logs you think you'd want to keep: - then, if on Craft 2, cd to craft/storage/runtime, then run rm -rf * - similarly, if on Craft 3, cd to storage/runtime, then run rm -rf * - pro tip: do be sure where you are carefully, before doing the rm -rf *

If this diagnosis is correct, and your config is ok, then Craft should just start up properly once this clearing is done. Let us know...

2
  • I cleared the cache in Craft settings before making the move. I think the reason for the mixed path messages was because I was looking at old logs. I just started there were no references to the subdomain in the new log file. I posted the two errors I did find in my comment below. Still waiting for feedback from my host about the server logs. Commented May 28, 2017 at 20:17
  • Ok, fair enough. I'm going to leave this extra solution up, as it may help someone else. Glad you saw so at first, and best fortune getting this sorted. Commented May 28, 2017 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.