Cory94bailly Posted April 10, 2009 Share Posted April 10, 2009 Hi, I am trying to fix my current script where users can upload files.. The script itself works perfectly but no matter what I do, I can't change the max file size. ini_set('post_max_size', '50M'); ini_set('upload_max_filesize', '50M'); I have those, then do phpinfo(); and it keeps post_max_size at 8M and upload_max_filesize at 2M. I am pretty sure I can do ini_set because it has worked for me before.. Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 10, 2009 Share Posted April 10, 2009 Like it states in the php manual, those two settings cannot be set in a script. post_max_size PHP_INI_PERDIR upload_max_filesize PHP_INI_PERDIR They must be set before your script runs. You can set them in the master php.ini, in a .htaccess file (when php is running as an Apache module), or in a local php.ini (when php is running as a CGI application.) Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/#findComment-806508 Share on other sites More sharing options...
Cory94bailly Posted April 10, 2009 Author Share Posted April 10, 2009 Oh well that's not very good, my host (a friend) doesn't want to have the server search for php.ini or .htaccess in every folder because it would slow down everything.. So basically, there is no way unless I can do that? Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/#findComment-806514 Share on other sites More sharing options...
Mark Baker Posted April 10, 2009 Share Posted April 10, 2009 You don't normally search for php.ini in every folder. It's only ever read once when Apache/your web server of choice is started up, from a known directory location... and is then used automatically by every php script that runs without needing to be read again. Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/#findComment-806592 Share on other sites More sharing options...
Cory94bailly Posted April 10, 2009 Author Share Posted April 10, 2009 You don't normally search for php.ini in every folder. It's only ever read once when Apache/your web server of choice is started up, from a known directory location... and is then used automatically by every php script that runs without needing to be read again. But the server is running lighttp, not apache Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/#findComment-806606 Share on other sites More sharing options...
Mark Baker Posted April 10, 2009 Share Posted April 10, 2009 But the server is running lighttp, not apache That's why I said Apache/your web server of choice Given that lighttp prides itself on its speed and performance, I can't believe that it searches for php.ini and loads it for every single page request Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/#findComment-806626 Share on other sites More sharing options...
PFMaBiSmAd Posted April 10, 2009 Share Posted April 10, 2009 The master php.ini is read every time php starts. For a server module version of php, that is once when the server is started. For a CGI version of php, that is done on every page request. For .htaccess files and local php.ini files, they are read on every page request. Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/#findComment-806639 Share on other sites More sharing options...
Cory94bailly Posted April 10, 2009 Author Share Posted April 10, 2009 But the server is running lighttp, not apache That's why I said Apache/your web server of choice Given that lighttp prides itself on its speed and performance, I can't believe that it searches for php.ini and loads it for every single page request It is fast and all, it's just that the site that is hosted on the server is very popular.. The master php.ini is read every time php starts. For a server module version of php, that is once when the server is started. For a CGI version of php, that is done on every page request. For .htaccess files and local php.ini files, they are read on every page request. Yes but he does not want to change the master php.ini just for me... I'll ask him into having it scan my main folder for a php.ini or .htaccess Link to comment https://forums.phpfreaks.com/topic/153495-max-filesize-stays-at-2mb/#findComment-806643 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.