0

In php.ini I have:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = On

If I have a php file with a syntax error in the root directory the error shows. If it is in a subdirectory, I see a blank page (as if display_errors=Off) I do see the errors in the error log.

How can I see the errors?

This is a hosted environment on bluehost.com and my php.ini file is located at /public_html/php.ini

Ted Scheckler
  • 1,229
  • 2
  • 14
  • 30
  • You are able to modify your `php.ini` file on a hosted environment? I heared that some hosting providers introduced such attempt. I also heard this requires you to put such a php.ini file _into every single directory_ ! I suggest you contact your provider about this. – arkascha Apr 21 '14 at 14:02
  • any [.htaccess](http://stackoverflow.com/questions/6127980/enabling-error-display-in-php-via-htaccess-only) in your directory tree? – didierc Apr 21 '14 at 14:06
  • Are you using .htaccess rules? the code die if you put the statement inside it ? – Mauricio Piber Fão Apr 21 '14 at 14:06
  • 1
    @arkascha - You should ___never___ need a php.ini file in every subdirectory of a site with any hosting provider – Mark Baker Apr 21 '14 at 14:07
  • @MarkBaker That was my knowledge too until a few weeks ago when I learned that some providers introduced such scheme. I do not say it makes sense or is a good idea. But indeed I saw replies from hosting companies support channels advising exactly that. Sorry. – arkascha Apr 21 '14 at 14:12
  • @arkascha - Can you name those ISPs, because multiple php.ini files in subdirectories is not only insane, it's almost impossible to maintain; and any ISP that does this must have customised PHP core code in some way that makes it's behaviour less predictable... any ISP that does this is one that all developers should avoid for their hosting – Mark Baker Apr 21 '14 at 14:14
  • @arkascha Are you positive that it isn't .htaccess files that ___can___ exist in both directories and subdirectories? – Mark Baker Apr 21 '14 at 14:16
  • @arkascha Yes... bluehost supports having a custom php.ini https://my.bluehost.com/cgi/help/128 – Ted Scheckler Apr 21 '14 at 14:18
  • @MauricioPiberFão no, there is no .htaccess in the subdirectory – Ted Scheckler Apr 21 '14 at 14:20
  • @MarkBaker no, I am _not_ talking about .htaccess style files here. I was extremely surprised about that approach myself, believe me. About security: I actually gave up about security when it comes to hosting providers Most of them are cheap 3 guys places these days who don't really know much about the technical side of the business. And frankly, most customers don't care either. If it comes to such offers it is just a question of costs, nothing else. Who cares for security in such cases? Seriously? Someone looking for security will _always_ prefer an personal server, virtual or physical. – arkascha Apr 21 '14 at 14:21
  • I'm talking on the top directory, there is a .htaccess on the top directory? copy them for me. – Mauricio Piber Fão Apr 21 '14 at 14:21
  • @MarkBaker If I read through that link FishBlubX posted then I'd say they offer _two_ flavors of each php versions: with a "single php.ini" and without. So if for the "single php.ini" flavor they explain that a single php.ini file will be used by all subsirectories, then the logical thing would be that this is _not_ the case for the other flavor. Actually they confirm exactly that below! Insane or not: _Fact_. – arkascha Apr 21 '14 at 14:30

1 Answers1

0

Add this line at top of your config file or particular php file:

ini_set('display_errors', 1);

This will change ini settings runtime.

Akshay Paghdar
  • 3,439
  • 2
  • 17
  • 34
  • 1
    That does work. I will use this as my workaround but still do not understand why this is happening. Perhaps the hosted environment falls back to the default ini file once you leave the directory with the php.ini file. – Ted Scheckler Apr 21 '14 at 14:30