php-general Digest 4 Jan 2005 16:00:35 -0000 Issue 3208

Topics (messages 205566 through 205592):

Re: Always Include
        205566 by: James Stewart

Re: Calculate No Of Days
        205567 by: Jerry Kita

Re: apache_child_terminate?
        205568 by: Curt Zirzow
        205575 by: Robin Getz

Re: png.h not found, something's going wrong in my PHP installation
        205569 by: Curt Zirzow

php5 webhosting
        205570 by: Greg Donald
        205571 by: Greg Beaver
        205577 by: Richard Davey

PDFlib-Lite-6.0.1
        205572 by: 2wsxdr5
        205590 by: Greg Beaver

Re: How to argue with ASP people...
        205573 by: M Saleh EG
        205574 by: Sagar C Nannapaneni
        205581 by: Jay Blanchard
        205582 by: John Nichel
        205584 by: John Nichel
        205587 by: John Nichel
        205592 by: Richard Davey

php fastcgi win, only 1 concurrent thread?
        205576 by: Xuefer Tinys

GMT
        205578 by: Bruno B B Magalh�es
        205586 by: Travis Conway

Re: migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.
        205579 by: symbulos partners

Re: handling large files w/readfile
        205580 by: Jason Wong
        205583 by: Robin Getz
        205591 by: Jason Wong

variable hell
        205585 by: mario
        205588 by: Mike Johnson
        205589 by: Jyry Kuukkanen

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 Jan 3, 2005, at 9:56 PM, The Disguised Jedi wrote:
I have a file that contains certain functions for proper function of
my website scripting pages, and they need to be callable all the time.
 I know that this can be done through an include() or require()
statement, but it would be easier if I could have it automatically
done.  Is there a way in Apache or PHP (this is going to both lists)
that this can be accomplished, or should I just stick with my
require() statements?

If you can use a .htaccess file, try putting this in there:

php_value auto_prepend_file /path/to/your/file

James.
--
James Stewart : Freelance Web Developer
Work : http://jystewart.net
Play : http://james.anthropiccollective.org

--- End Message ---
--- Begin Message --- Khuram Noman wrote:
Hi

Is there any function avialable in PHP to calculate
the no of days by passing 2 dates like 1 argument is
1/1/2005 and the second one is 1/2/2005 then it
returns the no of days or how can i do that if there
is no builtin function .

Regards
Khuram Noman

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Here's a piece of code that I use on my website. It calculates the number of days from today to some future date (which happens to be July 16, 2005) It's not exactly what you asked for but it might be helpful to you. No one will confuse me with being a professional programmer but this seems to work well on my site.


<snippet ----
$timeuntilcamp = mktime(12,0,0,7,16,2005,-1) - time();
$daysuntilcamp = round($timeuntilcamp/86400);
if ($daysuntilcamp > 0)
  {
  print "<h4>Days until start of 2005 Camp: ".$daysuntilcamp."</h4>\n";
  }
---- snippet>

You can see it in "action" by visiting:

http://www.salkehatchiehuntersville.com/Salkehatchie_2005_Camp.php

--
Jerry Kita

http://www.salkehatchiehuntersville.com

email: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
* Thus wrote Robin Getz:
> I am trying to turn on apache_child_terminate with PHP V4.3.10 / Apache 
> 2.0.52
> 
> According to: 
> http://php.planetmirror.com/manual/en/function.apache-child-terminate.php
> 
> I should be able to turn this on with 'child_terminate' in php.ini
> 
> However, I do this, and when I do a phpinfo(); it returns a:
> 
> apache2handler with only three Directives:
> - engine
> - last_modified
> - xbithack
> 
> When I look at others with apache 1.3, it lists, child_terminate.

Are you running apache in multithreaded per chance?

  http://php.net/manual/en/function.apache-child-terminate.php

Of course this begs the question why you want all php script's to
terminage apache, this will only provide extra cpu usage.


Curt
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message --- Curt Zirzow wrote:
> I should be able to turn this on with 'child_terminate' in php.ini
>
> However, I do this, and when I do a phpinfo(); it returns a:
>
> apache2handler with only three Directives:
> - engine
> - last_modified
> - xbithack

Are you running apache in multithreaded per chance?

  http://php.net/manual/en/function.apache-child-terminate.php

Of course this begs the question why you want all php script's to terminage apache, this will only provide extra cpu usage.

I have a download script that for some reason, seems to be consuming lots of memory - no matter what I do.


Someone suggested apache_child_terminate after the download is done, to kill the apache process, and make sure that the memory is released back to the OS.

-Robin
--- End Message ---
--- Begin Message ---
* Thus wrote Aaron Paulley:
> I found a thread a couple of weeks ago where someone had to create
> symbolic links in order to get their install of PHP to work because
> PHP wasn't able to find png.h.

A reference to that thread could be helpfull.

> 
> I am having the same problem. I made no changes to the installation of
> libpng, installed it in its default location and PHP cannot find
> png.h, no matter what I set the dir= flag to.
> 
> Here is my ./configure:
> 
> ./configure --with-mysql --with-apxs=/www/bin/apxs --with-xml
> --enable-ftp --with-gd --enable-magic-quotes --with-jpeg-dir=/usr
> --with-mcrypt --with-png-dir=/usr --enable-sockets --enable-track-vars
> --enable-versioning --with-zlib --enable-bcmath --enable-calendar
> --with-xpm-dir=/usr/X11R6 --enable-memory-limit
> 
> png.h on my system is located in /usr/lib

png.h should *not* be located in /usr/lib it should be located in
/usr/include



Curt
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message ---
Anyone found any good deals with webhosts supporting PHP5 yet?

Thanks,

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

--- End Message ---
--- Begin Message --- Greg Donald wrote:
Anyone found any good deals with webhosts supporting PHP5 yet?

it's not exactly for newbies, but bluga.net has been doing a fine job for me.


Greg

P.S. "ZCE" doesn't exactly imply newbie :) this is for others on the list
--- End Message ---
--- Begin Message ---
Hello Greg,

Tuesday, January 4, 2005, 4:54:31 AM, you wrote:

GD> Anyone found any good deals with webhosts supporting PHP5 yet?

I use http://www.textdrive.com/ for a personal PHP5 site. Very
well configured servers. Recommended by someone else on this list who
works for them I believe.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

--- End Message ---
--- Begin Message --- <http://www.pdflib.com/products/pdflib/download/601src/PDFlib-Lite-6.0.1.tar.gz>I am trying to install PDFlib-Lite-6.0.1 on my testing server. So far no luck. I am starting with php 4.3.3 and apache 2.0 on an SUSE 9.0 machine. Apache and php were installed with the OS. I started by getting tiff-3.7.1.tar.gz and jpegsrc.v6b.tar.gz and those both installed with out a problem.... then I got PDFlib-Lite-6.0.1.tar.gz and that configured compiled fine then came the problems. Here is the command and out put...

PIII500x2:~ # pear install pdflib
downloading pdflib-2.0.4.tgz ...
...done: 36,082 bytes
7 source files, building
running: phpize
Configuring for:
 PHP Api Version:   20020918
 Zend Module Api No:   20020429
 Zend Extension Api No:   20021010
`phpize' failed

Any ideas?
--- End Message ---
--- Begin Message --- 2wsxdr5 wrote:
<http://www.pdflib.com/products/pdflib/download/601src/PDFlib-Lite-6.0.1.tar.gz>I am trying to install PDFlib-Lite-6.0.1 on my testing server. So far no luck. I am starting with php 4.3.3 and apache 2.0 on an SUSE 9.0 machine. Apache and php were installed with the OS. I started by getting tiff-3.7.1.tar.gz and jpegsrc.v6b.tar.gz and those both installed with out a problem.... then I got PDFlib-Lite-6.0.1.tar.gz and that configured compiled fine then came the problems. Here is the command and out put...

PIII500x2:~ # pear install pdflib
downloading pdflib-2.0.4.tgz ...
...done: 36,082 bytes
7 source files, building
running: phpize
Configuring for:
 PHP Api Version:   20020918
 Zend Module Api No:   20020429
 Zend Extension Api No:   20021010
`phpize' failed

Any ideas?

This is a question for pear-general.

Please specify the output of pear -V, and if you don't see 1.3.4, upgrade and try again.

Greg
--- End Message ---
--- Begin Message ---
Not to offend u or backup ASP but ur just wrong...

You said:
>You
>can't actually create a class.

That's not true! u might not be knowing the syntax of creating a class
in vb or js script. Sorry but this is the truth my friend.


On Mon, 3 Jan 2005 10:27:05 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> 
wrote:
> You can spend a small fortune in ASP adding in COM objects (or writing
> them) so it will eventually have maybe HALF the functionality of PHP.
> 
> http://php.net/
> 
> ASP's "Object Oriented" feature set is a joke.
> All the "object"-ness is built into pre-packaged stuff from MS -- You
> can't actually create a class.
> 
> ASP has no include function.  This makes life very very very difficult to
> write decent code.
> 
> ASP database drivers are slower than PHP's, for those few databases that
> ASP even supports.
> 
> $$$ -- ASP costs a *LOT* more than PHP, by the time you get done factoring
> in *ALL* expenses.
> 
> --
> 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
> 
> 


-- 
M.Saleh.E.G
97150-4779817

--- End Message ---
--- Begin Message ---
I'm a passionate freak of PHP from the past 4 years (that i can remember).
And i love everything that php can do. But just 2 days ago i came along a
situation where i have to write a hit counter for my website without using
a database or a text file. Just using a global variable i wanted to do this.

I dont know whether php can do this...(or may b i missed it out)...but i
couldnt
get any equivalent thing in php like we have GLOBAL.ASA in ASP.

/sagar
----- Original Message -----
From: "M Saleh EG" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "John Sands" <[EMAIL PROTECTED]>; <[email protected]>
Sent: Tuesday, January 04, 2005 11:14 AM
Subject: Re: [PHP] How to argue with ASP people...


> Not to offend u or backup ASP but ur just wrong...
>
> You said:
> >You
> >can't actually create a class.
>
> That's not true! u might not be knowing the syntax of creating a class
> in vb or js script. Sorry but this is the truth my friend.
>
>
> On Mon, 3 Jan 2005 10:27:05 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]>
wrote:
> > You can spend a small fortune in ASP adding in COM objects (or writing
> > them) so it will eventually have maybe HALF the functionality of PHP.
> >
> > http://php.net/
> >
> > ASP's "Object Oriented" feature set is a joke.
> > All the "object"-ness is built into pre-packaged stuff from MS -- You
> > can't actually create a class.
> >
> > ASP has no include function.  This makes life very very very difficult
to
> > write decent code.
> >
> > ASP database drivers are slower than PHP's, for those few databases that
> > ASP even supports.
> >
> > $$$ -- ASP costs a *LOT* more than PHP, by the time you get done
factoring
> > in *ALL* expenses.
> >
> > --
> > 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
> >
> >
>
>
> --
> M.Saleh.E.G
> 97150-4779817
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
[snip]
I'm a passionate freak of PHP from the past 4 years (that i can
remember).
And i love everything that php can do. But just 2 days ago i came along
a
situation where i have to write a hit counter for my website without
using
a database or a text file. Just using a global variable i wanted to do
this.

I dont know whether php can do this...(or may b i missed it out)...but i
couldnt
get any equivalent thing in php like we have GLOBAL.ASA in ASP.
[/snip]

What do you think GLOBAL.ASA is? From M$, - "A file that stores
information about an Internet Information Services (IIS) application,
such as initialization in structures, and objects that have been given
application scope."

So, you still have to use a text file. 

Next!

--- End Message ---
--- Begin Message --- Sagar C Nannapaneni wrote:
I'm a passionate freak of PHP from the past 4 years (that i can remember).
And i love everything that php can do. But just 2 days ago i came along a
situation where i have to write a hit counter for my website without using
a database or a text file. Just using a global variable i wanted to do this.

Not possible in any language. Well, it's possible in a way I guess. The count could be stored in memory, but as soon as the box is restarted, memory is dumped, etc., you'll lose the count.


I dont know whether php can do this...(or may b i missed it out)...but i
couldnt
get any equivalent thing in php like we have GLOBAL.ASA in ASP.

GLOBAL.ASA uses a file to retain it's settings.

--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- Leif Gregory wrote:
Hello Richard,

Monday, January 3, 2005, 11:27:05 AM, you wrote:
RL> ASP has no include function. This makes life very very very
RL> difficult to write decent code.

Not that I like ASP, and I'm not an ASP guru by any means, but this
statement is incorrect AFAICS. I use to do this all the time in ASP.

<!-- #include virtual="includes/databaseconnect.asp" -->

I'm not an ASP guru either, but this doesn't look like ASP syntax to me. This looks like an Apache SSI.


--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- [EMAIL PROTECTED] wrote:
<!-- #include virtual="includes/databaseconnect.asp" --> is html... :-)

/G
@varupiraten.se

Standard comment in HTML, but it has another use with Apache, and I didn't find any reference to this type of syntax for ASP.


From the Apache Docs at http://httpd.apache.org/docs/howto/ssi.html...

Including the results of a CGI program

This is one of the more common uses of SSI - to output the results of a CGI program, such as everybody's favorite, a ``hit counter.''

<!--#include virtual="/cgi-bin/counter.pl" -->

Including a standard footer

If you are managing any site that is more than a few pages, you may find that making changes to all those pages can be a real pain, particularly if you are trying to maintain some kind of standard look across all those pages.

Using an include file for a header and/or a footer can reduce the burden of these updates. You just have to make one footer file, and then include it into each page with the include SSI command. The include element can determine what file to include with either the file attribute, or the virtual attribute. The file attribute is a file path, relative to the current directory. That means that it cannot be an absolute file path (starting with /), nor can it contain ../ as part of that path. The virtual attribute is probably more useful, and should specify a URL relative to the document being served. It can start with a /, but must be on the same server as the file being served.

<!--#include virtual="/footer.html" -->

--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hello John,

Tuesday, January 4, 2005, 2:52:27 PM, you wrote:

JN> Standard comment in HTML, but it has another use with Apache, and I
JN> didn't find any reference to this type of syntax for ASP.

<!--#include file="whatever.asp" -->

and

<!--#include virtual="whatever.asp" -->

are both perfectly valid ASP syntax that will work on **IIS**

Obviously you can do the usual stuff as in PHP, with:

<%
filen = "header.inc"
%>
<!--#include file="<%=filen%>"-->

etc etc

It's no different really. PHP might be significantly better than ASP,
but it's still not *that* archaic!

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

--- End Message ---
--- Begin Message ---
i'm using external fastcgi
it seems all other request is blocked until the 1 have finished

any work arround?

--- End Message ---
--- Begin Message ---
Hi you all,

How do you work with GMT time-zones? I mean, I�ve developed a support system, with projects, bugs, tasks, etc... but as I user date()�,I is 6 hours late from my client�s time-zone...

And I would like to make it a little more dynamic than just put a variable in the code and add to the hour.

Regards,
Bruno B B Magalh�es

--- End Message ---
--- Begin Message --- Here has always been a problem I run into with GMT translation. You have to make sure that the system you are working with is set to the correct time zone so that any application trying to automatically figure out the time have the starting point. This is easy enough in Windows, but can mean making sure your /etc/localtime (See http://www.linuxforum.com/linux_tutorials/68/1.php) is correct in linux. Of course there are GUI tools to help with this also for those non-console people. Unfortunately some people rely on shared servers where you do not have root access to change /etc/localtime.

Therefore you must have an overloadable function to return the time in GMT. Where it can accept an offset or rely on the systems timezone.

To me, it seems best to just use a variable. Print out the time, then do a correct offset for it.

But for something already done, see http://us3.php.net/manual/en/function.gmdate.php

Travis

----- Original Message ----- From: "Bruno B B Magalh�es" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 04, 2005 5:04 AM
Subject: [PHP] GMT



Hi you all,

How do you work with GMT time-zones? I mean, I�ve developed a support system, with projects, bugs, tasks, etc... but as I user date()�,I is 6 hours late from my client�s time-zone...

And I would like to make it a little more dynamic than just put a variable in the code and add to the hour.

Regards,
Bruno B B Magalh�es

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


--- End Message ---
--- Begin Message ---
Rasmus Lerdorf wrote:
> I thought I just explained that.  The problem is that the dozens of
> libraries you are likely to link into you Apache+PHP system may or may
> not be threadsafe.  

We are only thinking of using standard libraries,that is the libraries which
allow us to access the functions listed in chapter VI. Function Reference
of official PHP Manual version 03-01-2005.

Are these libraries all thread safe? If not, is there a list explaining
which libraries are thread safe (not thread safe)?

-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

--- End Message ---
--- Begin Message ---
On Sunday 02 January 2005 16:43, Robin Getz wrote:
> Rasmus Lerdorf wrote:
> > >> ============================
> > >> $buff = "0";
> > >> while (!feof($fp)) {
> > >>    $buff = fread($fp, 4096);
> > >>    print $buff;
> > >> }
> > >> unset($buff);
> > >> fclose ($fp);
> > >> ============================
> >
> >Well, the above code does not use more than 4K of ram plus a bit of
> >overhead.  So if something is causing your processes to grow to 450M you
> >need to look elsewhere because this code is definitely not the cause.
>
> Well, the test case is:
> 1) above with big files = big apache processes - machine crashes

Are you using the above code on its own (ie not within some other code that 
may affect the memory usage)?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
Jason Wong wrote:

Are you using the above code on its own (ie not within some other code that may affect the memory usage)?

Well, herethe entire file (It is pretty short - only a 2 pages, but sorry in advance if anyone considers this bad form).


site is called with something like

http://blackfin.uclinux.org/frs/download.php/123/STAMP.jpg

Files are stored in:

$sys_upload_dir.$group_name.'/'.$filename

-- frs/download.php ---------------------------------------------
<?php
/**
* GForge FRS Facility
*
* Copyright 1999-2001 (c) VA Linux Systems
* The rest Copyright 2002-2004 (c) GForge Team
* http://gforge.org/
*
* @version $Id: download.php,v 1.6 2004/10/08 23:05:29 gsmet Exp $
*
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */


$no_gz_buffer=true;

require_once('pre.php');

$arr=explode('/',$REQUEST_URI);
$file_id=$arr[3];

$res=db_query("SELECT frs_file.filename,frs_package.is_public,
        frs_file.file_id,groups.unix_group_name,groups.group_id
        FROM frs_package,frs_release,frs_file,groups
        WHERE frs_release.release_id=frs_file.release_id
        AND groups.group_id=frs_package.group_id
        AND frs_release.package_id=frs_package.package_id
        AND frs_file.file_id='$file_id'");

if (db_numrows($res) < 1) {
        Header("Status: 404");
        exit;
}

$is_public =db_result($res,0,'is_public'); $group_name=db_result($res,0,'unix_group_name');
$filename = db_result($res,0,'filename'); $release_id=db_result($res,0,'release_id');
$group_id = db_result($res,0,'group_id');


$Group =& group_get_object($group_id);
if (!$Group || !is_object($Group) || $Group->isError()) {
        exit_no_group();
}

if(!$Group->isPublic()) {
        session_require(array('group' => $group_id)); }

// Members of projects can see all packages // Non-members can only see public packages
if(!$is_public) {
if (!session_loggedin() || (!user_ismember($group_id) && !user_ismember(1,'A'))) {
exit_permission_denied();
}
}


/*
echo $group_name.'|'.$filename.'|'.$sys_upload_dir.$group_name.'/'.$filename;
if (file_exists($sys_upload_dir.$group_name.'/'.$filename)) {
echo '<br />file exists';
passthru($sys_upload_dir.$group_name.'/'.$filename);
}
*/
if (file_exists($sys_upload_dir.$group_name.'/'.$filename)) {
Header('Content-disposition: filename="'.str_replace('"', '', $filename).'"');
Header("Content-type: application/binary");
length = filesize($sys_upload_dir.$group_name.'/'.$filename);
Header("Content-length: $length");


        # Here is where all the problems start
        readfile($sys_upload_dir.$group_name.'/'.$filename);

        if (session_loggedin()) {
                s =& session_get_user();
                us=$s->getID();
        } else {
                us=100;
        }

res=db_query("INSERT INTO frs_dlstats_file (ip_address,file_id,month,day,user_id)
VALUES ('$REMOTE_ADDR','$file_id','".date('Ym')."','".date('d')."','$us')");
} else {
Header("Status: 404");
}


?>
=============================================

If this runs for awhile things go very bad. This seems to be related to a specific download manager called NetAnts that seems to be popular in China.
http://www.netants.com/


Which attempts to open the same url for downloading 10-15 times at the same instant.

If I replace things with:

==== snip =====
if (file_exists($sys_upload_dir.$group_name.'/'.$filename)) {
# if the file is too big to download (10Meg) - use a different method than php
$length = filesize($sys_upload_dir.$group_name.'/'.$filename);
Header('Content-disposition: filename="'.str_replace('"', '', $filename).'"');
Header("Content-type: application/binary");
Header("Content-length: $length");


        fp = fopen($sys_upload_dir.$group_name.'/'.$filename,'rb');
        buff="0";
        while (!feof($fp)) {
                buff = fread($fp, 4096);
                print $buff;
        }
        unset($buff);
        fclose ($fp);

===  snip - rest is the same =====

I get exactly the same problem - I come back and there are 2-3-4 apache processes that are consuming memory the size of the largest downloads.

The only way I can make things work with large downloads is to use this:

==== snip ====
if (file_exists($sys_upload_dir.$group_name.'/'.$filename)) {
# if the file is too big to download (10Meg) - use a different method than php
$length = filesize($sys_upload_dir.$group_name.'/'.$filename);
if ($length >= 10485760 ) {
out = "http://downloads.".$sys_default_domain."/".$group_name."/".$filename;
Header("Location: ".$out);
} else {
# less than 10Meg - download with php
Header('Content-disposition: filename="'.str_replace('"', '', $filename).'"');
Header("Content-type: application/binary");
Header("Content-length: $length");
fp = fopen($sys_upload_dir.$group_name.'/'.$filename,'rb');
buff="0";
while (!feof($fp)) {
buff = fread($fp, 4096);
print $buff;
}
unset($buff);
fclose ($fp);
}


==== snip - rest is the same =====

Someone suggested apache_child_terminate - but this function doesn't seem to be available to me.

Thanks in advance.

-Robin
--- End Message ---
--- Begin Message ---
On Tuesday 04 January 2005 22:04, Robin Getz wrote:
> Jason Wong wrote:
> >Are you using the above code on its own (ie not within some other code
> >that may affect the memory usage)?
>
> Well, herethe entire file (It is pretty short - only a 2 pages, but sorry
> in advance if anyone considers this bad form).

I should have added that if you're not running that snippet of code on its own 
then try running it on its own, give it a fixed filename (so you don't have 
to go through the $_REQUEST and database business). Clouding the issue by 
running it in conjunction with other code (however innocuous) just 
complicates matters.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
Hi all

I have few variables in this format:

$isproductssorttext = "150";
$isofferssorttext = "250";
$isnewproductssorttext = "350";

$isproductscount = "50";
$isofferscount = "30";
$isnewproductscount = "20";
etc....


What I want to do is have a variable
e.g. $x = "products";

and create from that, the variable $is'products'sorttext
(<--$isproductssorttext) and use its value

so if $x was "offers" on echo I would have (250) <-- "$isofferssorttext"
if $x was newproducts on echo I would have (350) <-- 
"$isnewproductssorttext"

Thanks in advance

Mario

--- End Message ---
--- Begin Message ---
From: mario [mailto:[EMAIL PROTECTED] 

> Hi all
> 
> I have few variables in this format:
> 
> $isproductssorttext = "150";
> $isofferssorttext = "250";
> $isnewproductssorttext = "350";
> 
> $isproductscount = "50";
> $isofferscount = "30";
> $isnewproductscount = "20";
> etc....
> 
> 
> What I want to do is have a variable
> e.g. $x = "products";
> 
> and create from that, the variable $is'products'sorttext
> (<--$isproductssorttext) and use its value
> 
> so if $x was "offers" on echo I would have (250) <-- 
> "$isofferssorttext"
> if $x was newproducts on echo I would have (350) <-- 
> "$isnewproductssorttext"

I'd imagine, at this point, you'd need to move into the realm of
associative arrays.

        $x = 'products';

        $issorttext[$x] = 150;
        $isnewsorttext[$x] = 350;
        $iscount[$x] = 50;
        $isnewcount[$x] = 20;

After this, you'd end up with four arrays of one key each ('products'),
referenced as such:

        echo $issorttext['products']; // echoes 150

Then do the same for the key 'offers' and you'd have the same four
arrays, but now each with two keys.

Hope this wasn't too confusing an explanation.   :)


-- 
Mike Johnson             Smarter Living, Inc.
Web Developer            www.smarterliving.com
[EMAIL PROTECTED]   (617) 886-5539

--- End Message ---
--- Begin Message ---
On Tue, 4 Jan 2005, mario wrote:

> Hi all
> 
> I have few variables in this format:
> 
> $isproductssorttext = "150";
> $isofferssorttext = "250";
> $isnewproductssorttext = "350";
> 
> $isproductscount = "50";
> $isofferscount = "30";
> $isnewproductscount = "20";
> etc....
> 
> 
> What I want to do is have a variable
> e.g. $x = "products";
> 
> and create from that, the variable $is'products'sorttext
> (<--$isproductssorttext) and use its value
> 
> so if $x was "offers" on echo I would have (250) <-- "$isofferssorttext"
> if $x was newproducts on echo I would have (350) <-- 
> "$isnewproductssorttext"



Hello


I believe what you are after is ${'is'.$x.'sorttext'}

but I would rather use the nfollowing approach as it is much more readable 
and easier to debug:

$issorttext = array('offers' = 250, 'newproducts' => 250, ...)

and then use it:

echo $issorttext['offers'];




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

--- End Message ---

Reply via email to