I am getting error
Fatal error: Uncaught Error: Class 'MyClass' not found in /home/x/domain.com/x/x/init.php:3 Stack trace: #0 /home/x/domain.com/x/login.php(6): require_once() #1 {main} thrown in /home/x/domain.com/x/x/init.php on line 3
The thing is, I can run it in XAMPP on localhost without problems, I even ran it on the webserver before. The only thing I did is: deleted DB & files from webserver and 1:1 copied from XAMPP to the webserver and by that moment, I am getting this error.
I have edited things like DB connection etc, there is no error at all ** I THINK ** (since it is running fine in the XAMPP, PHP version is same on webserver as XAMPP (7.3)).
Webserver is running on Namecheap, it is shared hosting, so it is Litespeed server
mainfolder/index.php which is redirecting to login.php (mainfolder/clients/login.php) & login is calling init.php which is in clients/iip/init.php. require_once ‘iip/init.php’; (i tried even ‘./iip/init.php’) and that ‘user’ class is located in iip/functions.php called from iip/init.php ( require_once ‘functions.php’; )
EDIT: I tried to access init.php at the working XAMPP side and i am getting the same error, BUT site is still working, i am confused
2
Answers
Are you sure you specified your
DocumentRoot
(in apache config file) correctly?It seems that your web server can’t find specified file or
MyClass
is not defined in specified file.You are probably making a mistake specifying the file path. The file path could be like "localhost/functions.php".
Also, after uploading the files to the server, are you sure that you can make the database connection without any problems?