I was brought in to work on and modernize a web application that is hosted on a Windows EC2 instance. There is no real source control or local development right now, all changes are done in master on the production server.
The first thing I want to do is lock down the production instance and get a local development environment up and running.
After initializing a Git repository, snapshotting the code, and pulling it locally, I used php artisan serve
to get a local copy working. However, the local copy doesn't work, and in fact gives me the following error
Warning: require_once(/Users/{myUserName}/Projects/{FolderName}/{webapp_name}/public/index.php): failed to open stream: No such file or directory in /Users/{myUserName}/Projects/{FolderName}/{webapp_name}/server.php on line 21
Indeed, there is no index.php
in the public folder. I have a fresh copy of laravel/laravel
working on my machine, which does have an index.php
in the correct place.
I've found the index.php
in the source code, and it's in the root of the project folder. On a hunch, I went back to the EC2 instance and ran php artisan serve --port=8123
and sure enough, it gave me the same error on the production EC2 instance.
The error is similar:
require_once(): Failed opening required 'C:\xampp\htdocs\{app_name}/public/index.php
Note how there is a mix of forward and backwards slashes in this path. I am unsure if this is the reason it is failing.
I am brand new to Laravel (though I have experience with PHP). Is there a different command for actually deploying a Laravel app? The app is located in the xampp\htdocs
on the production instance.
It's been a while since I used XAMPP. I mostly just use Heroku or built in solutions from AWS/Azure for deploying web apps now so I have to re-learn the nuts and bolts.
My question is: how is this Laravel application running if php artisan serve
does not work correctly on the production instance?