Re: [PHP] Forcing auto_prepend_file to work regardless of what document was accessed

2005-10-23 Thread Richard Lynch
On Sat, October 22, 2005 11:42 pm, Dan Trainor wrote:
 This would be a great solution, and I'm sure my concern is something
 that's been discussed many times on this list - I'm worried about the
 performance hit that the machine would take, if/when parsing a large
 number of files, in this manner.

 For small sites, I have no problem adding .html, .htm and friends to
 PHP's own AddType.  But I'm not so sure for larger sites.

 I'll browse the archive for info and data, and weigh my options.

Last benchmarks I saw clocked in at 5 to 10% loss to run all .htm and
.html files through PHP.

That was awhile ago, though.

Test on a dev server with apache benchmark (ab) before and after and see.

PHP doesn't really *DO* much until it hits '?php' if you think about it.

It just reads the file, uses something like strtok() to search for
'?php' and spits it back out.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Forcing auto_prepend_file to work regardless of what document was accessed

2005-10-23 Thread Dan Trainor

Richard Lynch wrote:

On Sat, October 22, 2005 11:42 pm, Dan Trainor wrote:


This would be a great solution, and I'm sure my concern is something
that's been discussed many times on this list - I'm worried about the
performance hit that the machine would take, if/when parsing a large
number of files, in this manner.

For small sites, I have no problem adding .html, .htm and friends to
PHP's own AddType.  But I'm not so sure for larger sites.

I'll browse the archive for info and data, and weigh my options.



Last benchmarks I saw clocked in at 5 to 10% loss to run all .htm and
html files through PHP.

That was awhile ago, though.

Test on a dev server with apache benchmark (ab) before and after and see.

PHP doesn't really *DO* much until it hits '?php' if you think about it.

It just reads the file, uses something like strtok() to search for
'?php' and spits it back out.


Richard -

Excellent;  I'll be looking into that more.

Thanks
-dant

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Forcing auto_prepend_file to work regardless of what document was accessed

2005-10-22 Thread Richard Lynch
On Sat, October 22, 2005 11:25 pm, Dan Trainor wrote:
 Anyone know if it's possible to use auto_prepend_file to force the
 appending of a file to the request, regardless of what kind of
 document
 is generated?

 I can see this being a problem if the document was a picture or a
 video
 or some such - but is thre a hidden argument list to auto_prepend_file
 where I can force inclusion of this file, if x, y, and z document
 types
 were requested?

Not the way you describe it, but...

In .htaccess, put:

Files .xyz
  ForceType application/x-httpd-php
/Files


Now all your .xyz files ARE PHP files.

auto_prepend will happen.

PHP will parse the files but do nothing unless they happen to
contain the character combination ?php  (or ? or ?= if you have
short_tags on)

This may or may not be suitable in your environment.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Forcing auto_prepend_file to work regardless of what document was accessed

2005-10-22 Thread Dan Trainor

Richard Lynch wrote:

On Sat, October 22, 2005 11:25 pm, Dan Trainor wrote:


Anyone know if it's possible to use auto_prepend_file to force the
appending of a file to the request, regardless of what kind of
document
is generated?

I can see this being a problem if the document was a picture or a
video
or some such - but is thre a hidden argument list to auto_prepend_file
where I can force inclusion of this file, if x, y, and z document
types
were requested?



Not the way you describe it, but...

In .htaccess, put:

Files .xyz
  ForceType application/x-httpd-php
/Files


Now all your .xyz files ARE PHP files.

auto_prepend will happen.

PHP will parse the files but do nothing unless they happen to
contain the character combination ?php  (or ? or ?= if you have
short_tags on)

This may or may not be suitable in your environment.



This would be a great solution, and I'm sure my concern is something 
that's been discussed many times on this list - I'm worried about the 
performance hit that the machine would take, if/when parsing a large 
number of files, in this manner.


For small sites, I have no problem adding .html, .htm and friends to 
PHP's own AddType.  But I'm not so sure for larger sites.


I'll browse the archive for info and data, and weigh my options.

Thanks
-dant

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php