How to fix “ No such file or directory”error when I access to the home page
I downloaded a laravel project from a shared hosting and I want to edit him in my localhost but when I type out the home adress: localhost:8000/ it shows me those two errors :
Warning: require_once(C:\Users\Rafaa\Downloads\Compressed.idea/public/index.php): failed to open stream: No such file or directory in C:\Users\Rafaa\Downloads\Compressed.idea\server.php on line 21.
Fatal error: require_once(): Failed opening required 'C:\Users\Rafaa\Downloads\Compressed.idea/public/index.php' (include_path='C:\xampp\php\PEAR') in C:\Users\Rafaa\Downloads\Compressed.idea\server.php on line 21
It is your setup and not your project. To make sure you actually have everything installed correctly try creating a simple laravel test projects with laravel new testprojects and then accessin it depending on your setup by localhost:8000 or testproject.test etc.
When you get this to work get back to your project in question.
Did you run 'composer install' after downloading the project? Typically, when you clone a project from GitHub you will still have to run 'composer install' in the root directory to pull in all the dependencies. You might even have to create a .env file and run 'artisan key:generate' to get the project up and running.
hello my friend first , thanks for your reply
second i work as a freelancer and my work is to edit a website , this website is hosted in godaddy.com
than i tried to download this website from godaddy and edit him from my computer
and I tried to the command composer instal and composer update and still not working...
If you take a closer look than you'll notice there is an issue with difference in path notation for operating systems.
On Windows DIRECTORY_SEPARATOR is backslash \, and on Unix based systems it is slash /. Not the one from GnR :D
So in your case it is using Windows notation until this point C:\Users\Rafaa\Downloads\Compressed.idea, and after that it is switching to what is defined in the server.php file on line 21 which is /public/index.php.
I have never tried web development on Windows so I'm not sure I can help you without Google myself. So please try to search something related to that and I'm sure you will find a solution for your problem.
So when a site is on shared hosting, people have done ugly hacks to make it work.
From the error, it seems like you are running php artisan serve from the root folder. This looks for index.php in the public folder.
Do you have a public folder? It may have been renamed public_html or htdocs. Worse, the index.php file may have been copied to the root of the project and edited to fix the paths.
Search for the index.php and tell us where it is located (there may be more than one)
Do artisan commands work? you should check the version of the application, and also run the various clear commands to wipe any cached items
I don't know my friend if you understand my problem or not , I should edit an application or website hosted in
godaddy.com so I tried to download it and edit it from my localhost and then I will reupload it in the hosting.
Second, the index.php folder is in the root folder.
Artisan commands like artisan serve works but when I type out the adress of localhost:8000 it show me the errors in the top .
I tried to run the make:migration command and worked !