4

I've got full control of my Apache / WHM / CPanel server. I have a default PHP.ini file set up for everything and that is just fun for the production server.

On the same server, I have a staging/testing server - and on it I want display_errors to be ON instead of OFF (as it is in the production site of course). How can I tell the server to use a local PHP.ini file in that directory?

Thanks!

Shackrock
  • 4,601
  • 10
  • 48
  • 74

2 Answers2

4

In complement to @i_forget answer: You can use the php_admin_value & php_value & php_flag & php_admin_flag directives to alter specific settings on a Virtualhost or on a directory.

<Directory /path/to/foo>
    php_value       include_path   ".:/var/www/foo/lib:/usr/share/php5/apc"
    php_admin_flag  file_uploads   on
    php_admin_value upload_tmp_dir "/my/tmp/upload/"
</Directory>

php_admin_value is safer than php_value (idem for flag) as the application cannot use ini_set to alter the value.

Here's it's one a Directory tag, so it could be as well on a .htaccess but you should'nt use .htaccess files if you have access to the configuration, use AllowOverride None :-). It could be as well on the VirtualHost, so before the the Directory tag.

regilero
  • 29,806
  • 6
  • 60
  • 99
  • Thanks, but for now I think it's simpler to do the above one... eventually I'll investigate doing it the right way as you described. – Shackrock Jul 16 '11 at 22:29
  • amazing worked good.. i turned file uploads only for phpmyadmin good. – luky Nov 05 '20 at 16:58
3

add an htaccess file to the dir with the rule php_flag display_errors on

plague
  • 1,908
  • 11
  • 11