Showing all errors and warnings
<p><strong>UPDATE 2:</strong></p>

<p>I have now removed the following from the .php file:</p>

<pre><code>&lt;?php error_reporting( E_ALL ); ?&gt;
</code></pre>

<p>I have set display_erros in php.ini as follows:</p>

<blockquote>
  <p>display_errors = On</p>
</blockquote>

<p>error reporting is set to the following in php.ini</p>

<blockquote>
  <p>error_reporting = E_ALL | E_STRICT</p>
</blockquote>

<p>After restarting apache, I still get no errors/warnings.</p>

<p><strong>UPDATE 1:</strong></p>

<p>I have changed error_reporting in php.ini from:</p>

<blockquote>
  <p>error_reporting = E_ALL &amp;
  ~E_DEPRECATED</p>
</blockquote>

<p>to</p>

<blockquote>
  <p>error_reporting = E_ALL | E_STRICT</p>
</blockquote>

<p>After which I restarted apache, e.g.</p>

<blockquote>
  <p>/etc/init.d/apache2 restart</p>
</blockquote>

<p>But the page will still not display errors/warnings of any kind.</p>

<p><strong>ORIGINAL QUESTION:</strong></p>

<p>The following script is generating an warning because the $err being inside the if statement.  Why is this warning not being displayed on the php page in a web browser?  I have to look at apache logs to see the warning.  Also, if I delibarately change the "insert into" to "delete into", it does not display an error on the php page.  Why are the errors not displaying on the actual php page?</p>

<pre><code>&lt;?php
    error_reporting( E_ALL );
?&gt;

&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;link rel="icon" type="image/png" href="favicon.ico"&gt;

        &lt;?php
            if( $_SERVER['REQUEST_METHOD']=='POST' ) {
                $err = array();

                if( empty( $_POST['display_name'] ) ) $err[] = "display name field is required";
                if( empty( $_POST['email'] ) ) $err[] = "email field is required";
                if( empty( $_POST['password'] ) ) $err[] = "password field is required";

                if( !$err ) {
                    try {
                        $DBH = new PDO( "mysql:host=localhost;dbname=database1", "user", "pass" );
                        $DBH -&gt; setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

                        $STH = $DBH -&gt; prepare( "delete into table1 (display_name, email, password) values ( :display_name, :email, :password )" );

                        $STH -&gt; bindParam( ':display_name', $_POST['display_name'], PDO::PARAM_STR, 100 );
                        $STH -&gt; bindParam( ':email', $_POST['email'], PDO::PARAM_STR, 100 );
                        $STH -&gt; bindParam( ':password', $_POST['password'], PDO::PARAM_STR, 100 );

                        $STH -&gt; execute();

                        $STH = $DBH -&gt; prepare( "delete into table2 ( username, status, users_id ) values ( :username, :status, :users_id )" );

                        $strStatus = 1;

                        $STH -&gt; bindParam( ':username', $_POST['display_name'], PDO::PARAM_STR, 100 );
                        $STH -&gt; bindParam( ':status', $strStatus, PDO::PARAM_INT, 1 );
                        $STH -&gt; bindParam( ':users_id', $_POST['referer'], PDO::PARAM_INT, 1 );

                        $STH -&gt; execute();

                        $DBH = null;
                    } catch( PDOException $e ) {
                        echo $e -&gt; getMessage();
                    }

                    header( "Location: ".$_SERVER['PHP_SELF'] );
                    exit;
                } else {
                    foreach( $_POST as $key =&gt; $val ) {
                        $form[$key] = htmlspecialchars($val);
                    }
                }
            } else {
                $form['display_name'] = $form['email'] = $form['password'] = '';
            }
        ?&gt;
    &lt;/head&gt;

    &lt;body&gt;
        &lt;?php foreach( $err as $line ) { ?&gt;
        &lt;div style="error"&gt;&lt;?php echo $line; ?&gt;&lt;/div&gt;
        &lt;?php } ?&gt;

        &lt;h1&gt;register&lt;/h1&gt;

        &lt;form method="post"&gt;
            referers id:&lt;br /&gt;
            &lt;input type="text" name="referer" /&gt;&lt;br /&gt;&lt;br /&gt;

            name:&lt;br /&gt;
            &lt;input type="text" name="display_name" value="&lt;?php echo $form['display_name']; ?&gt;" /&gt;&lt;br /&gt;&lt;br /&gt;

            email:&lt;br /&gt;
            &lt;input type="text" name="email" value="&lt;?php echo $form['email']; ?&gt;" /&gt;&lt;br /&gt;&lt;br /&gt;

            password:&lt;br /&gt;
            &lt;input type="text" name="password" value="&lt;?php echo $form['password']; ?&gt;" /&gt;&lt;br /&gt;&lt;br /&gt;

            &lt;input type="submit" value="register" /&gt;
        &lt;/form&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
