5

Whenever my code has an error.. All I get on the browser is a blank white page. No errors. Nothing.

I have tried turning debug to true in config/app.php. I have tried running php artisan optimize. No difference. I have tried this post and this is the resulting error in my command line;

The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details
PHP Fatal error:  Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:974
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///usr/loc...', 974, Array)
#1 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(974): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(784): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(745): Symfony\Component\Console\Application->getTerminalDimensions()
#4 phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php(675): Symfony\Component\Console\Application->getTerminalWidth()
#5 phar:///usr/local/bin/com in phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php on line 974

So here is another problem to deal with... and I still don't have errors showing. I just want to show some meaningful errors... what else can I try?

* UPDATE *

I followed this guide as suggested in the error message above. I got a pretty positive looking response;

1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 1.6144 s, 665 MB/s

So I tried running composer update again. I got this response;

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing laravel/framework (v5.0.5)
  - Installing laravel/framework (v5.0.6)
    Downloading: 100%

  - Installing filp/whoops (1.1.3)
    Loading from cache

Writing lock file
Generating autoload files
Generating optimized class loader 
Compiling common classes
Compiling views

All good, right? But then, I still get a blank white page when loading my script with an error. Why??

6 Answers 6

11

first try this command
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
sudo composer update

Sign up to request clarification or add additional context in comments.

Comments

6

It isn't a bug and fix it - To enable the swap you can use for example:

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

Ref: https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors

Hope it will help you :)

Comments

2

You get that error because Composer ran out of memory (it happens), how to fix this, see this for example: Composer update trouble

You could try to change the memory limit, or if you're developing locally and you get that error on your server; keeping the composer.lock-file in your git-repository (or where/whatever you use to deploy your project).

Now, you are probably getting the white page because the framework actually isn't loaded (so the "debug" => true isn't even read).

3 Comments

It tells me to run this command php -dmemory_limit=1G /usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar update but I don't have a Cellar directory in /usr/local - what do I do?
That's the path to where your composer is installed. If you didn't use Homebrew (as Cellar indicates), it probably resides in /usr/local/bin/. If you have a composer.phar exclusive to your project, you should be able to just use php -dmemory_limit=1G composer.phar update from your working directory.
While this addresses the error found in the log, it is not answering the main question/problem: Laravel isn't reporting errors back to the browser.
1

In the case you have cloned a laravel project and have attempted "composer update", you will first need to run "composer install" instead

Comments

0

In my case, I have in my composer.json the predis/predis which is a package for REDIS. Since I wasn't able to install first REDIS, I think this is the main cause as to why I'm getting the error "The following exception is caused by a lack of memory and not having swap configured". I just removed the predis/predis on my composer.json and everything went fine.

Comments

0

This means that the composer does not have enough memory. This could be happening because the VPS runs out of memory and has no Swap space enabled. You can enable swap using below article: https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors

However in my case I had enough memory and swap. A simple reboot fixed it. You can try reboot, especially if your server is ON for long time.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.