How to solve fatal error for this project?

Hi,
I have downloaded this project. I want to study it and after learning the basics, I’d change it based on my needs.
When I run this project in XAMPP, there is a fatal error.
Please help me to run this project.
Thanks.
The link:
https://projectworlds.in/wp-content/uploads/2019/06/image-gallery.zip

Well, post the error and we can help. Your error will not be the same on our servers.
But, the “fatal error” as you call it will tell you what is wrong.

1 Like

The error is:

__autoload () is deprecated, use spl_autoload_register () instead in C:\xampp\htdocs\ImageGallery\modules\autoload.php on line 3

I used spl_autoload_register () function but it gives this error:

Fatal error : Cannot redeclare spl_autoload_register() in C:\xampp\htdocs\ImageGallery\modules\autoload.php on line 3

What version of Xampp? What version of MySQL? What version of PHP?

You might just want to drop your PHP version down to 5.6 if you have it set to 7.0…
Some older templates will not run as-is on 7.0. You can alter this setting by left-clicking on the Wampp icon in your tray and select PHP and then select version.

I downloaded the project and looked into the file you mentioned.

Chances are, you might be using PHP 7.2 or above and that’s why you are getting this notice since __autoload has been removed in PHP 8.0. It’s recommended that you use spl_autoload_register.

The second error you are getting might be because you wrote something like this:

function spl_autoload_register($Class) {
    require("modules/".$Class.".Class.php");
}

which would be an error since you’re redeclaring the native function.

In order to register your own classes/files with PHP, you could use something like this:

function my_autoload($Class) {
    require("modules/".$Class.".Class.php");
}

spl_autoload_register('my_autoload');

In any case, using spl_autoload_register in a proper way should solve your problem, here’s the reference: PHP: spl_autoload_register - Manual

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service