php-general Digest 16 Mar 2004 10:00:10 -0000 Issue 2649

Topics (messages 180493 through 180528):

Re: PHP Certification
        180493 by: Rasmus Lerdorf
        180497 by: Ryan A
        180503 by: Richard Davey

Re: Regex help (SOLVED)
        180494 by: Michal Migurski

Pear Package...
        180495 by: Scott Fletcher
        180498 by: Evan Nemerson
        180499 by: Greg Beaver
        180501 by: Scott Fletcher
        180502 by: Scott Fletcher

Re: tracking emails
        180496 by: Rob Adams
        180500 by: Ryan A
        180504 by: Rob Adams

current url function
        180505 by: Luis Mirabal
        180507 by: Marek Kilimajer
        180508 by: Luis Mirabal
        180509 by: Richard Davey

dbg extension...
        180506 by: Luis Mirabal
        180516 by: Tom Rogers

e - comerce website
        180510 by: if02005.students.del.ac.id

Re: Problem with mkdir() under windows.
        180511 by: Luis Mirabal

Re: Printing landscape
        180512 by: Luis Mirabal
        180527 by: Michael Nolan

Efficieny: Include vs Array vs Function
        180513 by: Rob Paxon
        180519 by: Raditha Dissanayake
        180520 by: Rob Paxon
        180522 by: Tom Rogers
        180524 by: Rob Paxon
        180528 by: Raditha Dissanayake

Re: windows 2003 server configuration
        180514 by: Nadim Attari

Licensing System
        180515 by: Jakes

Anyone Can Help Me?
        180517 by: Harry
        180521 by: Clifford W. Hansen

how do i detect the exsistens of a network printer?
        180518 by: Shay

Presence of a program (PHP)
        180523 by: Brent Clark
        180525 by: Jyry Kuukkanen

Re: help with storing multiple values in session variables.
        180526 by: Vimala  S.P.

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Mon, 15 Mar 2004, Sheeraz fazal wrote:
> I need information about the php certification, from www.expertrating.com .
> Does this site has good market reputation?
> Does www.php.net has some plans to introduce certification path?

No plans from us, no.  Running a certification program is a lot of work 
and I would prefer to see developers develop, not try to manage a 
certification program.

As for the www.expertrating.com thing?  Never heard of it.  If a resume 
crossed my desk with a reference to something like that on it I would 
probably chuckle and think the person got bilked out of the $9.95 it 
apparently costs.  It may of course be very good, I have no idea, I just 
don't hold certification programs in very high regard in general.

-Rasmus

--- End Message ---
--- Begin Message ---
Give a good graphics guy some $$ and he'll make you one of the best
certificates that your $$ can buy...that does not mean that you can actually
program in the language thats written on the certificate...

When I was learning computers I studied COBOL, Hated it and cant remember
crap about it now...not even 2 lines...but my (old) certificate says I'm
pretty good at it :-)

Basically it all comes down to how good you can actually prove yourself in
your field..certificates most of the time are not worth the paper they are
printed on but look good once you hang it on the wall ;-)

Just my $0.2

Cheers,
-Ryan

*****************************
HI,

I need information about the php certification, from www.expertrating.com .
Does this site has good market reputation?
Does www.php.net has some plans to introduce certification path?

Comments welcome.

Thanks,
Sheri,

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

--- End Message ---
--- Begin Message ---
Hello Sheeraz,

Monday, March 15, 2004, 4:05:42 PM, you wrote:

Sf> I need information about the php certification, from www.expertrating.com .
Sf> Does this site has good market reputation?
Sf> Does www.php.net has some plans to introduce certification path?

Unless they are internationally and industry recognised like the
Novell, Cisco, Oracle or Microsoft certificates it's probably not
worth the money (if any?) involved in obtaining it. You would be
better off spending your time working on a solid portfolio that
showcases both sites AND code that you've written. If you already have
those then I don't see how that expertrating thing can hurt, but don't
bank on it holding too much sway.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

--- End Message ---
--- Begin Message ---
>Thanks to everyone who gave me examples, links and suggested alternatives
>like explode(), but personally I thought explode too was a regex..:-(.

explode() is not, split() is.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

--- End Message ---
--- Begin Message ---
Hi!

    I saw the Pear packages that are originally stored in
/usr/local/lib/php/****.  This occur when I compile PHP.  Problem is they
are different from the ones I downloaded from the pears.php.net website.
So, I enclosed those files into the website's directory, along with all
other website files.  That way, I can use those instead of the one from
/usr/local/lib/php/****.  However, I have a problem.  When I run the web
script, PHP still use the Pear files in /usr/local/lib/php/*** instead of
the one I use along with the web files.  I tried the include and require
function but no luck.

   Why is that?  What workaround do I need on this?

FletchSOD

--- End Message ---
--- Begin Message ---
On Monday 15 March 2004 02:15 pm, Scott Fletcher wrote:
> Hi!

hi
>
>     I saw the Pear packages that are originally stored in
> /usr/local/lib/php/****.  This occur when I compile PHP.  Problem is they
> are different from the ones I downloaded from the pears.php.net website.
> So, I enclosed those files into the website's directory, along with all
> other website files.  That way, I can use those instead of the one from
> /usr/local/lib/php/****.  However, I have a problem.  When I run the web
> script, PHP still use the Pear files in /usr/local/lib/php/*** instead of

what does ini_get('include_path') return? Try doing ini_set('include_path', 
'.:/usr/local/lib/php')

php is probably searching for includes in /usr/local/lib/php first. Also, 
consider reinstalling what you've download from pear using pear's cli; `pear 
install DB`, for example

> the one I use along with the web files.  I tried the include and require
> function but no luck.
>
>    Why is that?  What workaround do I need on this?
>
> FletchSOD

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

--
"...the whole idea of revenge and punishment is a childish daydream. Properly 
speaking, there is no such thing as revenge. Revenge is an act which you want 
to commit when you are powerless and because you are powerless: as soon as 
the sense of impotence is removed, the desire evaporates also. "

-George Orwell

--- End Message ---
--- Begin Message --- Hi Scott,

What you need is to set the include_path

http://www.php.net/manual/en/configuration.directives.php#ini.include-path

Greg
--
phpDocumentor
http://www.phpdoc.org

Scott Fletcher wrote:
Hi!

    I saw the Pear packages that are originally stored in
/usr/local/lib/php/****.  This occur when I compile PHP.  Problem is they
are different from the ones I downloaded from the pears.php.net website.
So, I enclosed those files into the website's directory, along with all
other website files.  That way, I can use those instead of the one from
/usr/local/lib/php/****.  However, I have a problem.  When I run the web
script, PHP still use the Pear files in /usr/local/lib/php/*** instead of
the one I use along with the web files.  I tried the include and require
function but no luck.

Why is that? What workaround do I need on this?

FletchSOD

--- End Message ---
--- Begin Message ---
Aw!  Never knew what the php's include_path is for...  So, that fixed the
problem by just setting it to the website directory.

Thanks,
 FletchSOD

"Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Monday 15 March 2004 02:15 pm, Scott Fletcher wrote:
> > Hi!
>
> hi
> >
> >     I saw the Pear packages that are originally stored in
> > /usr/local/lib/php/****.  This occur when I compile PHP.  Problem is
they
> > are different from the ones I downloaded from the pears.php.net website.
> > So, I enclosed those files into the website's directory, along with all
> > other website files.  That way, I can use those instead of the one from
> > /usr/local/lib/php/****.  However, I have a problem.  When I run the web
> > script, PHP still use the Pear files in /usr/local/lib/php/*** instead
of
>
> what does ini_get('include_path') return? Try doing
ini_set('include_path',
> '.:/usr/local/lib/php')
>
> php is probably searching for includes in /usr/local/lib/php first. Also,
> consider reinstalling what you've download from pear using pear's cli;
`pear
> install DB`, for example
>
> > the one I use along with the web files.  I tried the include and require
> > function but no luck.
> >
> >    Why is that?  What workaround do I need on this?
> >
> > FletchSOD
>
> -- 
> Evan Nemerson
> [EMAIL PROTECTED]
> http://coeusgroup.com/en
>
> --
> "...the whole idea of revenge and punishment is a childish daydream.
Properly
> speaking, there is no such thing as revenge. Revenge is an act which you
want
> to commit when you are powerless and because you are powerless: as soon as
> the sense of impotence is removed, the desire evaporates also. "
>
> -George Orwell

--- End Message ---
--- Begin Message ---
Aw!  Never knew what the php's include_path is for when I saw it in the
php.ini some times ago...  So, that fixed the problem by just setting it to
the website directory.

Thanks,
 FletchSOD
"Greg Beaver" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Scott,
>
> What you need is to set the include_path
>
> http://www.php.net/manual/en/configuration.directives.php#ini.include-path
>
> Greg
> --
> phpDocumentor
> http://www.phpdoc.org
>
> Scott Fletcher wrote:
> > Hi!
> >
> >     I saw the Pear packages that are originally stored in
> > /usr/local/lib/php/****.  This occur when I compile PHP.  Problem is
they
> > are different from the ones I downloaded from the pears.php.net website.
> > So, I enclosed those files into the website's directory, along with all
> > other website files.  That way, I can use those instead of the one from
> > /usr/local/lib/php/****.  However, I have a problem.  When I run the web
> > script, PHP still use the Pear files in /usr/local/lib/php/*** instead
of
> > the one I use along with the web files.  I tried the include and require
> > function but no luck.
> >
> >    Why is that?  What workaround do I need on this?
> >
> > FletchSOD

--- End Message ---
--- Begin Message ---
"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> Problem: After sending the newsletter try to "see" how many people have
> actually opened the email.
> Send as html and call a script via a <img> tag passing the member id
> (Problem: html messages is usually off)

HTML is the only method I've ever used.  If it's off, I don't think you'll
find a solution.  For those that have it on, at least you'll "see" them.

Another trick that might help, if you're mail server can handle it, is to
have a reply-to address like this:

bounces-<id>@domain.com

Some mail servers can be configured to ignore the '-' and everything after
it, letting you receive all your bounces at one address, but knowing by the
'To' field which member it is coming from.  I know this doesn't address your
problem of being able to see who actually reads the message, but it will
help you know who isn't even getting the message to begin with.

>
> Thanks,
> -Ryan A

  -- Rob

--- End Message ---
--- Begin Message ---
On 3/15/2004 11:19:13 PM, Rob Adams ([EMAIL PROTECTED]) wrote:
> "Ryan A" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi,
> > Problem: After sending the newsletter try to "see" how many people have
> > actually opened the email.
> > Send as html and call a script via a <img> tag passing the member id
> > (Problem: html messages is usually off)
>
> HTML is the only method I've ever used.  If it's off, I
> don't think you'll
> find a solution.  For those that have it on, at least
> you'll "see" them.
>
> Another trick that might help, if you're mail server
> can handle it, is to
> have a reply-to address like this:
>
> bounces-<id>@domain.com
>
> Some mail servers can be configured to ignore the '-' and everything
> after
> it, letting you receive all your bounces at one address, but knowing
> by the
> 'To' field which member it is coming from.  I know this
> doesn't address your
> problem of being able to see who actually reads the message, but it will
> help you know who isn't
> even getting the message to begin with.

Hey Rob,
Thanks for replying.

Yep, am going with html but am having a few problems....yahoo and hotmail
totally screw up the email and I dont get any confirmation :-(, after going
into view-> source I see that the IMG src address is being over written by
them..

Codes pretty simple (but works) you can compare it to your code if you need
to.
//PHP file
$connected=mysql_connect("$hostt", "$userr", "$passs") or die ('I cannot
connect to the database because: ' . mysql_error());
mysql_select_db ("$db");

$query = "insert into read_member values('$mem')";
$result = mysql_query($query);
if(!$result){  echo 'Info not inserted.'. mysql_error();exit;}

$mimetype="image/gif"; // Mime type of file

Header("Content-type: ");
readfile ($filename);

and in the HTML mail:
test <img
src="http://domain/testing/test_pass_image.php?mem=Ryan1&filename=dot.gif";>

--- End Message ---
--- Begin Message ---
"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Yep, am going with html but am having a few problems....yahoo and hotmail
> totally screw up the email and I dont get any confirmation :-(, after
going
> into view-> source I see that the IMG src address is being over written by
> them..

Ok - one thing to try...

I've noticed when sending HTML emails from my client, it defaults to sending
the pictures with the email.  This makes it so that the picture links to the
email, instead of to your webserver.  I unchecked that option in my own
client and sent an email to my hotmail account.  I checked the source and it
was unmodified.

If you can try the same thing, let me know.  If it still doesn't work, there
may be another method you can try, ie:
http://domain.com/pics/<id>/blank.gif
This might fool hotmail.  You'd have to create a php file named pics and
configure your web server to run it as php, or just name it pics.php.

  -- Rob

--- End Message ---
--- Begin Message ---
hey! i am working in an open source development, and have done a function
that gives me the current url, but i need it to work always, everywhere, in
every server with all browsers, could you tell me if you think it will or if
you have any suggestions? here is the code:

  /*
    Returns the current URL
    TODO: The function can not manage nor return user and pass in the URL if
present because it seems that you can not fetch them from PHP (or at least I
dont't know how to do it :P)
    LIMITATIONS: fragment (after # sign) can not be fetched since it is a
client-side feature
  */
  function url($host=true, $querystring=true) {
    $url = '';
    if($host) {
      if ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ||
(!empty($_ENV['HTTPS']) && $_ENV['HTTPS']=='on') ) $url = 'https://'; else
$url = 'http://';
      $url .= !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] :
$_SERVER['SERVER_NAME'];
      //if((int)$_SERVER['SERVER_PORT']!=80) $url .= ':' .
$_SERVER['SERVER_PORT'];
    }
    //$url .= $_SERVER['SCRIPT_NAME'];
    //if($querystring && !empty($_SERVER['QUERY_STRING'])) $url .= '?' .
$_SERVER['QUERY_STRING'];
    if($querystring) $url .= $_SERVER['REQUEST_URI']; else $url .=
$_SERVER['PHP_SELF'];
    return $url;
  }



thanx in advance!
luis.

--- End Message ---
--- Begin Message --- Luis Mirabal wrote:
hey! i am working in an open source development, and have done a function
that gives me the current url, but i need it to work always, everywhere, in
every server with all browsers, could you tell me if you think it will or if
you have any suggestions? here is the code:

  /*
    Returns the current URL
    TODO: The function can not manage nor return user and pass in the URL if
present because it seems that you can not fetch them from PHP (or at least I
dont't know how to do it :P)

False, check http://sk2.php.net/manual/en/features.http-auth.php


    LIMITATIONS: fragment (after # sign) can not be fetched since it is a
client-side feature

True


*/

--- End Message ---
--- Begin Message ---
i checked http://sk2.php.net/manual/en/features.http-auth.php, but it doesnt
shows how to see if i passed user:pass in the url. i try
http://user:[EMAIL PROTECTED]/ and dumped globals, and there is nothing... any
ideas?

"Marek Kilimajer" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Luis Mirabal wrote:
> > hey! i am working in an open source development, and have done a
function
> > that gives me the current url, but i need it to work always, everywhere,
in
> > every server with all browsers, could you tell me if you think it will
or if
> > you have any suggestions? here is the code:
> >
> >   /*
> >     Returns the current URL
> >     TODO: The function can not manage nor return user and pass in the
URL if
> > present because it seems that you can not fetch them from PHP (or at
least I
> > dont't know how to do it :P)
>
> False, check http://sk2.php.net/manual/en/features.http-auth.php
>
> >     LIMITATIONS: fragment (after # sign) can not be fetched since it is
a
> > client-side feature
>
> True
>
> >   */

--- End Message ---
--- Begin Message ---
Hello Luis,

Tuesday, March 16, 2004, 1:41:49 AM, you wrote:

LM> i checked
LM> http://sk2.php.net/manual/en/features.http-auth.php, but it doesnt
LM> shows how to see if i passed user:pass in the url. i try
LM> http://user:[EMAIL PROTECTED]/ and dumped globals, and there is nothing... any
LM> ideas?

If you are running PHP as an Apache module (and not CGI) then a
correctly validated user will have their details in:

$_SERVER['PHP_AUTH_USER']
and
$_SERVER['PHP_AUTH_PW']

There is a whole chapter on this (16) in the manual.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

--- End Message ---
--- Begin Message ---
hey guys, i have a question on dbg extension, i want to get debug details
using the functions from php, ie. dbg_get_profiler_results, but they return
nothing... i am developing on windows using apache and php 4.3, any
suggestions?

--- End Message ---
--- Begin Message ---
Hi,

Tuesday, March 16, 2004, 9:51:46 AM, you wrote:
LM> hey guys, i have a question on dbg extension, i want to get debug details
LM> using the functions from php, ie. dbg_get_profiler_results, but they return
LM> nothing... i am developing on windows using apache and php 4.3, any
LM> suggestions?


You probably have to trigger the debugger by doing something like
this:

http://domain.com/test.php?DBGSESSID=123456

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hai..
I have a homework from my scholl. We must make a simple website of e - comerce 
use php. I just still confuse to use the session in this work. And I must make 
a different page for a administrator that have a full access and a just user. 
But I still don't know how to make it. There is an order and a checkout if we 
want to leave the website. 
Please help me, I just have time 1 week to finish it. 

Warm regards:
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
mmmh... i think your problem isn't in mkdir, it is in evil MAGIC QUOTES!
(they are on by default)

if you are getting the name of the directory from GET, POST or COOKIE, check
the get_magic_quotes_gpc(), else check  get_magic_quotes_runtime(), if the
problem is in  get_magic_quotes_runtime(), you can do
set_magic_quotes_runtime(0) beforegetting the directory name, so it won't be
quoted, but if the problem is in  get_magic_quotes_gpc(), you will have to
do something like:

if(get_magic_quotes_gpc()) stripslashes($dirname);

luis.

"Brian J. Celenza" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> I'm having a problem using the mkdir() function under windows when the
> directory containts a special character. For instance, the directory
> "Someone's Files", a forward slash is added before the 's and the
directory
> returns an error. Is there a way around this?
>
> Thank you
> Brian

--- End Message ---
--- Begin Message ---
actually, you can control your printer, look:

http://www.php.net/manual/en/function.printer-set-option.php
you have to do:

$handle = printer_open();
printer_set_option ($handle,  PRINTER_ORIENTATION ,
PRINTER_ORIENTATION_LANDSCAPE);
printer_close($handle);

you've got many interesting options with this function.

( These functions are only available under Windows 9.x, ME, NT4 and 2000.
They have been added in PHP 4.0.4.)

and you can do something about the phase of the moon too, look here :P

http://www.phpclasses.org/browse/package/1201.html?download=targz

Cheers,
Luis.

--- End Message ---
--- Begin Message --- Luis Mirabal wrote:
actually, you can control your printer, look:

http://www.php.net/manual/en/function.printer-set-option.php
you have to do:

$handle = printer_open();
printer_set_option ($handle,  PRINTER_ORIENTATION ,
PRINTER_ORIENTATION_LANDSCAPE);
printer_close($handle);

you've got many interesting options with this function.

( These functions are only available under Windows 9.x, ME, NT4 and 2000.
They have been added in PHP 4.0.4.)


As one of the comments rightly says: "Should be pretty obvious, but in case there is any confusion... The printer in question is one that is connected to the _server_, not the _client_."


Mike
--- End Message ---
--- Begin Message --- Pardon me if this subject has been discussed, but a search of the archive didn't bring up much of anything.

Bear with me while I dish out some details. My question concerns the efficiency of using multiple file includes versus storing segments of data in one include as arrays or functions.

While rebuilding the core of my web site network and, after reading some negative things about file includes, I was forced to rethink how I am structuring things.

Here are some details:
*One domain serving, with around 5 sites as subdomains currently and more soon to come.
*Each script on every site includes a global file that has sessions stuff and network-wide functions.
*Each script includes a header.php file for the specific site's layout.
*Each script includes a footer.php for ditto.
*I am currently on a virtual server, but obviously will need to move on to a dedicated very shortly.


It is my understanding, as disk reads are so slow, that it is not a good idea to include multiple files. I always knew this, but I never really thought about it.

While thinking of how to optimize it, I considered merging header.php and the global file as one. However, I then realized some scripts access the database before including the header as to dynamically change meta tags (say, for Articles). I could use output buffering but, well, I'm not going to.

So I was thinking of making one include file that contained the following:
The former "global" contents (which I'd have to use a batch file to manage this section of the file for all sites at once, no big deal), "header.php" as a function, and the same for "footer.php".


My main question is, will this, with any certainty, be more considerably more efficient than simply including three files? Would it be more efficient to put "header" and "footer" in arrays? Keep in mind I'd have to use eval() on "header" as all of my headers contain some php code. Another method that would involve using eval() would be to store the headers and footers in databases, but I highly doubt this would be more efficient than storing them in arrays or functions.

Another situation, which I am quite certain would benefit from using a function instead of an include, is that of scripts using forms. These forms need to be included on more than one line, such as when the data is empty or invalid and the form needs to be shown again. But forms are relatively small compared to most of my headers.

So there you have it. How does an include compare to a function or a function to an array? Is there a big difference in how the data is stored in memory with a function versus an array? Would one choice be more efficient on a virtual server, while another more efficient on a dedicated (because of memory considerations)? I'm going to just assume the database is not the most efficient choice here.

Thank you to all those who will respond, and even those who simply read this whole message.

-Rob Paxon
--- End Message ---
--- Begin Message ---
It is my understanding, as disk reads are so slow, that it is not a good idea to include multiple files. I always knew this, but I never really thought about it.

Rob, you will find people who religiously avoid includes have pages that include dozens and dozens of images there by negating the microseconds gained by not using includes. I will refrain from commenting on the rest of the mail primarily because i feel trying to shave a few milliseconds here or there by changing the includes, moving from double to single quotes etc are all futile efforts. Real speed and scalability comes from algorithms backed up by tight coding.




--
Raditha Dissanayake.
---------------------------------------------------------------
http://www.radinks.com/upload/ Drag and Drop Upload thousands of files and folders in a single
transfer. (HTTP or FTP)

--- End Message ---
--- Begin Message --- Thanks for the reply. In my case there aren't many external files associated with the script. 1 css file per site and no images except on a few very specific pages.

Adding images does not negate the shaved microseconds. I see what you mean, but it doesn't literally negate the saved load. The images would be there whether or not the includes are used. I'm sure there are millionaires out there who still pinch pennies.

That being said, I do appreciate your point, and I'm not one to go overboard with these kinds of things. However, it is quite simply a matter of three ways to do this with one being faster. Why would I, for something so fundamental to my application (used on every pageview across the network), not use the fastest method unless it brought some great inconvenience to me?

Since I am already restructuring things, it would not bring about much inconvenience to me. I do expect my sites growth to be quite substantial over the coming year, so it can't hurt to pinch my pennies now, even if I currently have an embarassment of riches.

Some day a millionaire might lose everything, except for the jar of pennies he has on his dresser.


Raditha Dissanayake wrote:



It is my understanding, as disk reads are so slow, that it is not a good idea to include multiple files. I always knew this, but I never really thought about it.


Rob, you will find people who religiously avoid includes have pages that include dozens and dozens of images there by negating the microseconds gained by not using includes. I will refrain from commenting on the rest of the mail primarily because i feel trying to shave a few milliseconds here or there by changing the includes, moving from double to single quotes etc are all futile efforts. Real speed and scalability comes from algorithms backed up by tight coding.




--- End Message ---
--- Begin Message ---
Hi,

Tuesday, March 16, 2004, 3:23:35 PM, you wrote:
RP> Pardon me if this subject has been discussed, but a search of the 
RP> archive didn't bring up much of anything.

RP> Bear with me while I dish out some details.  My question concerns the
RP> efficiency of using multiple file includes versus storing segments of
RP> data in one include as arrays or functions.

RP> While rebuilding the core of my web site network and, after reading some
RP> negative things about file includes, I was forced to rethink how I am
RP> structuring things.

RP> Here are some details:
RP> *One domain serving, with around 5 sites as subdomains currently and
RP> more soon to come.
RP> *Each script on every site includes a global file that has sessions
RP> stuff and network-wide functions.
RP> *Each script includes a header.php file for the specific site's layout.
RP> *Each script includes a footer.php for ditto.
RP> *I am currently on a virtual server, but obviously will need to move on
RP> to a dedicated very shortly.

RP> It is my understanding, as disk reads are so slow, that it is not a good
RP> idea to include multiple files.  I always knew this, but I never really
RP> thought about it.

RP> While thinking of how to optimize it, I considered merging header.php
RP> and the global file as one.  However, I then realized some scripts
RP> access the database before including the header as to dynamically change
RP> meta tags (say, for Articles).  I could use output buffering but, well,
RP> I'm not going to.

RP> So I was thinking of making one include file that contained the following:
RP> The former "global" contents (which I'd have to use a batch file to
RP> manage this section of the file for all sites at once, no big deal),
RP> "header.php" as a function, and the same for "footer.php".

RP> My main question is, will this, with any certainty, be more considerably
RP> more efficient than simply including three files?  Would it be more
RP> efficient to put "header" and "footer" in arrays?  Keep in mind I'd have
RP> to use eval() on "header" as all of my headers contain some php code.
RP> Another method that would involve using eval() would be to store the
RP> headers and footers in databases, but I highly doubt this would be more
RP> efficient than storing them in arrays or functions.

RP> Another situation, which I am quite certain would benefit from using a
RP> function instead of an include, is that of scripts using forms.  These
RP> forms need to be included on more than one line, such as when the data
RP> is empty or invalid and the form needs to be shown again.  But forms are
RP> relatively small compared to most of my headers.

RP> So there you have it.  How does an include compare to a function or a
RP> function to an array?  Is there a big difference in how the data is
RP> stored in memory with a function versus an array?  Would one choice be
RP> more efficient on a virtual server, while another more efficient on a
RP> dedicated (because of memory considerations)?  I'm going to just assume
RP> the database is not the most efficient choice here.

RP> Thank you to all those who will respond, and even those who simply read
RP> this whole message.

RP> -Rob Paxon


On a busy site (where the milliseconds start to matter) the chances
are that the operating system has your include files cached so the
load time is probably not a factor. If you install some of the php
token caching systems (zend and others) the speed is even better.

As to using header and footer includes I found that system really
frustrating trying to follow the html. What I have switched to is
templates where the site layout is a template and each php page
generates the content and passes it one include file that does the
final mix. this way my html developer has control over the html and
can edit it as one file most of the time.

-- 
regards,
Tom

--- End Message ---
--- Begin Message --- I have used templating for specific projects in the past (and never really liked it), but for this group of sites I handle both ends, so it loses a lot of its worth. The factor of a caching system like Zend is something I have overlooked. Currently, I wouldn't assume my virtual host uses it, but it is something I have planned to purchase when I make the move to a dedicated server.

As for trying to follow the HTML in an "include system", I don't have too much of a problem with it personally. Perhaps because there isn't much to my HTML, as I try to stick with a basic XHTML document layout that can be manipulated by CSS. In other words, I never really have to edit my HTML, except for the static text within when the need be.

Thanks for the info. I suppose I'll just stay with the includes for this round and if I know of a better way next time I do my "spring cleaning"--which probably won't have the coincidence of falling near spring again--I'll run with it.

- Rob Paxon

Tom Rogers wrote:
Hi,


On a busy site (where the milliseconds start to matter) the chances are that the operating system has your include files cached so the load time is probably not a factor. If you install some of the php token caching systems (zend and others) the speed is even better.

As to using header and footer includes I found that system really
frustrating trying to follow the html. What I have switched to is
templates where the site layout is a template and each php page
generates the content and passes it one include file that does the
final mix. this way my html developer has control over the html and
can edit it as one file most of the time.


--- End Message ---
--- Begin Message ---
Hi,


On a busy site (where the milliseconds start to matter) the chances are that the operating system has your include files cached so the load time is probably not a factor. If you install some of the php token caching systems (zend and others) the speed is even better.

Gentlemen I do believe I have been misunderstood. What I meant was that there are ways in which you can save pounds perhaps by the bucketfull with possibly much less effort. For example I recently ran into a $1000 software where the most commonly used query was running against a table that had a non-numeric primary key. This same key was being used in multiple joins. Surely that can be optimized to get a huge gain in performance?



As to using header and footer includes I found that system really frustrating trying to follow the html. What I have switched to is templates where the site layout is a template and each php page generates the content and passes it one include file that does the final mix. this way my html developer has control over the html and can edit it as one file most of the time.

Processing templates also consumes a bit of extra clock cycles.


--
Raditha Dissanayake.
---------------------------------------------------------------
http://www.radinks.com/upload/ Drag and Drop Upload thousands of files and folders in a single
transfer. (HTTP or FTP)

--- End Message ---
--- Begin Message ---
http://dedntfaq.hostingsupport.com/iis6_php_install.txt

regards,
nadim

--- End Message ---
--- Begin Message ---
Does anybody know of a licensing system or tutorial that uses mysql or a
text file. I want to add some sort of license control to the web app, eg if
it's a 10 user license, only 10 people can be on that site at a time.

Thanks

Jakes

--- End Message ---
--- Begin Message ---
Hi Guys,

I'm a beginner on PHP and i just installed it on FreeBSD with apache. I
already follow instructions at manual install then i create test file like
test.php4 with <? phpinfo() ?>.I browse to this file with IE but it can't
display PHP info but when i brwose that file, it appears page with text "<?
phpinfo() ?>.

Anyone can help me?
Thanks


--- End Message ---
--- Begin Message ---
Harry, 

This could be due to a setting in your php.ini: short_open_tags = off
Either set this to "on" or use <?php phpinfo() ?>

Till We Meet Again...

Clifford W. Hansen
Operations Support Developer
Aspivia (Pty) Ltd.

+27 (0) 11 259-1150 (Switchboard)
+27 (0) 11 259-1019 (Fax)
+27 (0) 83 761-0240 (Mobile)
[EMAIL PROTECTED] (EMail)

Registered Linux user number 343424 on http://counter.li.org/

"We have seen strange things today!" Luke 5:26

This message contains information intended for the perusal, and/or use (if
so stated), of the stated addressee(s) only. The information is confidential
and privileged. If you are not an intended recipient, do not peruse, use,
disseminate, distribute, copy or in any manner rely upon the information
contained in this message (directly or indirectly). The sender and/or the
entity represented by the sender shall not be held accountable in the event
that this prohibition is disregarded.

If you receive this message in error, notify the sender immediately by
e-mail, fax or telephone and return and/or destroy the original message.

The views or representations contained in this message, whether express or
implied, are those of the sender only, unless that sender expressly states
them to be the views or representations of an entity or person, who shall be
named by the sender and who the sender shall state to represent. No
liability shall otherwise attach to any other entity or person.

--- End Message ---
--- Begin Message ---
I  need to determine if the printer is on line before sending a document to
it, it
is connected to a unix machine running solaris 8, any idea?

Thanks

--- End Message ---
--- Begin Message ---
Hi there

I have to make use of embedded pdf files in my page (management decision, please dont 
argue with me on this one, not my choice).
I there a function or somthing to detect the presence of adobe reader to make sure the 
client has it installed, before
continuing with displaying it in the browser.
I was thinking of trying to do a find the adobe.exe file, but I dont think that to 
smart solution.


Kind Regards
Brent Clark

--- End Message ---
--- Begin Message ---
On Tue, 16 Mar 2004, Brent Clark wrote:

> I have to make use of embedded pdf files in my page (management decision, please 
> dont argue with me on this one, not my choice).
> I there a function or somthing to detect the presence of adobe reader to make sure 
> the client has it installed, before
> continuing with displaying it in the browser.
> I was thinking of trying to do a find the adobe.exe file, but I dont think that to 
> smart solution.

Hello

I understand you are planning to display a PDF file inside a browser, yes?

I believe it would be a security major risk if a server side script was 
able to list available applications on the client side. This may be 
possible with M$-script technology, but I would be very worried if it was 
possible with PHP. Please correct me if I talk nonsense...

Maybe a link to Adobe's Acrobat Reader download page is your best bet.


-- 
Regards,
--Jyry
C|:-(    C|:-/    C|========8-O    C|8-/    C|:-(

--- End Message ---
--- Begin Message ---

Yes encode() function worked perfectely fine.

-vimala/.


On Mon, 15 Mar 2004, Richard Davey wrote:

> Hello Vimala,
>
> Monday, March 15, 2004, 11:55:47 AM, you wrote:
>
> VSP> Is there any way of passing unicode strings properly with href and get?
>
> I'm 99% sure you can pass unicode strings by simply URL Encoding them
> (see urlencode) before appending to the query string. Try it and see?
>
> --
> Best regards,
>  Richard Davey
>  http://www.phpcommunity.org/wiki/296.html
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---

Reply via email to