Cakephp on nginx causes error 500


#1

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!


#2

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


#3

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.


#4

Anything in the Cake logs?


#5

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


#6

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.


#7

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!


#8

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?


#9

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


#10

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

I don’t really know what is going on.


#11

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);

#12

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


#13

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.


#14

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