Reputation: 133
I have created a file in App\Helpers\Common.php
. Inside this file I have defined some constants. In local it works great but when I uploaded it in a shared host, it returns an error saying:
[04-Dec-2017 03:39:00 UTC] PHP Warning: require(/home/bibbibco/public_html/main/vendor/composer/../../App/Helpers/common.php): failed to open stream: No such file or directory in /home/bibbibco/public_html/main/vendor/composer/autoload_real.php on line 66
[04-Dec-2017 03:39:00 UTC] PHP Fatal error: require(): Failed opening required '/home/bibbibco/public_html/main/vendor/composer/../../App/Helpers/common.php' (include_path='.:/opt/alt/php71/usr/share/pear') in /home/bibbibco/public_html/main/vendor/composer/autoload_real.php on line 66
I have added in composer.json
:
"autoload": {
"files": [
"App/Helpers/Common.php"
]
}
to load the files, but it returns the error mentioned above.
How can I fix it?
Upvotes: 0
Views: 1473
Reputation: 6976
By default, the application directory in Laravel is app
not App
.
If you're using Windows either App/Helpers/Common.php
or app/Helpers/Common.php
will work because paths are not case-sensitive. Using Linux, app
and App
are distinct so only app/Helpers/Common.php
will work.
Upvotes: 2