简体   繁体   中英

Configure PHP on IIS with FastCGI to show warnings but continue executiuon

I am using PHP (7.3.7) Non-ThreadSafe on IIS (windows) as FastCGI.

PHP installation is fresh and just php.ini-development renamed to php.ini thus error_reporting is set to E_ALL

running following script

<?php
echo "some text\n" ;
echo $aaaaaaa;
echo "another text\n" ;
?>

will generate output

PHP Notice:  Undefined variable: aaaaaaa in ****\article.php on line 3

Note that first and 3rd lines are missing from output.

Using same installation of php, on apache (2.4.39) and nginx (1.17.2) (also on windows system) shows following output

some text
PHP Notice:  Undefined variable: aaaaaaa in ****\article.php on line 3
another text

Is there an specific configuration that I need to change so PHP show same output as apache, nginx in IIS too?
or in other words, how can I configure my setup to show warning and notices and also the output of script.

I tried same script with PHP (7.1.30, 7.2.11, 5.2.10.10) and same issue still persists on IIS but not on apache or nginx.

Edit

  • I know that if I set error_reporting is set to E_ALL , all errors, warning and notices are shown and when I change it to E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED notices and warnings are disabled and won't show.

  • I also know that $aaaaaaa is not defined and it being there is for illustration of the issue.

Edit 2
It seems this has to do with configuration of fast-cgi on IIS. On same machine with same php installation and configuration using apache and nginx I can see exactly what Phil and sancoLgates shown in their links. I am editing my question to reflect the issue

In your code variable $aaaaaaa is not defined so define it first. To check error add this code

<?php

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

    // and then add your code below 

    ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM