Laravel server not starting - php

I have a fresh installed laravel app and when i run php artisan serve it shows me the server information but when i go to that server it gives a cant be reach error. I am not running Vagrant just MAMP but it used to work before. I did tried to install Vagrant in the past and it didn't work that is why i came back to MAMP only. I read something about generating a key with php artisan key:generate which didn't work. Any help is appreciated.
This is the command I am using and the result
$ php artisan serve
Laravel development server started: <http://127.0.0.1:8000>

try to uninstall the antivirus if you have one ,in my case i uninstall avast ,reboot OS and it works for me .

Related

Laravel Error: Erroneous data format for unserializing 'Symfony\Component\Routing\CompiledRoute'

I ran these commands: php artisan route:clear and php artisan cache:clear. Then I got this error on whatever I want to do: running artisan command, running composer command, rendering any view that worked just fine. Can not do anything at all.
I searched for the problem and seems that this has happened because of changing the php version from 7.4 to 7.3. Yes, I have done this about 10 days ago, now I am not able to resolve it and make it work again. I use Nginx and tried anything suggested on the web, but can not solve the problem. I had apache and could not solve it, I removed apache completely and installed nginx. Now any other project works fine with nginx, but only this project which I ran php artisan route:clear and php artisan cache:clear commands, has problem and displays this error on every action I want to do: Erroneous data format for unserializing 'Symfony\Component\Routing\CompiledRoute'.
How can I solve this problem?
I got this same error when I was experimenting with Laravel Envoy. I think I pulled the 7.0 version of Envoy onto of my Laravel 5.8 version app. The way to solve it for me was to clear out the bootstrap/cache directory of the app with the command rm -fr bootstrap/cache/* from the root Laravel directory. Once I did that I was able to use my application normally and all the artisan commands began working.

How to serve a Laravel project without Homestead?

I am beginning on Laravel and I have a quick question.
I am going to undertake a small test. I will be developing on Laravel under a Mac with Homestead and a Vagrant box.
My test project is going to be ran on an Ubuntu 16.04 with Php 7.
How can it be ran without Homestead or Vagrant? Is this possible?
You can just use laravel valet
https://laravel.com/docs/5.7/valet
Or php artisan serve
First, download and install lnmp.
Then edit your nginx.conf file, copy the configuration from homestead to the new server.
Finally, reload the nginx and php-fpm service.

laravel php 7 consumes ram

-short version : When I run "php artisan serve " computer freezes and needs a restart."php 7" using all the ram.what should I do?
-detailed explanation : I created a project with Laravel and put in a lot of work and it worked fine till yesterday ,today I've changed a few lines on some views (no config files were touched) and when I ran "php artisan serve" and opened browser to see the changes my computer got slow and eventually froze completely .I've checked my system resources and saw "php 7" was consuming all of my ram and swap and browser couldn't load the page.
I've checked and my other projects work fine.the problem occures only on this one.
I have HPprobook and 4GiB ram ,10GiB swap memory,using Laravel 5.4 and PHP7 .My OS is a freshly installed Ubuntu 17.4 and using apache 2 as a web server.
I've restarted apache2 ,updated composer packages,dumped autoload but as I expected no effect.
Any one has any idea why this happens?
If you want small ram footprint instead of using php artisan serve You can install valet for ubuntu
P.S php artisan serve does not need apache you can try to stop it

How to use Laravel Homestead for development

I know this might sound really silly, but I'm kinda stuck and need help. I'm trying to use Laravel 5.3 and use Homestead as my IDE. I have previously worked on PHP using NetBeans and XAMPP, but the installation has always been a pain. I have no formal training and have learnt and used basic PHP on my own for my webpages.
I'm running a Windows 8-32Bit OS & here's what I've done so far:
I have downloaded Laravel using Composer.
I have installed Virtual Box & Vagrant.
I have installed Git Bash and ran vagrant box add laravel/homestead (Homestead.yaml was not found in my Homestead folder after running bash init.sh command. I downloaded it from Github and added there).
Set SSH Key.
Ran vagrant up in Homestead folder (the installation was complete).
Issues:
If I just type http://localhost:8000 in my browser, nothing happens. I have to run php artisan serve in the command prompt inside laravel directory and keep the prompt window open for the default Laravel 5 page to open.
If I type http://127.0.0.1:8000 in my browser, nothing happens at all.
So how do I use Homestead then for my development everyday ?
you can try
localhost/project-name/public
if you dont want to run php artisan serve

Installing Laravel on Windows

Using Windows 7.
I am following Laracasts - Laravel Setup for Newbs https://laracasts.com/lessons/laravel-installation-for-newbs but when it comes to the 4:25 mark where i enter php artisan serve I get the following showing up.
C:\Users\Pierce\Desktop\laravel-demo>php artisan serve
Laravel development server started on http://localhost:8000
[Wed Mar 19 00:29:46 2014] Failed to listen on localhost:8000 <reason: An attempt was made to access a socket in a way forbidden by its access permissions.>
I have XAMPP installed straight from the box and followed the instructions in the video. What happens that I get stopped here?
you can use another port, something like this
php artisan serve --port="8888"
this port work fine for me.
php artisan serve is a command to fire up PHP's own web server. If you are using XAMPP already, I would suggest using it's built-in Apache web server and then run Laravel through that. There are plenty of documents online on how to setup XAMPP.
As for your error, it's Windows UAC that is blocking it. Disable UAC or set or exception for your program.
Buy a mac
Else
Delete XAMPP
Install Laragon (http://laragon.org/)
All problems solved!!!
I suggest you avoid using htdocs folder of xampp. Because in this method, I could not route to other pages. So you should do this, php artisan serve --port="8888" or other port (as mininoz said).

Categories