Symfony4 website getting error 500

My website URL is : ImmoNova.epizy.com

What I’m seeing is:
Oops! An Error Occurred
The server returned a “500 Internal Server Error”.
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

This wbesite was devleopped with symfony4.
There is no error file in htdocs/var/log/.

My project was uploaded in /htdocs/
and this is my .htaccess :

php_value display_errors On
php_flag magic_quotes 1
php_flag magic_quotes_gpc 1
php_value mbstring.http_input auto
php_value date.timezone Europe/Paris
DirectoryIndex public/index.php


Options -MultiViews

RewriteEngine On
# Redirect Trailing Slashes…
RewriteRule ^(.)/$ /$1 [L,R=301]
# Handle Front Controller…
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
#Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .
- [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

1 Like

Normally if there are errors my code will show them

I moved your topic to the appropriate category.

Some scripts and frameworks explicitly override the default PHP error handler (for more fine grained error handling) or suppress error messages in their application entirely (because no errors means everything is good I guess? it’s stupid, but sadly common). .htaccess rules can control what PHP and/or Apache does with the error passed through the default error handler of PHP, but errors handled elsewhere is not picked up.

I’m not too well versed with Symfony (I’ve mostly used Laravel), but I suspect Symfony also handles errors internally. Which means that you may find a log file somewhere else in your website which contains these errors. The Symfony documentation may help you with this: Logging (Symfony Docs)

If you can’t find the log files, Symfony may also offer a debug mode which you can enable to get more information.

2 Likes

Ok So the problem was in .env.prod database credentials was wrong.
But now I’m trwing to import my database schema from a file and I get :

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'json NOT NULL, password varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, ' at line 10

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `username` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL,
  `roles` json NOT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

I dunno is it a format on Mysql but you can replace it with varchar(250) or string one. And note: InnoDB format is not allowed on this free hosting!

1 Like

The JSON field type was only added to MySQL with version 5.7. However, we run MySQL 5.6, so this data type is not yet available.

1 Like

It works but I I have another error 404 Not Found for my public/style.css and for public/images/properties/X.jpg images. Ive tested it on azure hosting it works fine.
style.css and properties both have : -rw-r–r–
My .htaccess :

php_value display_errors On
php_flag magic_quotes 1
php_flag magic_quotes_gpc 1
php_value mbstring.http_input auto
php_value date.timezone Europe/Paris
DirectoryIndex public/index.php


Options -MultiViews

RewriteEngine On
# Redirect Trailing Slashes…
RewriteRule ^(.)/$ /$1 [L,R=301]
# Handle Front Controller…
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
#Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .
- [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

ps: In my code im using <link rel=“stylesheet” href=“{{ asset(‘style.css’) }}”

If I check public/style.css, I do see your CSS code. But when I check your actual web page, it resolves to style.css instead. Which is not in the public folder.

I’m not familiar with Azure hosting, but did you change the document root of your website to the public folder? Your .htaccess rules do make sure that PHP requests are redirected to the public folder, but static files are not.

Maybe .htaccess rules like described in this article can rewrite your static file requests too?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.