apache - How do I create custom php.ini files for each virtual host? -


i've installed easyphp wamp local development (i'm not hosting websites).

is there way set custom php settings separate virtual hosts?

currently , out-of-the-box, php.ini file loaded from: c:\program files (x86)\easyphp-devserver-14.1vc11\binaries\php\php_runningversion\php.ini nice if, say, drop in custom php.ini file virtual host directory override settings in original php.ini way, better emulate production server's environment on per-site basis.

i've seen work online hosting accounts. can't figure out how make work on machine.

using custom php.ini files pretty straighforward cgi/fastcgi based php installations isn't feasible when running php apache module (mod_php) because whole server runs single instance of php interpreter.

my advice:

  • set php many settings can:

    ini_set('memory_limit', '16m'); date_default_timezone_set('europe/madrid') ... 

    in other words, directives can changed @ runtime.

  • set rest of stuff per-directory apache setting files (aka .htaccess):

    php_flag short_open_tag off php_value post_max_size 50m php_value upload_max_filesize 50m 

    i.e., settings need defined before script starts running

please have @ runtime configuration further details.

sometimes, you'll need different settings in development , production. there're endless ways solve php code (from creating boolean constant $_server['http_host'] variable having config.php file different values) it's trickier .htaccess. use <ifdefine> directive:

<ifdefine dev-box>     #     # local server directives     #     setenv development "1"      php_flag display_startup_errors on     php_flag display_errors on     php_flag log_errors off     #php_value error_log ... </ifdefine> <ifdefine !dev-box>     #     # internet server directives     #     php_flag display_startup_errors off     php_flag display_errors off     php_flag log_errors on     php_value error_log "/home/foo/log/php-error.log" </ifdefine> 

... dev-box string pass local apache command-line:

c:\apache24\bin\httpd.exe -d dev-box 

if run apache service, -d dev-box bit can added in windows registry, e.g.:

hkey_local_machine\system\currentcontrolset\services\apache2.4\parameters\configargs 

related: find out how php running on server (cgi or fastcgi or mod_php)


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -