PHP's white screen of death




Now that I'm starting to get back into PHP, I'm starting to remember why I gave it up in the first place. The most annoying thing on my plate at the moment is what I've come to term "PHP's white screen of death". When PHP gets a fatal error due to syntax or whatever, it seems like it will always die without actually sending anything to the browser. I've added the following to my `.htaccess`, and it seems to work most of the time, but it doesn't work in these cases.



```
php_value display_errors 1
php_value display_startup_errors 1
php_value error_reporting 2147483647 # E_ALL

```

Am I missing something? At the moment I feel like I need to hit refresh every few lines of code I write, lest I make a mistake and have to search through many pages trying to track down that one little mistake I made...


**EDIT:** For example, given the two lines of code below:



```
$foo = array(':language' => $languageId;
$foo = array(':language' => $languageId);

```

The first will exhibit the white screen of death (ie, nothing at all printed to the browser), while the second will execute happily.
Errors and warnings usually appear in `....\logs\php_error.log` or `....\logs\apache_error.log` depending on your php.ini settings.


Also useful errors are often directed to the browser, but as they are not valid html they are not displayed.


So `"tail -f`" your log files and when you get a blank screen use IEs "view" -> "source" menu options to view the raw output.
[image]

[how to enable error reporting in php](https://www.000webhost.com/forum/t/how-to-enable-error-reporting-in-php/43038) [tutorials](/forum/c/tutorials)

this tutorial is for those who get internal server error. so your website is not working and you are struggling to find out why. you see error 500 and do not know what to do next. if you try googling error 500 this wil… Hi BenzZz,



as far as I understand this is a HTML-problem. Try setting the initial value with



```
value=""
```

to an empty string.



Otherwise I can suggest:  

- Open your source code in your browser and see if you have any artifacts from your php parser  

- make sure you have your JavaScript deactivated



I hope that helps, Simon try this and try to modify accordingly -



```
<?
//content is the array of titles which comes from the content.php page or the entire code can be put in the content.php
$content = array('title1 - This is the Homepage','title2 -Find new friends','title3 - Get your visa cleared now','title4 - bark about your wife here','title5 - Dont have kids yet','some other page');

$arr = explode('/',$_SERVER['PHP_SELF']);

$current_page = $arr[count($arr)-1];
//list your pages here
$pages  = array("1=>index.php","2=>friends.php","3=>nicks.php","4=>rent.php","5=>test.php");
for($i = 0; $i<count($pages);$i++)
{
	if($pages[$i] == trim($current_page))
		$pages_index = $i;
	else $pages_index = 6;
}
//This will echo the title
echo $content[pages_index];
?>
```

ask,if you stuck up somewhere. What have you tried? Have you searched the php manual for sending email? I will preface this by saying that I don't know Java at all. I touched upon it in school 20+ years ago, but I've been doing PHP ever since.


However, on line 27, you say that if the input passed in is a double, execute this code block *blah*.


The user enters -1.


Is -1 not a double? It is a valid double, and therefore the code block executes, setting the priceFromUser to be -1 and adding it to the list.


Then, when the loop starts back up again on line 23, priceFromUser is now -1, so the loop breaks and prints the tally.


Also, note you're definining this constant SENTINEL variable, but you're not actually using it anywhere in your code.


Perhaps do something like this instead, changing the while loop into a do-while loop:



```
System.out.println("Please enter item price to start, since there needs to be at least 1 item:");

do
{

        // Keep asking for a price until the user enters a valid price
        while (!in.hasNextDouble())               
        {
                trash=in.nextLine(); //throw away the input 
                System.out.println("You did not enter a valid price. Please try again:");
        }

        priceFromUser=in.nextDouble(); //read value from user
        list.add(priceFromUser); //add valid price to the list            

          System.out.println("Please enter another item price, or enter -1 to quit.");

} while (priceFromUser != SENTINEL)
```

Note this isn't valid code because I'm not a Java programmer, but hopefully it helps you out a bit. Not likely. If a script can't work, then it also can't detect that it's not working... The workaround is to create a warning message that's always visible by default and then use a script to hide it (for example, by making a field that's placed on top of it hidden). If the script executes, the message is hidden when the file is opened. If it's not, the message remains visible. hello, the easiest way to fix that would be to alter your existing user with the following: alter user myuser identified with mysql\_native\_password by 'mypassword'; another thing that you could do is to create a new user with mysql\_native\_password. to do that you could use the following: create user 'your\_user'@'your\_server\_ip ' identified with mysql\_native\_password by 'your\_password'; also as mentioned by @kavo13, try to upgrade php to 7.2 as well. after that, it should all work as normal. i’ve created a quick video demo on how to do that: i’m running the test on an ubuntu 18.04 droplet. hope that this helps! regards, bobby 1) Usage `yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

and `php yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

exactly the same. If you look at the file `yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, you'll see it in the first line `#!/usr/bin/env php`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

. This is called the "shebang" syntax and instructs your shell to automatically execute the `yii`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

script using binary code `php`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

. See: [https://en.wikipedia.org/wiki/Shebang\_%28Unix%29](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=)


2) The difference here is flexibility. If you use the syntax `Schema::TYPE_PK`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

, Yii will automatically detect the exact column type based on your database database. For example, it `Schema::TYPE_PK`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

translates to `int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

in MySQL, but if you use Postgres as your database, it will translate to `serial NOT NULL PRIMARY KEY`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

. [1]



  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

In practice, it is unlikely which method you are using because you are probably not going to switch to a different type of database halfway through your project, and therefore there is no need for your migration scripts to be database agnostic. Based on your preference, you can choose the syntax `Schema`
  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

for added flexibility, or for a hard-coded syntax to make your hyphenation definitions more readable for future readers.


[1] See [https://github.com/yiisoft/yii2/blob/master/framework/db/pgsql/QueryBuilder.php#L21](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=) and [https://github.com/yiisoft/yii2/blob/master/framework /db/mysql/QueryBuilder.php#L24](https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=) Have you tried restarting your browser? try:



```
echo "document.write(\"<div class=\"txt\">Pagerank: ".$rank->pagerank." <br>\")";
echo "document.write(\"Alexa: ".$rank->alexa_rank."</div>\")";
```

in the PHP-code.  

If it doesn't help then open that JS directly in your browser and tell us the error-reporting.