php-general Digest 11 Nov 2012 17:30:22 -0000 Issue 8035

Topics (messages 319669 through 319672):

Re: The require and include
        319669 by: Maciek Sokolewicz
        319670 by: Matijn Woudt

Rest Authentication
        319671 by: Adam Tong

memory allocation error
        319672 by: Carol Peck

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 10-11-2012 17:38, andrej arshinow wrote:
I knew that before the function require a faster because All files are
included before run the script. Now is this? And how to use it?


I don't understand your question, could you please try to elaborate? Are you asking whether include is faster than require? Or something different? Because I really don't understand your version of english...

- Tul

--- End Message ---
--- Begin Message ---
Include is faster than require, not the other way around. See for example
[1] (the text is french, but you'll get the performance difference.), it
shows include is about 38% faster on 1000 includes.

I also don't think require includes files before the script is run, because
PHP is a dynamic language, and you might do things like include
$somevar.".php"; or require $somevar.".php"; which can only be done when
PHP knows what somevar will be. Note that I do absolutly recommend NOT to
use variables for including, as it leads to possible security issues,
especially when the var is related to user input.

As of how to use it, I'd say read the PHP manual [2], but it is as simple
as replacing the word include with require.

- Matijn

[1] http://dev.petitchevalroux.net/php/benchmark-require-include-php.34.html
[2] http://www.php.net/require


On Sat, Nov 10, 2012 at 5:38 PM, andrej arshinow <arshand...@gmail.com>wrote:

> I knew that before the function require a faster because All files are
> included before run the script. Now is this? And how to use it?
>

--- End Message ---
--- Begin Message ---
Hi,

I am developing a REST API. I found the Slim micro-framework usefull.
I need authentication of course, and I see that Slim does not provide
authentication for Rest. Is there any lightweight alternative to
manually implementing http authentication and the hassle of apache
configurations?

Thank you

--- End Message ---
--- Begin Message ---
Hi all,
I've been chasing around a memory allocation error for some time and can't figure it out. It is somewhat random - I can run the script 3 times and then it will happen, or sometimes the first time.

It happens at the very end of a script, actually after the script has finished running. I will see the following after the closing </html> tag:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 494142432 bytes) in Unknown on line 0

Just previous to this my mem usage is 3772104


The script itself does some database work (deletes, inserts, selects) but nothing very heavy and writes out an XML file. I use adodb 5.18, the server is PHP 5.3.18 (this was updated recently) and it is a VPS on inmotionhosting.com.

As you can see, the memory limit is 256M so it's really high and I never see that I'm using more than 4M. The error doesn't fall through my error class - I'm assuming that's because it is happening after the script is complete.

I am completely out of ideas on how to trap it or figure it out.
Any ideas would be appreciated!




--- End Message ---

Reply via email to