Set php second configuration ( php.ini file ) -


i want set own (php2.ini) file, few lines must overwrite first php.ini settings - lines.

so start looking on google , seems need parse_ini_file function.

ok. now, in index.php have:

parse_ini_file("php2.ini"); phpinfo(); exit(); 

but settings php2.ini not loaded....

trying see if file php2.ini read-it , is, beacause if set parse_ini_file("php2-not-exist.ini") tells me file cannot found. file php2.ini read, settings not overwrited.

the php2.ini file has inside next lines:

error_log = "errors.log" display_errors = "0" max_execution_time = "300" upload_max_filesize = "60m" post_max_size = "60m" date.timezone = "europe/bucharest" default_charset = "utf-8" mbstring.internal_encoding = "utf-8" mbstring.http_output = "utf-8" mbstring.encoding_translation = "on" mbstring.func_overload = "6" 

trying let file 1 line post_max_size = "60m", still not overwriting general php.ini settings.

there 1 thing don't understand....

i know settings can setted , using php.ini file configuration. setting second file parse_ini_file witch function php.... not correct, because servers doesn't allow edit general php.ini file. how can php let set second php ini file if don't have access general 1 ? don't know if has problem. i'm saying maybe here problem.

right i'm using wamp php 5.5.12. want when upload website up, done. know hosting servers lets have second php.ini file must uploaded in public_html or whatever folder is. why want set php2.ini file. have website clean when i'll upload hosting.

i'm waiting answer please.

thank you.

the php parse_ini_file() function reads ini file associative array. not set them settings php.ini file.

there not convenience function override server settings this. may want here .user.ini (the leading dot important) files:

since php 5.3.0, php includes support configuration ini files on per-directory basis.

and:

in addition main php.ini file, php scans ini files in each directory, starting directory of requested php file, , working way current document root (as set in $_server['document_root']). in case php file outside document root, directory scanned.

for full documentation on feature, take @ http://php.net/manual/en/configuration.file.per-user.php.

note subset of settings can changed here:

only ini settings modes php_ini_perdir , php_ini_user recognized in .user.ini-style ini files.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -