470,849 Members | 697 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

PHP speed vs HTML

Jan
I need to make form on our front page. If using PHP, I suppose the full
page must be PHP though I need none of the PHP features until the
submit button is pressed.

Only 3% of the users press the submit button of the form, remaining
users do not use the form and have no benefit of PHP features.

I also need a cookie to store the referrer, if using perl for the form
submit, then javascript is the only alternative for cookie creation I
suppose.

With heavy traffic the page might become slower with PHP than if using
HTML plus a cgi-bin perl?

Mar 1 '06 #1
9 2799
Jan wrote:
I need to make form on our front page. If using PHP, I suppose the full
page must be PHP though I need none of the PHP features until the
submit button is pressed.

Only 3% of the users press the submit button of the form, remaining
users do not use the form and have no benefit of PHP features.

I also need a cookie to store the referrer, if using perl for the form
submit, then javascript is the only alternative for cookie creation I
suppose.

With heavy traffic the page might become slower with PHP than if using
HTML plus a cgi-bin perl?


No, the whole page doesn't need to be PHP. PHP integrates with HTML
quite well.

But if they don't need PHP until they press the submit button, chances
are the page your going *to* needs the PHP - not this one.

BTW - PHP can also work with cookies.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 1 '06 #2
Jerry Stuckle wrote:
Jan wrote:

With heavy traffic the page might become slower with PHP than if using
HTML plus a cgi-bin perl?


No, the whole page doesn't need to be PHP. PHP integrates with HTML
quite well.


However, there is a small performance hit at the server end when the PHP
interpreter is initiated to parse the file... Therefore, HTML will
server faster by default. (Though you may never notice the difference
without some heavy benchmarking.)

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Mar 1 '06 #3
Jan
We expect about 570 new visitors every minute on our web page, 17 of
these will press the submit button to invoke the PHP.

Would you expect the performance hit to noticeable at this volume, this
we should consider a cgi-bin perl instead of PHP. Perl is never invoked
unless submit is pressed.

We would also like to store the referrer in a cookie when someone
enters the page, this could be done with PHP. Maybe javascript is
quicker?

Mar 1 '06 #4
kay
u r expecting 400.000 visits a day? huh, nice

u do it this way:

homepage is your index.html with this code in the form tag

<form action="form.php" method="post">
FORM
</form>

so the home page IS NOT php.
only the site that visitors see after clicking submit button will have
php.

so there's no way u will see any performance loss.

Mar 1 '06 #5
Jan wrote:
We expect about 570 new visitors every minute on our web page, 17 of
these will press the submit button to invoke the PHP.

Would you expect the performance hit to noticeable at this volume, this
we should consider a cgi-bin perl instead of PHP. Perl is never invoked
unless submit is pressed.

We would also like to store the referrer in a cookie when someone
enters the page, this could be done with PHP. Maybe javascript is
quicker?


570 visitors a minute isn't a whole lot for a fast server. You won't
see much impact by loading PHP. Of course, if you have a slow server,
you'll see the impact - but there are many other things which will cause
a bigger impact.

BTW - Perl and PHP are both server-side languages and do much the same
thing. You can design the PHP pages just like the Perl ones - and each
parser will be invoked for its respective web page.

As for the referrer - you would have to do that on the incoming page,
which means PHP or Perl on the server side, or Javascript on the client
side.

However, this is VERY unreliable. The user may have disabled
javascript, for instance. And even if they did, or you use PHP or Perl,
HTTP_REFERER is not dependable. The browser may or may not send it, and
even if they send it, a firewall may block it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 1 '06 #6
Le Wed, 01 Mar 2006 21:48:03 +0100, Jan <ja*********@hotmail.com> a écrit:
We expect about 570 new visitors every minute on our web page, 17 of
these will press the submit button to invoke the PHP.

Would you expect the performance hit to noticeable at this volume, this
we should consider a cgi-bin perl instead of PHP. Perl is never invoked
unless submit is pressed.

We would also like to store the referrer in a cookie when someone
enters the page, this could be done with PHP. Maybe javascript is
quicker?


If you plan building a site with 400000 hits per day, may I suggest you to
start reading some documentation about the underlying principles and
architecture of web programming. Just to know how PHP, Javascript, cookies
and, why not, cgi/perl, work in this kind of environment.

Just to answer your question about perl : it won't be faster with perl
than with PHP.

And, for your information, NEVER ask a PHP programmer if it wouldn't be
faster to use a Perl script ;-)

François
Mar 1 '06 #7
Jan wrote:
I need to make form on our front page. If using PHP, I suppose the full
page must be PHP though I need none of the PHP features until the
submit button is pressed.

Only 3% of the users press the submit button of the form, remaining
users do not use the form and have no benefit of PHP features.

I also need a cookie to store the referrer, if using perl for the form
submit, then javascript is the only alternative for cookie creation I
suppose.

With heavy traffic the page might become slower with PHP than if using
HTML plus a cgi-bin perl?


Very unlikely, unless the script performs some sort of database
operation. PHP can generate data far faster than the Internet can carry
it. Most of the time PHP will just be waiting.

Mar 2 '06 #8
Jan
If I understand correctly, this means that the PHP parser is not loaded
until submit is pressed by the users, given that the cookie part is
done with javascript. Thus we may have a speedy and static HTML form
page where PHP is not invoked until form is submitted. I suppose method
can be submit just as well as post in the example above?

In this scenario I may try out PHP for cookies, and if it's slowing
down the site, try out javascript.

Mar 2 '06 #9
On Wed, 01 Mar 2006 11:21:40 -0800, Jan wrote:
I need to make form on our front page. If using PHP, I suppose the full
page must be PHP though I need none of the PHP features until the
submit button is pressed.

Only 3% of the users press the submit button of the form, remaining
users do not use the form and have no benefit of PHP features.

I also need a cookie to store the referrer, if using perl for the form
submit, then javascript is the only alternative for cookie creation I
suppose.

With heavy traffic the page might become slower with PHP than if using
HTML plus a cgi-bin perl?


Architecturally, PHP can not be slower as PHP interpreter is usually
a part of the httpd process while to call CGI one has to create a new
proces. You're avoiding context switches, process creation/manipulation,
signal dispatch and all those beautiful things. In addition to that, perl
is more complex, due to its more complex syntax. PHP is much simpler,
which means that the interpreter is much smaller.

--
http://www.mgogala.com

Mar 4 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Jordanakins | last post: by
1 post views Thread by | last post: by
6 posts views Thread by J. Campbell | last post: by
4 posts views Thread by Lost Bits | last post: by
4 posts views Thread by D. Alvarado | last post: by
18 posts views Thread by Jeff Boes | last post: by
6 posts views Thread by Jazper Manto | last post: by
3 posts views Thread by Mike Kelly | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.