Jump to content

Max filesize stays at 2MB


Cory94bailly

Recommended Posts

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

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.)

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?

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.

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 ;)

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

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.

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 ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.