I developed a project using laravel and the php artisan serve. Everything was working as expected. I have since installed apache and have the apache webserver pointed to my laravel project. I am pretty sure the webserver config is good because if I make the DocRoot point to non-laravel web pages, it works fine. When i goto the main page I get the following error. I am sorry its a mess, I tried to format a bit for clarity.
What other information would you need to help figure this out?
PHP Fatal error: Uncaught TypeError: Return value of
Illuminate\myDirr\myDirr::offsetGet()
must be an instance of Illuminate\myDirr\mixed,
instance of Illuminate\Events\Dispatcher returned in
/Users/bmueller/laravel/projectManager/vendor/laravel/framework/src/Illuminate/myDirr/myDirr.php:1417nStack trace:n#0
/Users/bmueller/laravel/projectManager/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(43):
Illuminate\myDirr\myDirr->offsetGet('events')n#1
/Users/bmueller/laravel/projectManager/vendor/laravel/framework/src/Illuminate/myDirr/myDirr.php(873):
Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array)n#2
/Users/bmueller/laravel/projectManager/vendor/laravel/framework/src/Illuminate/myDirr/myDirr.php(758):
Illuminate\myDirr\myDirr->build(Object(Closure))n#3 /Users/bmueller/laravel/projectManager/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(855):
Illuminate\myDirr\myDir in /Users/bmueller/laravel/projectManager/vendor/laravel/framework/src/Illuminate/myDirr/myDirr.php on line 1417
Here is the apache log of a request:
[Thu Mar 03 13:51:31.554405 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths / vs /Users/myDir/laravel/projectManager/public/, related=1
[Thu Mar 03 13:51:31.554412 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths /Library/WebServer/CGI-Executables/ vs /Users/myDir/laravel/projectManager/public/, related=0
[Thu Mar 03 13:51:31.554418 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths /usr/share/httpd/icons/ vs /Users/myDir/laravel/projectManager/public/, related=0
[Thu Mar 03 13:51:31.554425 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths /Users/myDir/laravel/projectManager/public/ vs /Users/myDir/laravel/projectManager/public/, related=1
[Thu Mar 03 13:51:31.554431 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths .*\.\.namedfork/ vs /Users/myDir/laravel/projectManager/public/, related=0
[Thu Mar 03 13:51:31.554437 2022] [:debug] [pid 45104] mod_hfs_apple2.c(384): [client 192.168.183.1:60670] mod_hfs_apple: Final check compares: /Users/myDir/laravel/projectManager/public/ vs /Users/myDir/laravel/projectManager/public/, length 45
[Thu Mar 03 13:51:31.554444 2022] [:debug] [pid 45104] mod_hfs_apple2.c(397): [client 192.168.183.1:60670] mod_hfs_apple: Allowing access with matching directory. filename = /Users/myDir/laravel/projectManager/public/
[Thu Mar 03 13:51:31.554515 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths / vs /Users/myDir/laravel/projectManager/public/index.php/, related=1
[Thu Mar 03 13:51:31.554527 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths /Library/WebServer/CGI-Executables/ vs /Users/myDir/laravel/projectManager/public/index.php/, related=0
[Thu Mar 03 13:51:31.554534 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths /usr/share/httpd/icons/ vs /Users/myDir/laravel/projectManager/public/index.php/, related=0
[Thu Mar 03 13:51:31.554541 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths /Users/myDir/laravel/projectManager/public/ vs /Users/myDir/laravel/projectManager/public/index.php/, related=1
[Thu Mar 03 13:51:31.554547 2022] [:debug] [pid 45104] mod_hfs_apple2.c(363): [client 192.168.183.1:60670] mod_hfs_apple: compare_paths .*\.\.namedfork/ vs /Users/myDir/laravel/projectManager/public/index.php/, related=0
[Thu Mar 03 13:51:31.554553 2022] [:debug] [pid 45104] mod_hfs_apple2.c(384): [client 192.168.183.1:60670] mod_hfs_apple: Final check compares: /Users/myDir/laravel/projectManager/public/index.php vs /Users/myDir/laravel/projectManager/public/, length 45
[Thu Mar 03 13:51:31.554560 2022] [:debug] [pid 45104] mod_hfs_apple2.c(397): [client 192.168.183.1:60670] mod_hfs_apple: Allowing access with matching directory. filename = /Users/myDir/laravel/projectManager/public/index.php
Removed vendor directory, ran ./composer install
now i get
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2".
my php -v
PHP 8.1.3 (cli) (built: Mar 1 2022 01:17:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.3, Copyright (c) Zend Technologies
with Zend OPcache v8.1.3, Copyright (c), by Zend Technologies
Composer.json file:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"fruitcake/laravel-cors": "^2.0.5",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.0",
"laravel/sanctum": "^2.14",
"laravel/tinker": "^2.7",
"laravel/ui": "^3.4",
"psr/container": "1.0.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
},
"files": ["app/Ubersmith/devClient.php",
"app/Ubersmith/client.php"]
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Im aware of myDirr vs MyDir. I copy/pasted to remove personal info.
2
Answers
I have been facing the same the same problem.
The issue is php version requirements difference.
From you terminal do this:
a2enmod php8.0
then
sudo service apache2 restart
then
php artisan key:generate
that was the procedure