noob
noob

Reputation: 279

PHP ini_set between Test and Production Server

I am currently working in a Legacy System and would like to set php settings only on one part of the function(PDF Parsing Large PDFs). the settings that I wish to change are the following:

ini_set( 'memory_limit', '1024M' );
ini_set( 'upload_max_filesize', '50M' );
ini_set( 'post_max_size', '50M' );
ini_set( 'max_execution_time', '240' );

On Local and Test Server, all four does change to the desired settings but on the production server, only the upload max filesize and post max size remains default. I don't really know which part to look why I can set the php settings programmatically on my Local and Test Servers but not in Production Server. I also don't want to change the php.ini settings if possible. Hope that you may have some idea how to do this.

Also related to This SO Question. I am also using the move_uploaded_file function. That is why I need to set these 4 things.

Note: I am currently searching if I can/need to use root command when using ini_set but still no relative result found yet.

PHP: 5.3.3

Upvotes: 0

Views: 278

Answers (1)

MJK
MJK

Reputation: 117

Some of the php setting cannot be set using the ini_set function ie runtime.

Looks like the "upload_max_filesize" and "post_max_size" setting are "PHP_INI_PERDIR" setting and can be set from php.ini, .htaccess, httpd.conf or .user.ini ( user directory specific ini files). It cannot be set from the ini_set function.

Please refer below links for more information

https://www.php.net/manual/en/configuration.changes.modes.php

https://www.php.net/manual/en/ini.list.php

https://www.php.net/manual/en/configuration.file.per-user.php

Upvotes: 1

Related Questions