Fatal error: Uncaught Error: Class

Username: epiz_26617624 / http://luciannn-blog.epizy.com

Error Message: Fatal error : Uncaught Error: Class ‘Application’ not found in /home/vol7_6/epizy.com/epiz_26617624/luciannn-blog.epizy.com/htdocs/index.php:30 Stack trace: #0 {main} thrown in /home/vol7_6/epizy.com/epiz_26617624/luciannn-blog.epizy.com/htdocs/index.php on line 30

Other Information: I has configure my php code in local host and all it work fine, but when i upload on webhost him give me this error…

This is index.php

This error is caused because the Class “Application” cannot be found; The most likely explanation for this is that the file which contains this class has not been imported in the file.

Yes, cannot be found because is included with set_include_path() and be load with spl_autoload_register() … But i don’t know why do not work, in my localhost work perfect…

Are these php functions even available? I suggest you test to see if they are allowed.

In PHP is available, but on this web hosting do not work, i think is not allowed by web host…

See if below is applicable…

The InfinityFree web servers have size limits for all files. If the file size exceeds the limit, the file is automatically deleted.

The size limits are:

  • HTML and PHP files are limited 1 MB.
  • .htaccess files are limited to 10 kB.
  • All other files are limited to 10 MB.
  • HTML and PHP files does not exceed
  • .htaccess file does not exceed
  • Other file i do not have
    I don’t know why…

All the SPL autoloading stuff should just work here. Many, if not most, applications use it (usually through Composer).

I’ve never really used the low level functions directly, so I’m going out on a limb here.

But looking at the documentation, I don’t see anywhere that you’re actually including the given class. You set the include path with a few additional and you set the autoload function to the default (why???). But nowhere do you actually require or include any files. So where should the Application class be loaded from?

So are you really sure that this is the exact code that’s working on your own computer? Because I honestly don’t understand how this could work.

5 Likes

The image below defines the exact paths to folders, the inclusion of files is done by the function set_include_path () after which they are loaded with spl_autoload_register () the “Application” class exists, but it exists in the “core” folder from where it was to be included in index.php with set_include_path ()

Yes, i’m really sure this is the exact code where i use in my computer and it work very good

Here all code GitHub - luciannn98/Blog: Blog tamplate

Maybe this will help. php - How to use spl_autoload_register? - Stack Overflow Also set the throw parameter to true so you can get more debug info.

No man, problem is in set_include_path() function because doesn’t include the path i need…
I tried more option and i think this is the problem.

If what you mean is file path, please note that /htdocs/ is the root, not /

3 Likes

If is /htdocs/ or / is not working…

Maybe try set to home directory under VPanel with /htdocs ?

image

what is your code on line 30?

@KangJL, I tried but doesn’t work…
@anon95130038, line 30 don’t exist…

Here is all project

I resolved it I modify a part of structure and put important files require into init.php and i included it in index.php, now all works fine, oh, i changeed $_SERVER['DOCUMENT_ROOT'] with function getcwd() and it works ok

4 Likes

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