Re: Re: [PHP] include
| From: | Tim Streater | Date: | Mon, 21 Nov 2011 10:56:00 +0000 |
| Subject: | Re: Re: [PHP] include | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-315782@lists.php.net to get a copy of this message | ||
On 20 Nov 2011 at 23:46, Tamara Temple <tamouse.lists@tamaratemple.com> wrote:
> Tim Streater <tim@clothears.org.uk> wrote:
>
>> At the moment I'm using an instance of apache to run PHP scripts, as
>> and when required via AJAX. Having got some understanding of web
>> sockets, I'm minded to look at having a small server to execute these
>> functions as required. The scripts, some 50 or so, are only about
>> 300kbytes of source code, which seems small enough that it could all
>> be loaded with include, as in:
>
>> <?php
>> $fn = 'wiggy.php';
>> include $fn;
>> ?>
>>
>> This appears to work although I couldn't see it documented.
>
> I'm really not sure what you're looking for here -- that is pretty
> standard php practice to load php files with include -- what were you
> expecting here?
I'm looking for confirmation that:
include $fn;
is an allowed form of the include statement.
> While it's certainly possible to rig up something using sockets, I don't
> think that's how AJAX works, and you'd need a JS library that did.
Hmmm, I think perhaps I've not made myself clear - sorry about that. At present I'm using
AJAX and apache; I'd like to *stop* doing that (and not use another web server, either). In my
case, client and server are the same machine - the user's machine. There is a browser window
and JavaScript within it which makes the AJAX requests. I just happen to use apache to have a
variety of PHP scripts run to provide results back to the browser window.
> Generally, you should only really need to dynamically replace parts of a
> long-running program if you don't want to restart it. However, php
> scripts are not long-running programs in general, unlike the apache
> server itself, for example, and certainly if the php scripts are running
> under apache, they will be time- and space-limited by whatever is set in
> the php.ini file. If these little scripts are merely responding to AJAX
> requests, they should be really short-lived.
At present these scripts generally are short-lived, but with some notable exceptions. Hence my
exploration of whether I could use websockets instead.
--
Cheers -- Tim