Cakephp on nginx causes error 500

Hello everyone!

I have done my cakephp 3 project on xampp, and wanted to put it via ftp on a nginx server. So followed the rules, but I have a 500 error.

I forgot to remove the tmp on the server. I removed it but nothing changed. I don’t know what’s happening because we get absolutely no errors logged.

I’ll send a copy of the nginx config when I get it, it’s a friend’s server.

Thank you for your help!

you can check nginx logs usually in /var/logs/nginx/ i like to add access_log and error_log to point to cake logs dir,

when i have 500 it often helps to just login in ssh cd to webroot and php index.php its usually something simple like folder rights

Hello Graziel and thanks for your help!

We checked the error_log file and there is nothing. So We don’t really know for now.

Anything in the Cake logs?

Hey Zuluru, I checked and saw nothing. Unless I checkd the wrong files but I don’t think I did

Well then, time to start debugging. Try things like put an echo immediately followed by an exit at the top of the index.php. If that still gives the error, then it’s a server configuration (nginx or permissions, for example). If that works, then gradually move it lower and lower until you isolate the line that fails.

Index.php of webroot is that right?

EDIT: Indeed, I tried to echo “hello” and it indeed shows it, so I forgot to do something. I thank you so much!

I tried, and it stops working after the require /config/requirements.php

I looked into it, and it chacks if the php version is superior or equal to 5.6.0. The server runs on php 7.2, maybe that’s the problem?

requirements.php is a bunch of simple checks for you to make sure your env has all neccessary modules, while you say its 7.2 note that you can have different versions for cli and fpm

if you are 100% sure your env has all it needs you can even delete everything from requirements.php as stated in comment there

Tried the echo everywhere but it stops working after that $server->emit($server->run()); line.

I don’t really know what is going on.

it still should give you error anyway when you run it through ssh, its possible you have error display disabled in php.ini you can try adding on top of index.php these lines just to be sure

error_reporting(E_ALL);
ini_set('display_errors', 1);

Have you got debug set to true in your config/app.php?

The error is solved. But now we have a problem. We can’t access anything. No css, no javascript, no other pages are available (error 404)

Even reading the documentation we can’t solve the problem. The server is Nginx. I’ll send more tomorrow,

But the Urls are good.I get the one I want when I click the link, the page just doesn’t appear. Only a 404 error.

But now we have a problem. We can’t access anything. No css, no javascript, no other pages are available (error 404)

Even reading the documentation we can’t solve the problem. The server is Nginx. I’ll send more tomorrow,

But the Urls are good.I get the one I want when I click the link, the page just doesn’t appear. Only a 404 error.
And Yes I had debug activated to check on some errors

500 internal server error?

Now I will tell How To fix 500 internal server error?

Step 1 check .htaccess

Most of the case invalid htacess code . some case after install wordpress plugin .htaccess become corrupted .

So what need to do . step 1 you need to take backup your current .htaccess file . Login to your cPanel and click on file manager then find public_html folder , click on folder and find .htaccess file and rename this file as like you need . example .htaccess_backup.

Read continue

So ehm… how does installing a WordPress plugin affect CakePHP? :^)