Questions tagged [ini-set]

The ini_set() function is used to set PHP configuration options at runtime.

ini_set is a PHP function that allows developers to set a configuration option at runtime. This is done by calling the function in any PHP script with the option name ($varname) and the value ($newvalue) to be set:

ini_set ( string $varname , string $newvalue ) : string

If the execution is successful the function returns the previously set value, otherwise it returns false. At the end of the script execution the previous value will be restored automatically.

The option name must contain a valid configuration option name. A full list of names including their default values can be found in the List of php.ini directives in the PHP Manual. Only options with the modes PHP_INI_USER or PHP_INI_ALL can be changed with ini_set(). All other options require to be changed by editing php.ini.

91 questions
0
votes
1 answer

ini_set( 'memory_limit', '512M') - Syntax error - unexpected "M"?

I have some code in Wordpress that retrieves all Woocommerce product SKUs and is memory consuming (6000+ products) So, at the start of my function I tried to increase the limit temporarily: ini_set('memory_limit', '512M'); The result: PHP Parse…
0
votes
1 answer

Hoster blocking php config changes?

my client gave me access to the shared hosting (that he chose and paid) for a website I'm doing. PHP is running as CGI. I can't change PHP settings through ini_set at all! Is this possible? Is this a standard practice of shared hosting? What I…
Sandro Antonucci
  • 1,613
  • 5
  • 26
  • 53
0
votes
0 answers

Use ini_set functions for [custom].ini files except php.ini settings

I created a custom ini file for keep some array details. Not used for configuration like values. Then I would like to update or remove sections from this files. Currently I used parse_ini_file function and update the array and save that array to…
Shyju KP
  • 1
  • 2
0
votes
1 answer

Codeigniter: Allowed memory size of 33554432 bytes exhausted ( already using ini_set('memory_limit', '-1'); )

On my localhost, the process in question works fine. It's basically a whole lot of number crunching. But on my server (CentOS 5.9 + PHP 5 + MySQL 5) it gives me this error: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to…
Ben Chan
  • 210
  • 1
  • 10
0
votes
1 answer

PHP ini_set max_execution_time nog working properly?

To monitor the max_execution_time of a particular script, I use ini_set('max_execution_time', 600); //600 seconds = 10 minutes at the top of my script. However, when I build a logging of the same file it returns me the following: 25-09-2017…
TVA van Hesteren
  • 753
  • 1
  • 11
  • 36
0
votes
1 answer

Is it possible to disable PHP slow log per script?

I have one script on my webpage which process a lot of informations and It should be slow. But php-fpm is terminating it, because of slow log. I just see in logs NOTICE: child 26537 stopped for tracing and web server throws me 504 error. I tried to…
StanleyD
  • 2,060
  • 20
  • 20
0
votes
1 answer

PHP ini_set open_basedir has no effect

I've got this problem on my Ubuntu + PHP 7.0.18 + Apache2: In my php.ini is set the open_basedir = /var/www:/tmp. It works fine. But in one web app I need to use another dirs to work with. I am trying to set it through ini_set: ini_set( …
Kukymbr
  • 3
  • 1
  • 2
0
votes
0 answers

Can't publish Laravel app because of ini_set()

I can't seem to get my Laravel application working because my shared hosting has ini_set() disabled. I have found some workarounds which rely on enabling ini_set(). Neither could I do that (I have tried) because my hosting provider doesn't allow it,…
Misa Kovic
  • 1
  • 1
  • 2
0
votes
3 answers

php specific function / url / file max post size?

I was wondering if you can set the post_max_size only for a specific page or function (in the php.ini)? You can set it in the .htaccess php_value upload_max_filesize 4M php_value post_max_size 4M but it doesn't work for a specific page. Also…
BramscoChill
  • 343
  • 3
  • 14
0
votes
2 answers

PHP: [Bug] Why does "display_errors" exist if only "error_reporting" can hide or show errors?

EDIT: My Environment is the following (this is relevant to the answer): Microsoft IIS 10.0 Express Windows 7 Professional SP1 PHP Version 5.6.16 x86 FastCGI I am trying to figure out what purpose the setting "display_errors" has. In the…
user3163495
  • 1,089
  • 11
  • 31
0
votes
4 answers

Using ini_set('memory_limit') in a php function

I have a particularly memory intensive function I'd like to (just while that function is running) up the allowed memory for it to complete. Is it poor practice to use ini_set('memory_limit' , '1024M') within a php function and once the function is…
Bysander
  • 119
  • 2
  • 8
0
votes
1 answer

Restoring Default Error Reporting in PHP

While debugging my php script, I wanted to figure out how to get php to display all error messages, including notices. I found this thread which recommended these lines of…
0
votes
1 answer

Issue with max_execution_time during file import in php 5.4.22

PHP Version: PHP Version 5.4.22 JS :ExtJs I'm facing to the problem below: I've an CSV import in PHP and after about 30 to 30.5 seconds the XHR process canceled, then the browser (Chrome, Firefox) hang on and finished the process. All the data are…
michael-mammut
  • 1,917
  • 2
  • 19
  • 38
0
votes
2 answers

Is it possible to set a location of a library extension within a Php file

I want to load an extension within a Php file as I don't have access to the php.ini file. I tried: ini_set('extension','php_gd2.dll'); With the file in the same directory as the Php page but it did not work. Must it always be done with in php.ini…
Tom
0
votes
2 answers

ini_set is NOT setting the values inside php.ini

I'm trying to set a new directory for upload_tmp_dir and set a new upload_max_filesize but it's not working... I'm displaying the results but I'm getting the old (default php.ini settings)…