0

I'm trying to Deploy my Laravel application to a staging server when I encountered this error

[ErrorException] require(/var/www/html/<app name>/releases/<version number>/vendor/composer/../../App/Helpers/DateHelper.php): failed to open stream: No such file or directory

At first I thought it was simply because Laravel recognize the path to DateHelper as App/Helpers/DateHelper.php instead of app/helpers/DateHelper.php, so I tried to change the pathname in composer.json's autoload from "App" to "app". After I changed it, I tried to clear the cache by running php artisan config:cache, then I got this error.

PHP Fatal error:  require(): Failed opening required '/var/www/html/<app name>/releases/<version number>/vendor/composer/../../App/Helpers/DateHelper.php' (include_path='.:/usr/share/php') in /var/www/html/<app name>/releases/<version number>/vendor/composer/autoload_real.php on line 71

The same goes for when I was running any composer command (composer install, update, or dump-autoload). I tried searching for a config.php file, as suggested by this post, in my project's bootstrap/cache/ folder but the folder turns out to be empty. What's worse is that running php artisan or any php artisan command would also result in the same PHP Fatal Error. Any ideas as to what is causing this?

Thank you in advance.

3
  • Please share more details - why not use the same casing for all paths and files? Commented Feb 5, 2021 at 10:30
  • 1
    On a server paths are case sensitive. I would say: look at the Laravel naming conventions for paths, files and classnames. Commented Feb 5, 2021 at 10:38
  • Hello, sorry for the late follow-up. Yes it turns out that there is another key called "files" in "autoload" where I need to change the path from "App" to "app" and everything works like charm. I was panicking because I could not run any php artisan command and I thought the problems were deeper down the line. Commented Feb 16, 2021 at 9:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.