php-ini

PHP out of memory error even though memory_limit not reached

此生再无相见时 提交于 2019-11-28 08:17:04
I have just inherited a site with a PHP script that is consistently running out of memory at 117 MB. This happens even when I increase PHP's memory_limit variable to 312 MB, which I'm doing via php.ini. This is now solved thanks to a great clue from pcguru. See my answer below that begins: I have finally found the answer ini_get('memory_limit') returns the value set in php.ini, so I'm certain Apache has restarted after changing the value. I'm using memory_get_usage(true) to return the memory consumed by the script at various points along the way. And it's consistently failing when it gets to

What is the difference between local value and master value

耗尽温柔 提交于 2019-11-28 04:27:47
When I display phpinfo(); i see two columns: local value and master value . When the web-server will choose local value and when it will choose master value ? master is either the value compiled into PHP, or set via a main php.ini directive. e.g. The value that's in effect when PHP fires up, before it executes any of your code. local is the value that's currently in effect at the moment you call phpinfo() . This local value is the END result of any overrides that have taken place via ini_set() calls, php_value directives in httpd.conf/.htaccess, etc... e.g. php.ini: foo=bar httpd.conf: php

PHP denying use of short hand “<?”

旧城冷巷雨未停 提交于 2019-11-28 01:26:22
I just installed php 5.3.0 and it won't run php scripts utilizing short open tags like <?, only <?PHP. You need to update your php.ini file. Set short_open_tag = 1 See the PHP Manual That's because it's simply a bad practice. I suggest re-converting all your scripts to use <?php . If you're lazy, you can use a find and replace, if you have access to powerful command lines like bash you can use sed to do this for you. http://us2.php.net/manual/en/ini.core.php you need to ini_set("short_open_tag", 1) or adjust your systems php.ini file. 来源: https://stackoverflow.com/questions/1527719/php-denying

ini_set() scope of effect?

穿精又带淫゛_ 提交于 2019-11-27 22:49:00
I've had index.php and several files which cascading include,something like this. index.php -> controller.php -> model.php -> view.php In model.php I have a function using ini_set('memory_limit', '-1'); When will the ini_set() change of the setting expire? After executed index.php ? Or view.php ? Or the function in model.php ? ini_set() is global for everything that happens in the script (not just the current file: the whole thread of execution that is occurring), for this entire one request; it doesn't matter whence you invoke it, it will always affect the global settings for this script. The

How to know which php.ini is used?

一世执手 提交于 2019-11-27 11:39:18
I search the path where the php.ini file is located in our Linux Ubuntu server, and I found many php.ini when executing the command find / -name php.ini . So how to know exactly from a php script web page where the php.ini is located ? You can use php_ini_loaded_file() Taken from php.net: $inipath = php_ini_loaded_file(); if ($inipath) { echo 'Loaded php.ini: ' . $inipath; } else { echo 'A php.ini file is not loaded'; } You may also want to check php_ini_scanned_files() Also, you should note that if you run a PHP script from CLI, it's possible that a different php.ini file will be used than if

PhpStorm $_POST always empty

别等时光非礼了梦想. 提交于 2019-11-27 07:42:50
问题 $_POST seems that does not work. I've installed PhpStorm 10.0.3, and using the WAMP server default php interpreter. in the index.php: <form method='post' action='a.php'> <input type='text' name='user_f'> <input type='submit' name='send' value='Send'> </form> In the a.php: var_dump($GLOBALS); when I type "asdf" in the form: array (size=9) 'HTTP_RAW_POST_DATA' => string 'user_f=asdf&send=Send' (length=22) '_GET' => array (size=0) empty '_POST' => array (size=0) empty '_COOKIE' => array (size=0)

what are the alternatives for php://input and $HTTP_RAW_POST_DATA when file_get_contents and always_populate_raw_post_data are disabled

 ̄綄美尐妖づ 提交于 2019-11-27 07:13:36
问题 My hosting comp has disabled all the socket functionality except curl. They are so irresponsible on my questions for enabling it. i can think of another hosting yet i want to know the following. I have asked a question related to this and this is a continuation yet another question. I am unable to use file_get_contents('php://input') and always_populate_raw_post_data is disabled in php.ini so i cannot use $HTTP_RAW_POST_DATA. So what is or are the alternatives to get a raw post data. For

setting max_input_vars PHP.ini directive using ini_set

北城以北 提交于 2019-11-27 03:46:50
问题 Can I set the max_input_vars PHP.ini directive in my code? I have it set at the default 1000, however I have a script that has many checkboxes and text fields that could, and quite possibly will, go over the 1000 limit. I'm using PHP 5.3.10 and i'm not getting any errors doing this. Also, I can't find any documentation that states I can't do this. ini_set('max_input_vars', 3000); Thanks. 回答1: max_input_vars has a changeable mode of PHP_INI_PERDIR meaning it can't be changed using ini_set

Change PHP version on server using either .htaccess or php.ini

浪尽此生 提交于 2019-11-27 03:19:35
问题 How can I change the PHP version to 5.2 on a server using either an .htaccess of php.ini file? 回答1: Adding AddHandler application/x-httpd-php52 .php .php5 .php4 .php3 to your .htaccess might work. 回答2: I take it you want to process e.g. .php3 files with php 3.x. You can't switch between php versions like this, but you might be able to do it by setting up a proxy server that distributes the query to one of several servers (one for each PHP version). There might also be some apache hack that

What is the difference between local value and master value

社会主义新天地 提交于 2019-11-27 00:16:49
问题 When I display phpinfo(); i see two columns: local value and master value . When the web-server will choose local value and when it will choose master value ? 回答1: master is either the value compiled into PHP, or set via a main php.ini directive. e.g. The value that's in effect when PHP fires up, before it executes any of your code. local is the value that's currently in effect at the moment you call phpinfo() . This local value is the END result of any overrides that have taken place via ini