flightphp / core

An extensible micro-framework for PHP
https://docs.flightphp.com
MIT License
2.61k stars 408 forks source link

PHP Fatal error: Class 'xyz' not found in flight/core/Loader.php on line 125 #367

Closed fatihmert closed 6 years ago

fatihmert commented 6 years ago

Hi, I work with flightphp always. This project work on XAMPP.

My file structure like this;

lib/__autoload.php lib/database.php

model/__autoload.php model/xyz.php model/abc.php model/foobar.php

model/__autoload.php following;

// this working
include 'abc.php';
Flight::register('abc', 'Abc');

// this not working
include 'xyz.php';
Flight::register('xyz', 'xYz');

// this working
include 'vars.php';
Flight::register('foobar', 'FooBar');

index.php

session_start();
require_once('flight/Flight.php');

include 'lib/__autoload.php';
include 'model/__autoload.php';

...

Flight::start();

Why does not working on my hosting ? I could not solve this. Because this is working on my localhost with XAMPP. My hosting php version is 5.6.

My database class -> MeekroDB

mikecao commented 6 years ago

You need to post the error message. I can't tell what not working means.

fatihmert commented 6 years ago

Error message is title PHP Fatal error: Class 'xyz' not found in flight/core/Loader.php on line 125

teodoriu commented 6 years ago

Check your filenames and class names. Linux is case sensitive, windows is not.

Flight::register('xyz', 'xYz');

I think it should be

Flight::register('xyz', 'Xyz');

fatihmert commented 6 years ago

@BTeodorWork I did it but does not working. Change class name again does not working.

All file names lower case. Change Class names like to just first letter is upper.

I dont understand seriously:/

jimlei commented 6 years ago

Any reason why you're not just using composers autoloader?

fatihmert commented 6 years ago

@jimlei I am not using this project. Actually I was solve two hours ago. Root folder in any subfolders’ I couldn’t include that because these folder in files looks like in root folder.

So, model/__autoload.php include “model/xyz.php”;

When I was solve that, my hosting number of processes out to the limit. My hosting limit is 100 processes. Again I didn’t understand. So am I need vps/vds hosting. But This project very small