Tuesday, 15 January 2013

Default php.ini variable path locations (session.save_path, soap.wsdl_cache_dir, upload_tmp_dir) -



Default php.ini variable path locations (session.save_path, soap.wsdl_cache_dir, upload_tmp_dir) -

i wondering how default values determined each of these values on windows, mac, linux:

session.save_path soap.wsdl_cache_dir

upload_tmp_dir

also other php.ini variables involve paths on file scheme aware of?

based on investigation on windows seems session.save_path c:\windows\temp. safe location? when deleted?

how default values determined session.save_path

for session.save_path, php.ini defined value used default, otherwise path determined here:

https://github.com/php/php-src/blob/master/ext/session/mod_files.c#l264

that calls php_get_temporary_directory defined here:

https://github.com/php/php-src/blob/master/main/php_open_temporary_file.c#l192

if you're using windows, uses win32 api phone call gettemppath temporary folder path (see http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992%28v=vs.85%29.aspx) if you're using unix, uses tmpdir environment variable. if else fails, falls /tmp soap.wsdl_cache_dir

soap.wsdl_cache_dir attempts utilize defined php.ini value. if isn't found default /tmp via code:

https://github.com/php/php-src/blob/master/ext/soap/soap.c#l520

read more std_php_ini_entry here: http://docstore.mik.ua/orelly/webprog/php/ch14_12.htm

upload_tmp_dir

upload_tmp_dir set null (but utilize php.ini override), along many default values, in:

https://github.com/php/php-src/blob/master/main/main.c#l579

std_php_ini_entry("upload_tmp_dir", null, php_ini_system, onupdatestringunempty, upload_tmp_dir, php_core_globals, core_globals)

and used in file upload here:

https://github.com/php/php-src/blob/master/main/rfc1867.c#l1006

fd = php_open_temporary_fd_ex(pg(upload_tmp_dir), "php", &temp_filename, 1 tsrmls_cc);

this function, if empty upload_tmp_dir passed, defaults using php_get_temporary_directory function mentioned earlier.

also other php.ini variables involve paths on file scheme aware of?

there plenty. quick through https://github.com/php/php-src/blob/master/main/main.c shows plenty of default configs utilize paths (open_basedir, include_path, sys_temp_dir, extension_dir , error_log name few). in addition, extensions have own collection of configurations include path parameters.

based on investigation on windows seems session.save_path c:\windows\temp. safe location? when deleted?

when openning temporary files on windows, php sets permission exclusive user running webserver, should mean it, , administrators, able access contents of file:

https://github.com/php/php-src/blob/master/main/php_open_temporary_file.c#l149

php

No comments:

Post a Comment