Page 1 of 1

how would i change the php.ini file?

Posted: Tue May 18, 2004 2:03 pm
by mikewooten
how would i change the php.ini file?
would i change it using the ini_set()?
if so, how would i go about changing the php.ini with the ini_set()?
what other code would i have to use with it to edit the file.
i think i need to edit or change the upload_tmp_dir to the path that i'm uploading images to.
i need that to work with my upload script that i'm using to upload images into my directory because at the moment my upload script wont uplaod images, and i think its because of the upload_tmp_dir.
if anyone can help me, that would be appreciated.
thanks

Posted: Tue May 18, 2004 2:22 pm
by ol4pr0
Edit: ?:\php\php.ini with any txt editor

or Edit ini with ini_set();

Code: Select all

// example 
ini_set("max_execution_time", "0");

Code: Select all

can all be found on php.net

upload_max_filesize	"2M"	PHP_INI_SYSTEM|PHP_INI_PERDIR
file_uploads	"1"	PHP_INI_SYSTEM
post_max_size	"8M"	PHP_INI_SYSTEM|PHP_INI_PERDIR
upload_tmp_dir	NULL	PHP_INI_SYSTEM

Code: Select all

ini_set("upload_tmp_dir", ""); // ect ....
http://www.php.net/manual/en/function.ini-set.php

Posted: Tue May 18, 2004 2:50 pm
by mikewooten
so the example to change the upload_tmp_dir with ini set, it would be like this?

Code: Select all

<?php

ini_set("upload_tmp_dir", "/home/username/public_html/folder1/p_imgs/");

?>
if i wanted to change back the upload_tmp_dir to NULL after changing the directory, would it be like this?

Code: Select all

<?php

ini_set("upload_tmp_dir", "NULL");

?>
??
thanks

Posted: Tue May 18, 2004 3:06 pm
by ol4pr0
In theory that should work,however i have never tried this with the upload_tmp_dir .Te best to try this out.. is make a info.php ( ini_set will only change the value for that page .. so for any other page you do not need to change the value back into NULL.

Code: Select all

<?
ini_set("upload_tmp_dir" , "");
phpinfo();

// than scroll down and see if it did make the nesecary changes 
?>
Edit: I just tried this on my php and it seems that i can not edit the upload_tmp_dir using the ini_set. I do use ini_set(); frequently with some other values i need to locally change on some pages which work fine.


windows -> edit with txt editor the c:\php\php.ini and scroll down where it says
;upload_tmp_dir =
replace it with
upload_tmp_dir = "/ure/dir/ ";

linux-> /usr/local/lib ( or where ever you installed php )

and do the same .

Posted: Tue May 18, 2004 3:27 pm
by ol4pr0
some additional information which also can be found on that php.net page.

Code: Select all

PHP_INI_USER	1	Entry can be set in user scripts
PHP_INI_PERDIR	2	Entry can be set in php.ini, .htaccess or httpd.conf
PHP_INI_SYSTEM	4	Entry can be set in php.ini or httpd.conf
PHP_INI_ALL	7	Entry can be set anywhere
That will tell you where you can set the values or where you can modify them ( php.page / ini .. ect.. )

basicly that means..

either for you to be able to edit this with ini_set();

it would have to have be a constant PHP_INI_ALL

Posted: Tue May 18, 2004 3:53 pm
by mikewooten
i am using a hosting service and i am using the web hosting companies server to host all of my files. knowing that, how else would i edit the php.ini file if ini_set() wont let you edit the upload_tmp_dir?

could i make a info.php page for more than one directory?

so.. i could use ini_set() for every page and set the upload_tmp_dir to be different on every page?
thanks

Posted: Tue May 18, 2004 7:45 pm
by mikewooten
how would you change the permissions for the upload_tmp_dir in an .htaccess file? i emailed my hosting company and they said that i couldn't change the php.ini file because it was an server wide issue and that i had to create a .htaccess file and save it in the folder.
thanks

?

Posted: Tue May 18, 2004 9:44 pm
by mikewooten
??