laravel php 7 consumes ram - php

-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

Related

PHP artisan error: CLI stops working after every reboot

I installed Laravel through composer using PHP 7.3.25 through xampp v3.2.4. I first noticed the problem: cli stopped working, during
php artisan serve
I scoured SO and the internet for possible fixes. Going through these commands fixed this problem for me (or so I thought):
composer update --no-scripts
php artisan clear-compiled
composer dump-autoload
But every time I turn on the PC, I get the same error and have to follow these steps to make it work. Antivirus did not have anything to do with it (I checked). Is there any way to fix this without having to completely reinstall everything?
Its ist important to understant few points related to following queue:restart command.
The queue workers' age confirmed that they restarting in response to that.
php artisan queue:restart
Ref: https://laravel.com/docs/8.x/queues#queue-workers-and-deployment

Laravel server not starting

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 .

Php artisan command Run out memory with 32Gb of RAM

I have in DigitalOcean a droplet of 32Gb ram with 12 CPU (resize for occasion)
I run php artisan command (laravel 4.2) which never ran. What could be happening?
And the error message after more than 10 minutes:
I answer my own question, with the help of #aynber and #MartinBarker
I solved the problem droping the current database, updating composer (composer update in my local and pushing composer.lock which contain the updates to the server, in the server run composer install with sudo (is not recommendable use sudo with composer.) and runing sudo php artisan.
then edit the php.ini file and increase your memory limit

Local Laravel server stops after hitting localhost once

I'm trying to develop a Laravel app locally and I'm running php artisan serve. It works until I visit localhost:8000 and then the server stops. I've tried changing the port using sudo php artisan server --port=80 but that doesn't fix it.
I haven't written a line of code yet. If it helps I'm running PHP 5.4 on OS X Mavericks.
i think your experiencing segmentation fault(core dumped),
try running this commands
composer dump-autoload
php artisan clear-compiled
composer clear-cache
Please check if you have Avast Antivirus. This antivirus detects server.php as a threat (silently) and blocks it.
As a result, browser works good for the first request and then keeps waiting. Noting comes up on subsequent requests. Solution is to add an exception in antivirus. This problem is specific to Laravel.
If you are using Avast Antivirus, this will delete the server.php file assuming as a threat. You have to create an exception for this. Goto Avast Anitvirus -> Menu -> Settings -> General -> Exceptions. Add exception server.php file path here (add server.php file if it doesn't exist) and run the "php artisan serve" command.

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

Categories