Opening laravel on apache - php

So I want to get the laravel site up and running so I can check how it looks. I've used php artisan serve but it points me to the localhost. I've tried the other options like --host and --port but it still doesn't work.
Right now all I see is the directory root if I go into the folder. I know that the public is the one with the index.php but when I tried to go into it, the server responds with a page isn't working.

Related

localhost:8000 not working. It's just loading infinitely?

I'm working on Laravel 5.6 and I downloaded code from the server and set it up successfully in localhost.
If run cmd php artisan serve then it works correctly but when I open the browser and type localhost:8000 or 127.0.0.1:8000 and open my project in the browser, then the browser buffers the page infinitely.
Give permission to storage folder
Generate key using php artisan generate:key
Make sure you have .env file in root folder
Check for HTACCESS redirection
Check database connection ( setup correctly )
Still getting issue then provide more details like screen-shot etc.

Run laravel project in localhost

I have installed laravel by composer create-project laravel/laravel –-prefer-dist
after this run php artisan serve command to laravel project directory and get this result.
Laravel development server started: http://127.0.0.1:8000
But when i go to http://127.0.0.1:8000 in browser laravel project not running and give error
This site can’t be reached
127.0.0.1 refused to connect.
but http://localhost/laravel/public/ it is working. Can anyone tell me that what is proper way to run this laravel project.
Try to run in different port
php artisan serve --port=9000
and then try http://127.0.0.1:9000 will work.
As might be on port 8000 something already running on your system will not make it work.
And you can also run your laravel project without artisan serve command
If anyone wants to make the application public, the more easy and fastest way is:
Rename the "server.php" file in root directory, in "index.php"
Move your .htaccess from public folder to root directory
Make your directory accessible to Apache2 (set all file permissions
to 777).
At starting level, you can use url like this http://127.0.0.1:8000 with port-number. but in further level you must working with simple url like http://localhost/laravel/public/.
One more thing - you should remove "public" keyword from url, so you access direct your root-project. Review this link - Laravel 5 - Remove public from URL
I had that problem too! And couldn't solve it. So I installed openserver from https://ospanel.io/ and put my site on the folder domains (Windows 10), then I just start Open Server and click "My Sites" and choose my site - it opened in my browser which set by default on Open Server program and click the folder on my browser cooled "public" and there you go -> your site is working.
I now that isn't solve the problem with cmd and start thought cmd and server like http://127.0.0.1:8000, but you can take access to your local site through http://'your site'/public/'your pages'
Good luck!
Changing the port will help.
php artisan serve --port=9000
worked for me
Try this
php -S 127.0.0.2:8000 -t public/
It will start your local development to http://127.0.0.2:8000 which will work great.
OR
You can try instead
php -S 127.0.0.1:8000 -t public/ It will work in any browser as compare to command php artisan serve which open url http://127.0.0.1:8000.
Successfully landed to Laravel page by the following steps.
Note: This is after the successful installation and configuration.
Was in /var/www/html/
Created the project using the following command after Laravel installation successfully
$laravel new firstapp
here firstapp is my project
cd to firstapp (folder created with project creation with $laravel new firstapp)
serve using the following command
$ php artisan serve
The project ready to serve with the following statement as below
Laravel development server started: http://127.0.0.1:8000
You can access the laravel page using the following URL
http:///firstapp/public/
Sometimes this occur when you have installed an anti virus software. Anti-virus deleting your "server.php" file. For that you can create an exception in anti-virus for "server.php" file or creating a "server.php". You can find relevant code for the file searching. Basically server refuse to connect occurs when the "server.php" deleted or removed from the file path.

Laravel controllers not working in another computer

I just copied my laravel project from one pc into another. I changed the .env file accordingly for new domain url (it's in localhost bytheway).
However when I click the links, namely login, register, they say the requested URL not found on this server.
I tried to run php artisan serve command, but it says
[Error Exception] No such file for directory.
But the artisan file is there. I'm afraid the domain still pointing to previous one, hence the error.
Is there anywhere else I need to change the pointing url?
After copying the directory you should always run composer update secondly make sure you have.
i fixed it by enabling module rewrite option in apache extension in WAMP

php artisan serve gives a blank page

My application folder is c:/wamp/www/newapp.
When I use php artisan serve from the newapp folder the server starts at port 8000.
Of course I switch off the WAMP server when I do this however I get a blank page! I tried making a test.html in the newapp/public folder and it works if I type localhost:8000/test.html, but it does not go to the landing page!
For your information: when I use WAMP server and type localhost/newapp/public it goes to the landing page, but playing with the routes.php does not work when using WAMP.
My question is, how do I get to the landing page using php artisan serve?
My Laravel version is 4.2.0.
Here are a couple of possible fixes:
run composer install
Try to run php -S localhost:8000 -t public/ in the root of your project (not sure if this works on Windows though)
If this doesn't work you can try to use homestead

How to set up routes for Laravel 5 so I can access from public folder

When I try to run some other route trought localhost/project/public/acp or localhost/acp it say folder not found but when use localhost:8000/acp it works fine here is my routes:
Route::get('acp', 'CommentController#admin');
I use Linux server... And what is right way to put Laravel app in production?
Also this works fine: localhost/project/public/ but other routes no....
If you're using php artisan serve, your site runs on localhost:8000 and nothing outside of the public directory is directly accessible. php artisan serve should never be used to serve a production site, it's only for development usage.
If you want it to run on localhost/project/public/acp you'd have to point your webserver's document root at the parent folder of project. This is different depending on which server you use and not advisable because of what follows.
Seeing the public folder in the URL of a deployed Laravel site would be indicative of a significant security issue, as it'd make private files (like .env) possibly accessible, and if you ever made a mistake in your server/PHP config, it might allow your PHP files to be read as plain text.

Categories