D
D
Daniil Myasnikov2020-06-23 20:29:27
PHP
Daniil Myasnikov, 2020-06-23 20:29:27

Php does not see classes after installing the site on hosting, what should I do?

Hello! I have a simple code, everything works on the local machine. I decided to throw it on the hosting and everything broke. I'm using composer's autoloader (psr-4).

Error:
PHP Fatal error: Uncaught Error: Class 'shop\\core\\App' not found in /home/s/s91027o5/s91027o5.beget.tech/public_html/index.php:5\nStack trace:\n#0 {main}\n thrown in /home/s/s91027o5/s91027o5.beget.tech/public_html/index.php on line 5.

Index.php code:

<?php
use shop\core\App;
require '../vendor/autoload.php';

$app = new App();
$app->start();


App.php code:
<?php

namespace shop\core;

class App
{
    public function start(){
        $request = new Request();

        $controllerName = $request->getController();
        $controller = new $controllerName;

        $method = $request->getMethod();
        $controller->$method();
    }
}


Project structure:

5ef23c8897571652798072.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2020-06-23
@m9snikfeed

Oh, these programmers on Windows. Directory case see
namespace shop\core;
and the Core folder itself
In Windows, core and Core are the same folder, but not in Linux.
(although on a mac also :D)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question