0

This is my first issue on this website, if I'm missing info, feel free to tell me so I can add it. Sorry!


I am trying to make a PHP cart with composer. My index.php file keeps showing "This page is not working" in Chrome. I guess this is an error 500, or some sort of error. It's PHP's issue though. With the code:

<?php 
    require __DIR__ . '/../bootstrap/app.php';
    $app->run();
?>

When I run that code I get the page is not working error. I commented out the require portion of the code, still had the error. I commented out the $app->run portion and kept the require, and the error went away and showed a blank screen. It looks like $app->run() is causing my page to crash. Anyone know why it does this? This is the first time I'm running PHP on a VPS, usually I just use shared hosting with cPanel.

More Information

OS: Debian Wheezy (7)
PHP Version: 5.5.38-1~dotdeb+7.1
Webserver: nginx 1.2.1

Also to note, this error comes up no matter what composer script is installed.

JAAulde
  • 19,250
  • 5
  • 52
  • 63
Makan Dey
  • 11
  • 4
  • 1
    We need to see more, what is `$app`? – Nytrix Dec 15 '16 at 03:37
  • 2
    You can't "make a PHP cart with composer." composer is a dependency management system, not a language or a framework... – JAAulde Dec 15 '16 at 03:41
  • Check your server's php error log – pattyd Dec 15 '16 at 04:01
  • @Nytrix Anything I write ends up with the error. Even if it's an undefined variable. No errors, just that. – Makan Dey Dec 15 '16 at 16:05
  • @JAAulde But it's just anything with -> causes the server to crash. – Makan Dey Dec 15 '16 at 16:06
  • @pattyd Error logs through nginx and apache show nothing. – Makan Dey Dec 15 '16 at 16:06
  • As already stated, you need to inform us as to what `$app` _should_ be. Worded another way, where did you get your `bootstrap/app.php` file and what is in it? – JAAulde Dec 15 '16 at 16:09
  • You should turn on `error_reporting` in that case, that should show us more already. Do so by putting this on top: `error_reporting(1);` – Nytrix Dec 15 '16 at 16:59
  • @JAAulde This is the code I'm following: https://www.youtube.com/watch?v=tRh467FX12U&t=657s (Everything before 10 minutes, once running it, it breaks.) – Makan Dey Dec 16 '16 at 21:48
  • @Nytrix That didn't help because the Chrome HTTP 500 error just shows up everytime. – Makan Dey Dec 16 '16 at 21:49
  • That means that `error_reporting` is still off. Please refer to this [**topic**](http://stackoverflow.com/questions/17693391/500-internal-server-error-for-php-file-not-for-html) – Nytrix Dec 16 '16 at 21:51
  • @Nytrix You were right, I just turned it on with the answer I posted below and it worked. Sorry for the useless issue I made, guess that 1 person that -rep didn't like it. – Makan Dey Dec 16 '16 at 22:04

1 Answers1

0

Found the solution thanks to Nytrix in the comments. Had to turn on errors through PHP, turned it on for just that script using:

error_reporting(E_ALL);
ini_set('display_errors', 1);

Looks like I had a syntax error. Forgot a } somewhere. Thanks everyone in the comments for helping.

Makan Dey
  • 11
  • 4