473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP performamce

Hi,

I'm new to PHP, but I'm loving its use so far. I have two pretty
boring questions I can't seem to find the answer to:

I have a template-driven site which uses PHP to drop in menu,
content, etc. Most of the content is pure HTML, but there are
a couple of special cases. To simplify my code, I'd like to
change the extensions for all of my files from .html to .php.
My question is this: will doing this slow my site down? Because
then these files must be run through the PHP parser, even though
there's nothing to parse.

My second question is also pretty easy: when I do a require(), does
that essentially copy and paste the require()'d file into the file
which require()'d it? Basically, will I lose performance if I
require() a .php file versus a .html file, assuming they are both
pure HTML content?

Thanks in advance,
Sanford Armstrong
Jul 17 '05 #1
5 2176
if you are serious about performance, don't parse a file that doesnt have to
be. ie: pure html

if you are looking for noticable speed differences on a small site with
little traffic, you probably won't see a differnce

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Sanford Armstrong" <sa**************@email.com> wrote in message
news:TYcTb.15068$QJ3.13526@fed1read04...
Hi,

I'm new to PHP, but I'm loving its use so far. I have two pretty
boring questions I can't seem to find the answer to:

I have a template-driven site which uses PHP to drop in menu,
content, etc. Most of the content is pure HTML, but there are
a couple of special cases. To simplify my code, I'd like to
change the extensions for all of my files from .html to .php.
My question is this: will doing this slow my site down? Because
then these files must be run through the PHP parser, even though
there's nothing to parse.

My second question is also pretty easy: when I do a require(), does
that essentially copy and paste the require()'d file into the file
which require()'d it? Basically, will I lose performance if I
require() a .php file versus a .html file, assuming they are both
pure HTML content?

Thanks in advance,
Sanford Armstrong

Jul 17 '05 #2
Yeah, it's a pretty small site for a local non-profit. We're talking
files that average 5KB-10KB. I just don't want to slow the site down or
put unnecessary strain on the server. I guess I'll just have to test it
out and see if there's any noticable difference. Thanks!

-Sanford

CountScubula wrote:
if you are serious about performance, don't parse a file that doesnt have to
be. ie: pure html

if you are looking for noticable speed differences on a small site with
little traffic, you probably won't see a differnce

<snip sig>
"Sanford Armstrong" <sa**************@email.com> wrote in message
news:TYcTb.15068$QJ3.13526@fed1read04...
Hi,

I'm new to PHP, but I'm loving its use so far. I have two pretty
boring questions I can't seem to find the answer to:

I have a template-driven site which uses PHP to drop in menu,
content, etc. Most of the content is pure HTML, but there are
a couple of special cases. To simplify my code, I'd like to
change the extensions for all of my files from .html to .php.
My question is this: will doing this slow my site down? Because
then these files must be run through the PHP parser, even though
there's nothing to parse.

My second question is also pretty easy: when I do a require(), does
that essentially copy and paste the require()'d file into the file
which require()'d it? Basically, will I lose performance if I
require() a .php file versus a .html file, assuming they are both
pure HTML content?


Jul 17 '05 #3
If PHP is set up to run as a module, then no, it wouldn't slow the site
down, as PHP can parse the file far faster can the Internet can transfer the
data. If you're running PHP as CGI, then yes, your site would slow down,
especially if the OS is Windows.

Requiring a file is almost the same as copy-and-pasting the text into the
script (the difference is in error reporting). If the file being included is
plain HTML, you should use readfile() instead of require(), for the sake of
semantic clarity. A declaration that the script requires something shouldn't
cause something to occur (i.e. text output).

Uzytkownik "Sanford Armstrong" <sa**************@email.com> napisal w
wiadomosci news:TYcTb.15068$QJ3.13526@fed1read04...
Hi,

I'm new to PHP, but I'm loving its use so far. I have two pretty
boring questions I can't seem to find the answer to:

I have a template-driven site which uses PHP to drop in menu,
content, etc. Most of the content is pure HTML, but there are
a couple of special cases. To simplify my code, I'd like to
change the extensions for all of my files from .html to .php.
My question is this: will doing this slow my site down? Because
then these files must be run through the PHP parser, even though
there's nothing to parse.

My second question is also pretty easy: when I do a require(), does
that essentially copy and paste the require()'d file into the file
which require()'d it? Basically, will I lose performance if I
require() a .php file versus a .html file, assuming they are both
pure HTML content?

Thanks in advance,
Sanford Armstrong

Jul 17 '05 #4
The server is running Apache with pbp_mod, so I think I'm good. Thanks
for the info!

On a related note, would that mean that some PHP in a require()'d file
can call a function declared in the require()ing file? I already see
that variables in the require()ing file are available to the require()'d
file.

I'll read up on readfile(), thanks for the heads-up.

Chung Leong wrote:
If PHP is set up to run as a module, then no, it wouldn't slow the site
down, as PHP can parse the file far faster can the Internet can transfer the
data. If you're running PHP as CGI, then yes, your site would slow down,
especially if the OS is Windows.

Requiring a file is almost the same as copy-and-pasting the text into the
script (the difference is in error reporting). If the file being included is
plain HTML, you should use readfile() instead of require(), for the sake of
semantic clarity. A declaration that the script requires something shouldn't
cause something to occur (i.e. text output).

Uzytkownik "Sanford Armstrong" <sa**************@email.com> napisal w
wiadomosci news:TYcTb.15068$QJ3.13526@fed1read04...
Hi,

I'm new to PHP, but I'm loving its use so far. I have two pretty
boring questions I can't seem to find the answer to:

I have a template-driven site which uses PHP to drop in menu,
content, etc. Most of the content is pure HTML, but there are
a couple of special cases. To simplify my code, I'd like to
change the extensions for all of my files from .html to .php.
My question is this: will doing this slow my site down? Because
then these files must be run through the PHP parser, even though
there's nothing to parse.

My second question is also pretty easy: when I do a require(), does
that essentially copy and paste the require()'d file into the file
which require()'d it? Basically, will I lose performance if I
require() a .php file versus a .html file, assuming they are both
pure HTML content?

Thanks in advance,
Sanford Armstrong


Jul 17 '05 #5
[Top-post fixed. Don't top-post!.
<http://www.wikipedia.org/wiki/Top-posting> ]
"Chung Leong" <ch***********@hotmail.com> wrote in message news:<kN********************@comcast.com>...

Uzytkownik "Sanford Armstrong" <sa**************@email.com> napisal w
wiadomosci news:TYcTb.15068$QJ3.13526@fed1read04...
Hi,

I'm new to PHP, but I'm loving its use so far. I have two pretty
boring questions I can't seem to find the answer to:

I have a template-driven site which uses PHP to drop in menu,
content, etc. Most of the content is pure HTML, but there are
a couple of special cases. To simplify my code, I'd like to
change the extensions for all of my files from .html to .php.
My question is this: will doing this slow my site down? Because
then these files must be run through the PHP parser, even though
there's nothing to parse.

My second question is also pretty easy: when I do a require(), does
that essentially copy and paste the require()'d file into the file
which require()'d it? Basically, will I lose performance if I
require() a .php file versus a .html file, assuming they are both
pure HTML content?
If PHP is set up to run as a module, then no, it wouldn't slow the site
down, as PHP can parse the file far faster can the Internet can transfer the
data. If you're running PHP as CGI, then yes, your site would slow down,
especially if the OS is Windows.

Requiring a file is almost the same as copy-and-pasting the text into the
script (the difference is in error reporting).
<http://public.yahoo.com/~radwin/talks/one-year-of-php-oscon2003_files/slide0081.htm>
[Alert: Stop the page before it redirects to parent page]
If the file being included is
plain HTML, you should use readfile() instead of require(), for the sake of
semantic clarity. A declaration that the script requires something shouldn't
cause something to occur (i.e. text output).


--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: thegame21 | last post by:
Hi, I am currently creating a cinema system using access where a booking can be made for a event. Each event when it is shown is categoriesd as a performance. A booking must be made for each...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.