Azure Web App Laravel Project cannot access with the API which involved with DB.

TAN KE JING 0 Reputation points
2023-03-17T15:34:44.8233333+00:00

I attending to access my Laravel Project on Microsoft Azure Web App service, and if I access to the API that return some string it can successfully access, but if I access with the API which involve with DB then the API will return the status code 404 not found.

Azure SQL Database
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,829 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 15,606 Reputation points
    2023-03-30T21:00:15.3833333+00:00

    Thanks for your patience. We are sorry to hear you are having trouble accessing your Azure Web App Laravel Project. Can you look at the logs for any database-related errors? does it work locally?

    Here are some things to check to help troubleshoot:

    •  Check that your database connection is configured correctly in your Laravel project's .env file. Make sure that the database host, port, database name, username, and password are all correct. You can also try connecting to your database using a database client to ensure that your credentials are correct.
    • Make sure that the database server is accessible from your Azure Web App service. You may need to configure firewall rules to allow access to the database server from the Azure Web App service IP address range.
    • Check that the database schema and tables exist and have the correct structure. You can verify this by running Laravel's database migration scripts using the php artisan migrate command. If the tables do not exist, Laravel will create them for you based on your database migrations.
    • Ensure that your Laravel project's .htaccess file is properly configured to route requests to your API endpoints. You can try modifying the .htaccess file to route all requests to a single endpoint to see if that resolves the issue.

    If you have checked all of the above and still cannot access the API that involves the database, you can try to enable detailed error messages in Laravel by setting the APP_DEBUG environment variable to true in the Azure portal. This will give you more information about the error and help you troubleshoot the issue further.

    Let us know if this helps or if you have any further questions.

    Best,

    Grace

    0 comments No comments