php ini_set function vs php.ini file directives

Home Forums BulletProof Security Pro php ini_set function vs php.ini file directives

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #22462

    Hi there,

    After having some out of memory fatal errors with js composer, it was suggested I contact our host to increase the memory limits.

    They then increased the limit in a root install php.ini file (which was already there, but was empty i think?), which of course BPS quarantined. Before restoring it from quarantine i thought I’d double check what they’d done and where (and it was just the setting in the php.ini file) but when I returned to BPS it was no longer in quarantine – odd I thought, but seemed OK.

    So that bit seems OK, but I’m not sure if I have to change anything in the wp-config file now I have a stand alone php.ini file? or will they work together – or does one over-ride the other?

    Is this OK, or should i copy some of the BPS code to my new php.ini file? Rather confused now, as I didn’t create this file so not sure if BPS recognises it OK? Looking forward to your views.

    My settings in the php.ini file are this:

    allow_url_fopen = on
    memory_limit = 512M

    and the php settings in my wp-congif via BPS are this:

    /** BEGIN BPS Pro ini_set Settings **/
    @ini_set('error_log','/home/mysite/public_html/wp-content/bps-backup/logs/bps_php_error.log'); // add the path to your php error log
    /** END BPS Pro ini_set Settings **/
    AITpro Admin

    Where a configuration setting may be set

    These modes determine when and where a PHP directive may or may not be set, and each directive within the manual refers to one of these modes. For example, some settings may be set within a PHP script using ini_set(), whereas others may require php.ini or httpd.conf.

    For example, the output_buffering setting is PHP_INI_PERDIR therefore it may not be set using ini_set(). However, the display_errors directive is PHP_INI_ALL therefore it may be set anywhere, including with ini_set().

    The allow_url_fopen directive can only be set in a php.ini file or the httpd.conf file.
    The memory_limit directive can be set using ini_set, BUT that only affects the directory where ini_set is used AND it cannot really actually affect the memory_limit setting for the server in a php.ini file or the httpd.conf file.  Example:  If the memory_limit setting is 256M in an ini_set function and the server memory_limit setting is 128M then the actual real PHP Configuration memory limit is 128M and not 256M.


    OK, so from what i understand of that is that the php.ini overrules the php.ini settings in wp-config. So If I ensure that the wp-config settings reflect those in the php.ini file then it should all work OK. Is that right?

    And then i don’t need to do anything else, as BPS will recognise that I have a php.ini stand-alone file too?


    AITpro Admin

    It’s more like there are some PHP server configuration settings that must be done in a php.ini file and then there are other PHP server configuration settings that can be done using the ini_set function in the wp-config.php file.  Go to BPS Pro P-Security >>> File Editor page and click the “Editing Php.ini Files or Other Files” Read Me help button.  What you will find is a list of php.ini directives and their settings.  You can edit your php.ini file directly from within BPS Pro using the File Editor and copy and paste settings into your php.ini file.


    Thanks so much – all seems fine now, so have left it as it is, apart from ensuring the memory limit settings are the same in the php.ini and wp-config files (just in case!).


Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.