Joseph
Joseph

Reputation: 23

php ini_set and ini_get isnt working the way I want

Im using this

    ini_set('post_max_size','40M');
echo ini_get('post_max_size');

And for some reason post_max_size is echoing out 8M (the default one) and not 40M. Is the

Upvotes: 2

Views: 1755

Answers (2)

Sarfraz
Sarfraz

Reputation: 382871

The post_max_size isn't settable at runtime. PHP only runs after the file has been uploaded, you can't use the ini_set until the upload_max_filesize has been determined. So, you can't use ini_set to set the setting for that reason.

You will have to set this option directly from php.ini.

See the docs for more info

Upvotes: 4

netcoder
netcoder

Reputation: 67745

post_max_size is a INI directive that can be changed PHP_INI_PERDIR only, as stated in the manual.

Again, from the manual:

PHP_INI_PERDIR : Entry can be set in php.ini, .htaccess or httpd.conf

Upvotes: 1

Related Questions