Re: [PHP] Php files with .html extension?

2004-10-25 Thread Greg Donald
On Mon, 25 Oct 2004 16:37:52 +0300, Phpu [EMAIL PROTECTED] wrote:
 How can i do a php script with a html extensionsuch as
 http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html

If you use Apache you can edit you httpd.conf and add:

AddType application/x-httpd-php .html


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread Brian V Bonini
On Mon, 2004-10-25 at 09:37, Phpu wrote:
 Hi,
 
 How can i do a php script with a html extensionsuch as 
 http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html
 

AddType application/x-httpd-php .php .php3 .html

-- 

s/:-[(/]/:-)/g


BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org
aGEhIGJldCB5b3UgdGhpbmsgeW91IHByZXR0eSBzbGljayBmb3IgZmlndXJpbmcgb3V0I
GhvdyB0byBkZWNvZGUgdGhpcy4gVG9vIGJhZCBpdCBoYXMgbm8gc2VjcmV0IGluZm8gaW
4gaXQgaGV5Pwo=

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



RE: [PHP] Php files with .html extension?

2004-10-25 Thread Jay Blanchard
[snip]
How can i do a php script with a html extensionsuch as
http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html
[/snip]

You set it up in your httpd.conf You should have

AddType application/x-httpd-php .php

change it to 

AddType application/x-httpd-php .php .html

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread Matt M.
 How can i do a php script with a html extensionsuch as 
 http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html
 

apache could do this a couple ways

http://httpd.apache.org/docs/mod/mod_mime.html#addhandler
http://httpd.apache.org/docs-2.0/mod/core.html#setinputfilter
http://httpd.apache.org/docs-2.0/mod/core.html#setoutputfilter

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



RE: [PHP] Php files with .html extension?

2004-10-25 Thread Graham Cossey
Do not forget that if you do this ALL files with the .html extension will be
parsed by PHP whether they are PHP scripts or not which could be something
you need to consider from a performance perspective.

 -Original Message-
 From: Jay Blanchard [mailto:[EMAIL PROTECTED]
 Sent: 25 October 2004 14:59
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Php files with .html extension?


 [snip]
 How can i do a php script with a html extensionsuch as
 http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html
 [/snip]

 You set it up in your httpd.conf You should have

 AddType application/x-httpd-php .php

 change it to

 AddType application/x-httpd-php .php .html

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



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



RE: [PHP] Php files with .html extension?

2004-10-25 Thread Gryffyn, Trevor
That's definitely a good point.  I'm curious though, would it really be
a significant performance issue?  Even if a lot of HTML files are being
processed by PHP?  I mean, if the PHP parser goes through and never sees
a ? Or ?php, does it do any more than just output the file?   True,
that's something, but is it anything really significant.

The only thing I can think of that'd be an issue is, what happens if you
have a bad compile of PHP, or what happens to a system after PHP is run
180,000 times?  Small programming issues can create minute instability
issues for systems.  Or in the case of outright memory leaks, sometimes
a major issue.

That's the only thing that'd really concern me, but it's still
definitely a good question to ask.

-TG

 -Original Message-
 From: Graham Cossey [mailto:[EMAIL PROTECTED] 
 Sent: Monday, October 25, 2004 11:30 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Php files with .html extension?
 
 
 Do not forget that if you do this ALL files with the .html 
 extension will be
 parsed by PHP whether they are PHP scripts or not which could 
 be something
 you need to consider from a performance perspective.
 
  -Original Message-
  From: Jay Blanchard [mailto:[EMAIL PROTECTED]
  Sent: 25 October 2004 14:59
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] Php files with .html extension?
 
 
  [snip]
  How can i do a php script with a html extensionsuch as
  http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html
  [/snip]
 
  You set it up in your httpd.conf You should have
 
  AddType application/x-httpd-php .php
 
  change it to
 
  AddType application/x-httpd-php .php .html
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread Greg Donald
On Mon, 25 Oct 2004 16:30:14 +0100, Graham Cossey
[EMAIL PROTECTED] wrote:
 Do not forget that if you do this ALL files with the .html extension will be
 parsed by PHP whether they are PHP scripts or not which could be something
 you need to consider from a performance perspective.


I setup a simple benchmark test because I was curious how much
overhead parsing .html files as PHP files actually caused.  Here are
those results:


Server specs:

Debain Sarge (testing)
 uname -a
Linux netpc0378 2.6.7-1-686 #1 Thu Jul 8 05:36:53 EDT 2004 i686 GNU/Linux

 php4 -v
PHP 4.3.4 (cli) (built: Mar 27 2004 08:04:22)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

 apache -v
Server version: Apache/1.3.31 (Debian GNU/Linux)
Server built:   Sep  9 2004 07:31:19

 cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 8
model name  : Celeron (Coppermine)
stepping: 10
cpu MHz : 997.253
cache size  : 128 KB
fdiv_bug: no
hlt_bug : no
f00f_bug: no
coma_bug: no
fpu : yes
fpu_exception   : yes
cpuid level : 2
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 mmx fxsr sse
bogomips: 1978.36

 free -m
 total   used   free sharedbuffers cached
Mem:   249189 59  0  1 54
-/+ buffers/cache:134115
Swap:  486 29456


The index.html test file is very simple:

html
head
titleBenchmark Test/title
/head
body bgcolor=white
Benchmark Me!
/body
/html


Then the actual tests:


1) Apache not parsing .html files as PHP:

 ab -n1 http://localhost/benchmark/
This is ApacheBench, Version 1.3d $Revision: 1.73 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 1 requests
Server Software:Apache/1.3.31
Server Hostname:localhost
Server Port:80

Document Path:  /benchmark/
Document Length:270 bytes

Concurrency Level:  1
Time taken for tests:   27.134 seconds
Complete requests:  1
Failed requests:0
Broken pipe errors: 0
Non-2xx responses:  1
Total transferred:  449 bytes
HTML transferred:   270 bytes
Requests per second:368.54 [#/sec] (mean)
Time per request:   2.71 [ms] (mean)
Time per request:   2.71 [ms] (mean, across all concurrent requests)
Transfer rate:  165.48 [Kbytes/sec] received

Connnection Times (ms)
  min  mean[+/-sd] median   max
Connect:0 00.0  0 2
Processing: 1 2   19.8  1   810
Waiting:0 2   19.8  1   810
Total:  1 2   19.8  1   810

Percentage of the requests served within a certain time (ms)
  50%  1
  66%  1
  75%  1
  80%  1
  90%  2
  95%  3
  98%  3
  99% 14
 100%810 (last request)


2) Apache parsing .html files as PHP:

(I edited /etc/apache/mime.types and added html to the
application/x-httpd-php line, and then I restarted Apache.)

 ab -n1 http://localhost/benchmark/
This is ApacheBench, Version 1.3d $Revision: 1.73 $ apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 1 requests
Server Software:Apache/1.3.31
Server Hostname:localhost
Server Port:80

Document Path:  /benchmark/
Document Length:270 bytes

Concurrency Level:  1
Time taken for tests:   30.215 seconds
Complete requests:  1
Failed requests:0
Broken pipe errors: 0
Non-2xx responses:  1
Total transferred:  449 bytes
HTML transferred:   270 bytes
Requests per second:330.96 [#/sec] (mean)
Time per request:   3.02 [ms] (mean)
Time per request:   3.02 [ms] (mean, across all concurrent requests)
Transfer rate:  148.60 [Kbytes/sec] received

Connnection Times (ms)
  min  mean[+/-sd] median   max
Connect:0 00.0  0 1
Processing: 1 2   23.9  1   919
Waiting:0 2   23.9  1   918
Total:  1 2   23.9  1   919
ERROR: The median and mean for the 

Re: [PHP] Php files with .html extension?

2004-10-25 Thread Curt Zirzow
* Thus wrote Greg Donald:
 
 The summary results:
 
 For 10K local requests:
 27.1 seconds with .html not parsed as PHP
 vs.
 30.2 seconds with .html parsed as PHP.
 
 I only ran these tests locally, and only on the one server.. so it's
 definatly not very scientific.  I think we all sorta knew the results
 anyway.

Nice work! I wonder what the stats would be like with apache2 :)

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread zooming
On a related note I was wondering what people thought of php files with no
extensions?  So if I changed index.php to just index then I can create url
like www.mydomain.com/index/articleid/29 so it's search engine friendly.

# .htaccess file
DefaultType application/x-httpd-php

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread The Snake from Hell!

You would probably brake a heck of a lot of things. CGI
scripts, etc.

On a related note I was wondering what people thought of
php files with noextensions?  So if I changed index.php to
just index then I can create urllike
www.mydomain.com/index/articleid/29 so it's search engine
friendly.

# .htaccess file
DefaultType application/x-httpd-php

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread zooming
I don't use cgi scripts.

- Original Message - 
From: The Snake from Hell! [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 25, 2004 4:25 PM
Subject: Re: [PHP] Php files with .html extension?


 
 You would probably brake a heck of a lot of things. CGI
 scripts, etc.
 
 On a related note I was wondering what people thought of
 php files with noextensions?  So if I changed index.php to
 just index then I can create urllike
 www.mydomain.com/index/articleid/29 so it's search engine
 friendly.
 
 # .htaccess file
 DefaultType application/x-httpd-php
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] Php files with .html extension?

2004-10-25 Thread Greg Donald
On Mon, 25 Oct 2004 18:44:41 +, Curt Zirzow
[EMAIL PROTECTED] wrote:
 Nice work! I wonder what the stats would be like with apache2 :)

Suse 9.1 box:

 cat /proc/cpuinfo 
processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 6
model   : 4
model name  : AMD Athlon(tm) Processor
stepping: 2
cpu MHz : 909.168
cache size  : 256 KB
fdiv_bug: no
hlt_bug : no
f00f_bug: no
coma_bug: no
fpu : yes
fpu_exception   : yes
cpuid level : 1
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca
cmov pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow
bogomips: 1794.04

 free -m
 total   used   free sharedbuffers cached
Mem:   504497  6  0164 47
-/+ buffers/cache:285219
Swap: 1023  0   1023

 httpd -v
Server version: Apache/2.0.51
Server built:   Sep 19 2004 15:44:02

 php -v
PHP 5.0.2 (cgi) (built: Sep 24 2004 20:55:59)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.2, Copyright (c) 1998-2004 Zend Technologies


1) Apache 2 not parsing .html as PHP:

  ab -n1 http://localhost/benchmark/
This is ApacheBench, Version 2.0.41-dev $Revision: 1.121.2.12 $ apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 1 requests


Server Software:Apache/2.0.51
Server Hostname:localhost
Server Port:80

Document Path:  /benchmark/
Document Length:105 bytes

Concurrency Level:  1
Time taken for tests:   11.234968 seconds
Complete requests:  1
Failed requests:0
Write errors:   0
Total transferred:  379 bytes
HTML transferred:   105 bytes
Requests per second:890.08 [#/sec] (mean)
Time per request:   1.123 [ms] (mean)
Time per request:   1.123 [ms] (mean, across all concurrent requests)
Transfer rate:  329.42 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   0.0  0   1
Processing: 00   1.4  1 108
Waiting:00   0.8  0  70
Total:  00   1.4  1 108

Percentage of the requests served within a certain time (ms)
  50%  1
  66%  1
  75%  1
  80%  1
  90%  1
  95%  1
  98%  1
  99%  1
 100%108 (longest request)


2) Apache 2 parsing .html as PHP:

 ab -n1 http://localhost/benchmark/
This is ApacheBench, Version 2.0.41-dev $Revision: 1.121.2.12 $ apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 1 requests


Server Software:Apache/2.0.51
Server Hostname:localhost
Server Port:80

Document Path:  /benchmark/
Document Length:105 bytes

Concurrency Level:  1
Time taken for tests:   30.532746 seconds
Complete requests:  1
Failed requests:0
Write errors:   0
Total transferred:  311 bytes
HTML transferred:   105 bytes
Requests per second:327.52 [#/sec] (mean)
Time per request:   3.053 [ms] (mean)
Time per request:   3.053 [ms] (mean, across all concurrent requests)
Transfer rate:  99.47 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   0.0  0   0
Processing: 22   0.5  2   9
Waiting:02   0.4  2   9
Total:  22   0.5  2   9

Percentage of the requests served within a certain time (ms)
  50%  2
  66%  2
  75%  2
  80%  3
  90%  3
  95%  3
  98%  3
  99%  3
 100%  9 (longest request)


Summary for 10K local requests:
11.2 seconds for .html not parsed as PHP
vs.
30.5 seconds as .html parsed as PHP.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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