SLIM 3 framework project (PHP)

Hello,

I get error message when to runing SLIM 3 microframework project that is working very well on my local-host Apache.
index.php is in ‘public’ folder from the root whereas .htaccess:

“RewriteEngine On
RewriteRule ^$ public/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php [L]”

is in the root.

URL:

https://employees.darlar.infinityfreeapp.com/

Error Message

Slim Application Error
A website error has occurred. Sorry for the temporary inconvenience.

Can one support?

Thank you.
Best regards,
DL

I see this instead

2 Likes

Thank you I see now the same, but still it does not work as in my localhost…

I checked your site. For starters, your .htaccess rules are fine. No need to change those.

When I check the root, I also get the “Page Not Found” error. Looking at the code, that makes sense, because no route is defined for /. When I check https://employees.darlar.infinityfreeapp.com/employees, I get the Slim Application Error.

This means that Slim has crashed, and you need to find out why. Slim has a setting you can turn on to display detailed errors, which you can configure like so: System Error Handler - Slim Framework

I did this for your site, and found the model class could not be found. The reason for this is that our servers, like almost all hosting servers, run on Linux, which means files and directories are case sensitive. In your code, you’re referencing a namespace Depiction, but the folder that contains these classes is called depiction. If you developed your site on Windows or MacOS, this will work, but on a live server it will not.

To fix this, the only thing you can do is to pay careful attention to file and directory names and make sure their casing matches. So if you’re using class autoloading on a directory, all subdirectories must match the namespace names exactly.

6 Likes

THANK YOU very much!
Now it partially works.
I mean my JS and CSS, in contrast to localhost, do not work on the server, so some important functionalities are not in place. I have ‘css’ and ‘js’ folders in ‘public’ folder i.e. where I have index.php. My view files (*.php) are in ‘htdocs/app/templates’ folder. Perhaps you might also help on this issue? I checked and there is no more problem on the letters (capital or not) for these files/folders.

Best regards,
DL

I found the problem, so the issue is solved.
Thank you for the so far support !

3 Likes

Hello,

once again I have the problem with the project (slim 3) that is now temporarily hosted at:

http://test.darlar.infinityfreeapp.com/employees

The message is: “HTTP ERROR 500”.

As well I can’t implement ‘display_errors.php’ for debugging I downloaded from:

https://kb.ifastnet.com/index.php?/article/AA-00228/0/White-Page-error-500-php-error-display_errors.html

since I use views (php templates), there is no folder for my page named http://test.darlar.infinityfreeapp.com/employees.

Can you pease support?

Thank you.
Best regards,
Darek

Just found, ther was 1 cap. letter instead of small, and I turned on debugging in my control panel.
So no more issue.

1 Like

That article is outdated, anyway it would apply on premium hosting only, as you can’t edit your php.ini file in free hosting. Glad to hear you found the option in the control panel and were able to sort it out.

2 Likes

Of course you can’t implement that. Slim has it’s own way of handling error, which I already told you here:

4 Likes

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