I am currently updating a Laravel API from 6.x to 10.x. I was able to use Laravel Shift successfully, and tested all changes locally. I am able to hit the API locally, and when I connect to the database on the Apache server the API runs on in production, I am able to successfully execute CRUD queries against it. However, when moving the changes to the Apache server, I am unable to hit the API on the server.
I ensured that PHP was upgraded to 8.2, and when I run php artisan route:list
all routes show up correctly. I have also cleared the caches and run composer update
and php artisan migrate
(for the database migrations that were changed while updating the API). All permissions look correct.
I’m wondering if there is anything that I have missed with the Apache server configuration, and Google searches have yielded no results. Help please!
.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I am unable to find the Apache config, I’m new to Apache, but it looks like it’s an Apache 404:
2
Answers
Thanks to @aynber, I did find the answer. The directory was not pointed to the correct folder. Once I updated the .htaccess file to point appropriately to the public folder, and updated index.php with the correct file paths, everything worked as it should.
Could you try to review the database version that your hosting have? Coulding be that is not the php version rather database version.
Also review the global variables or the environment variables that your api is using, coulding be must be different in your host than your localhost.