Novice intern made a big mistake

Hi, I’m an intern in a french tech startup, I’ve been working there for two weeks, and for now my main mission have been to update the landing page of the company.
Yesterday, I uploaded my work on the main server to make it available, so i decided to erase all of the website directory to replace it with the “new” landing page.
But, what I didn’t expect, was that by deleting the directory, I also deleted a big part of the website that partners use which was made using cakephp. So when I tried to load this partner’s website it failed to load and displayed an error.
So, I was immediately freaked out and decided to delete the whole website directory to replace it with the old landing page, and the partners part (cakephp).

I thought that it wasn’t going to be a problem since the repository is the same as before when it used to work. But unfortunately it isn’t.
Now I have no idea how to put the cakephp website back online, I don’t know anything about this framework (and i’m not a pro in php either).
The tricky part is that I’n the only tech guy in the company with 3 business guys and 1 designer. So I have to fix the problem, But have no idea how.

Please Help, I have to make the website available as soon as possible.

What I would like to know is, does cake php need some config files outside its main directory ? That could be a reason why it doesn’t work, right ?

Cakephp consists of a main directory, which contains three folders (app, lib, vendors) as well as a .htaccess file and a index.php.

What’s most important is the app folder - this one contains the actual project. The lib folder contains the cakephp files, which you can easily replace. The vendors folder is empty for most projects.

By the way, this structure applies to Cakephp 2 and below, v3 has a somewhat different structure, but I suspect that in your case it most likely isn’t v3, since that is still pretty new.

If you have a backup of the app folder, everything should be fine. If there’s only the repository, you’ll have to add the config files yourself. The only config files that matter are usually within the app/config folder: core.php, database.php and maybe email.php.

These files are normally excluded from the repository, but you can download them from a fresh project (make sure it’s the same version) and fill in all the configuration options (it’s fairly self-explanatory for the most part, and well commented).

If everything fails, you should find out whether automatic backups are being created by the server. Normally, you can restore files that way or revert to a previous version.

Hi, thank you so much for replying
I’m afraid it’s v3 since I have the same structure as described there :

So, as I understood, every file is in the main repository, but i replaced the entire repository with a backup, so, how can it still display an error?

Can you please show us which error you’re getting precisely?

Have you made sure that the config/app.php file is populated with the correct data?

Also, although unlikely, it sometimes helps to delete the cache in tmp/cache/models & persistent.

You can also try to look into the logs/error.log. If anything looks relevant, please post it here.

The chrome console tells me :
“Failed to load resource: the server responded with a status of 500 (Internal Server Error)”

I’m pretty sure that the config/app.php is populated with the correct data, it hasn’t change since last december.

Unfortunately, I don’t have any errors lately in the erros.log

500 errors are normally recorded in logs/error.log, so that’s strange. Have you enabled the debug mode in app.php?

What about the regular php error logs? Anything there?

No, the debug mode isn’t activated, I will activate it !

Where are the regular php error logs ? (Sorry, still a novice in PHP)

Woah! thats a huge mistake. Hope you have been able to fix it? :sweat:

Ok first off let me start by saying this. When you make a mistake like this just fess up to it so that the company can get the project back online! Apologize non-stop and you’r more likely to be forgiven. Your an internet they expect you will make some mistakes and this one really isn’t that bad, although I suppose when your in the situation anyone would freak out.

Secondly the main configuration for cakephp is in config/app.php; however depending on how the repository is setup this file may not exists within it. A lot of companies prevent configurations like this from entering the repository so that ip addresses, database usernames and passwords and other private info can be better protected and configured. It might be that the data has been changed since then otherwise. Unless you copy and paste the original configuration that was deleted you would need to ask someone for this information.

I’m curious as to what happened next please tell!!! lol