Run laravel project in localhost - php

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.

Related

Display file from Storage path laravel

I have a file stored in storage directory in Laravel 7. The sub directory is storage/app/public/personnel-docs/nameofile.ext.
I have done php artisan storage:link and therefore, on my local which is a windows 10 machine I can access it by the following url
http://127.0.0.1:8000/storage/personnel-docs/nameofthefile.ext
But where it is hosted on a LIVE linux server, when I try the same url as follo
http://theliveurl/storage/personnel-docs/nameofthefile.ext
It returns a 404 Not found response.
I have also run php artisan storage:link on the server and the problem persists.
I have checked and confirmed that the file is present on the folder but it just does not return/display as expected.
I will appreciate any effort to resolve this.
Thank you

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.

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

laravel 4 does not work on Windows XAMPP

On Windows 7 cmd I have run composer create-project laravel/laravel blog --prefer-dist from `C:\xampp\htdocs\lara. Everything is downloaded and installed fine.
However, when I try to access http://localhost/lara/blog it shows the directory listing of apache. I followed the instruction in the documentation during the installation.
I noticed the following notes:
C:\xampp\htdocs\lara\blog does not has any index.php or .htaccess
C:\xampp\htdocs\lara\blog\app also, does not has any index.php or .htaccess
Only accessing http://localhost/lara/blog/public opens a page with the laravel logo and the words "You have arrived"
I could not able to know what's the problem?
Laravel's folder structure uses the public folder as the WWW root, effectively placing all your application's files outside of the web root to help keep them secure. What you are experiencing is normal.
You'll have to either access your application from the http://localhost/lara/blog/public URL, or set up a virtual host URL (e.g. http://testblog.dev) that is pointed to the public folder. I do not develop on Windows/XAMPP so I cannot specifically tell you how to do that part.
If you're running php > 5.4 you can serve the app using the builtin server from command prompt as well (for development purposes):
php artisan serve
I have an answer on How to install Laravel via Laravel Installer on Windows?
or
http://goo.gl/uftcSo
for more details
Hope that helps.

Running the development web server google app engine for php

Where can I write the following command
i am following the developer tutorial for simple hello world script here
google_appengine/dev_appserver.py --php_executable_path=pathto-php-cgi path-to-your-app
When I run application in google app launcher I get a error message . I have WAMP install and it is running fine.
The path specified with the --php_exectuable_path flag () does not exist.
Php path - c:\php\php-cgi.exe
I also met this problem, and it has been solved.
for example,
if your PHP folder is E:/sam/php/
if your PHP site folder is F:/mysite/facebook/
if your dev_appserver.py is under E:/whatever/
I'm not sure how to change googleapplauncher.exe configurations, instead, you have to use cmd instead. I think this exe has config files but I did not find it. Open the command window and go to folder E:/whatever/ to run "python" command under this folder.
Type in:
python dev_appserver.py --php_executable_path=E:/sam/php/php-cgi.exe F:/mysite/facebook/
NOTE: REMEMBER to type "php-cgi.exe"
use slash
I dont know which is the name of the file in Windows, but i just have that problem, the full path from / for your php-cgi54.exe including the fullname of the file and then the full path from / of your folder.
I also run it like admin so check if your cmd or terminal was open with admin rights.
#Chander if you have wamp running you need to select a different listening port for app engine by typing the command: --port=9999 for example.
Here's what worked for me:
Open your cmd, make sure you're in the same directory as your sdk.
Type: "google_appengine/dev_appserver.py" --port=9999 --php_executable_path="fullpath\php-cgi.exe" "helloworld/"
If you have another local server like xampp or wamp,make sure you use the --port command to select another listening port as shown above.
Press enter and you should have your helloworld script working.

Categories