title: PHP error handling with .htaccess & writing into php_error.log text file
body: <p>For PHP error handling with the aim of "only admin sees the warnings, errors etc.";</p>
  
  <p>I applied the steps below:</p>
  
  <ol>
  <li>I deleted <code>error_reporting(-1);</code> command from my <code>index.php</code></li>
  <li>I added rows below into my <code>.htaccess</code> which is just under <code>public_html</code> folder</li>
  <li>I created <code>error_modes</code> folder in my <code>public_html</code> folder</li>
  <li>I created <code>.htaccess</code> file in <code>error_modes</code> folder</li>
  <li>I set the permissions of the <code>error_modes</code> folder as <code>777</code>, writable.</li>
  <li>intentionally, I wrote <code>&lt;?php 'should see this error in log file' ?&gt;</code> in my <code>footer.inc.php</code> page. Please note that I didn't wrote <code>;</code> character at the end.</li>
  </ol>
  
  <p><strong>Despite</strong> the intentional <strong>php syntax error</strong> in my <code>footer.inc.php</code> page, <strong>no <code>php_error.log</code> file is created!</strong></p>
  
  <p><strong>and I saw that <em>should see this error in log file</em> <code>string</code> is printed in my <code>footer.inc.php</code> page. So php worked despite a syntax error !?</strong></p>
  
  <p>I also added my whole <code>.htaccess</code> code below. (this is the one that is just under <code>public_html</code>)</p>
  
  <p><strong>fyi</strong>: I don't have access to <code>php.ini</code> and I don't have any pre-set <code>.log</code> file. PHP version is 5.4.</p>
  
  <p>Can you please correct me? Thanks. Best Regards.</p>
  
  <h2>added commands into public_html > .htaccess for error handling</h2>
  
  <pre><code>php_flag  log_errors on
  php_flag display_errors off
  php_value error_log  /home/my_user_number/public_html/error_modes/php_error.log
  php_value error_reporting -1
  </code></pre>
  
  <h2>codes in error_modes > .htaccess</h2>
  
  <pre><code>Order allow,deny
  Deny from all
  </code></pre>
  
  <h2>whole codes in public_html > .htaccess</h2>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  #always use www - redirect non-www to www permanently
  RewriteCond %{HTTP_HOST} !^www\.
  RewriteCond %{HTTPS}s on(s)|
  RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  
  
  # hotlink protection
  RewriteCond %{HTTP_REFERER} !^$
  RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.p.ht [NC]
  RewriteRule \.(jpg|jpeg|png|gif|css|js)$ - [NC,F,L]
  
  # compress text, html, javascript, css, xml:
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  
  # File caching is another famous approach in optimizing website loading time
  &lt;FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$"&gt;
  Header set Cache-Control "max-age=2592000"
  &lt;/FilesMatch&gt;
  
  # disable directory browsing
  Options All -Indexes
  
  # secure htaccess file
  &lt;Files .htaccess&gt;
   order allow,deny
   deny from all
  &lt;/Files&gt;
  
  # secure password file
  &lt;Files .mypassword&gt;
   order allow,deny
   deny from all
  &lt;/Files&gt;
  
  # secure spesific files
  &lt;Files secret.php&gt;
   order allow,deny
   deny from all
  &lt;/Files&gt;
  
  # secure spesific files
  &lt;Files secret2.php&gt;
   order allow,deny
   deny from all
  &lt;/Files&gt;
  
  #SEO friendly linking
  RewriteRule ^sitemap.xml$ sitemap.php [L]
  RewriteRule ^articles/(.+)/(.+)$ index.php?page=articles&amp;subject=$1&amp;object=$2 [L]
  RewriteRule ^articles/(.+)$ index.php?page=articles&amp;subject=$1 [L]
  RewriteRule ^labels/(.+)$ index.php?page=labels&amp;subject=$1 [L]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^/?([^/]+)$ index.php?page=$1 [L]
  
  #error handling
  php_flag  log_errors on
  php_flag display_errors off
  php_value error_log  /home/my_user_number/public_html/error_modes/php_error.log
  php_value error_reporting -1
  </code></pre>