php-general Digest 17 Jun 2006 11:53:11 -0000 Issue 4190
Topics (messages 238171 through 238185):
Re: Serving a graphic downloads it instead of displaying it
238171 by: Richard Lynch
238172 by: Mariano Guadagnini
Re: How to run one php app from another? RECAP
238173 by: Richard Lynch
238174 by: Richard Lynch
238175 by: Richard Lynch
238176 by: tedd
238181 by: Richard Lynch
238182 by: tedd
Re: Javascript & PHP
238177 by: Richard Lynch
238180 by: tedd
Re: file_exists() behind firewall
238178 by: Richard Lynch
Re: File Download Headers
238179 by: Richard Lynch
238183 by: Larry Garfield
Re: Need to recompile php 4.3.4
238184 by: chris smith
GET, POST, REQUEST
238185 by: Martin Marques
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 Fri, June 16, 2006 9:30 am, Brian Dunning wrote:
> I'm trying to serve up a jpeg like this:
>
> header("Content-type: image/jpg");
> readfile('images/banner-ad.jpg');
>
> It works on other browsers, but on Safari it downloads the graphic
> like a file, rather than displaying it. What's up with that????
Perhaps the image file itself is not quite a kosher JPEG, and Safari
is getting confused?...
What happens when Safari surfs directly to images/banner-ad.jpg ?
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Brian Dunning wrote:
I'm trying to serve up a jpeg like this:
header("Content-type: image/jpg");
readfile('images/banner-ad.jpg');
It works on other browsers, but on Safari it downloads the graphic
like a file, rather than displaying it. What's up with that????
--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.0/367 - Release Date: 16/06/2006
Maybe you can try to embed the image in a blank html, inside <img> tag
for example, to show only the image you want.
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.0/367 - Release Date: 16/06/2006
--- End Message ---
--- Begin Message ---
On Fri, June 16, 2006 7:26 am, tedd wrote:
> So, there is NOT a way for one running php-application to call another
> and have it run while having the parent quit?
> 1. There was the suggestion to use includes(). However, includes
> simply adds code into the current application. It does not terminate
> the parent nor start another application. It simply bloats the parent.
This is actually going to be the cheapest thing to do.
If there is monstrous data in the "parent" you could unset() it and
reduce "bloat"
But, really, the "cost" here is a hard drive seek to get the other
script, and you're going to incur that cost no matter what other
solution you use.
So this IS the cheapest way to achieve what you want.
> So, what say you fine php people, can anyone give me an example of a
> php application running (i.e., calling) another? I suspect that php
> can't, but I don't know why -- it doesn't seem logical. Is this one of
> those stateless problematic thingies, or what?
You could do an exec() and have the program being executed fork or use
& and then the parent would quit, but once the parent quits, you lose
your connection to the browser and stdout/stdin and all that for the
child.
You could also do a "Location:" header, but again losing all the data
from parent application, unless you pass it in URL or $_SESSION.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Fri, June 16, 2006 8:26 am, tedd wrote:
> At 2:35 PM +0200 6/16/06, Barry wrote:
>>But once output is made. You can't remove it.
>>
>>That isn't possible with PHP.
>
> I think I get it now.
>
> PHP does everything before the user see's anything.
This is not quite 100% correct...
PHP output is buffered, possibly by PHP with ob_start and friends, and
then possibly by Apache, and then possibly by TCP packets and their
ordered arrival (or not) and then by the browser, but...
It is entirely possible to construct a trivial example proving that
PHP can still be runing and finishing output while the browser has
rendered the beginning of the page.
You can mostly THINK of it as PHP finishing before user sees anything,
as that will get you in a lot less trouble than thinking the other way
around, but to be pedantic, you should be aware it's not quite that
simple.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Fri, June 16, 2006 9:25 am, Martin Alterisio wrote:
> You can fork a new process a run the other script in the child
> process. But
> forking is not always available so I also use another approach:
> emulate a
> web page request through sockets or curl to the script I want to run.
Forking in a web environment is a Bad Idea, as documented in the manual.
YMMV
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
At 3:52 PM -0500 6/16/06, Richard Lynch wrote:
>On Fri, June 16, 2006 8:26 am, tedd wrote:
>> At 2:35 PM +0200 6/16/06, Barry wrote:
>>>But once output is made. You can't remove it.
>>>
>>>That isn't possible with PHP.
>>
>> I think I get it now.
>>
>> PHP does everything before the user see's anything.
>
>This is not quite 100% correct...
>
>PHP output is buffered, possibly by PHP with ob_start and friends, and
>then possibly by Apache, and then possibly by TCP packets and their
>ordered arrival (or not) and then by the browser, but...
>
>It is entirely possible to construct a trivial example proving that
>PHP can still be runing and finishing output while the browser has
>rendered the beginning of the page.
>
>You can mostly THINK of it as PHP finishing before user sees anything,
>as that will get you in a lot less trouble than thinking the other way
>around, but to be pedantic, you should be aware it's not quite that
>simple.
Good explanation and point.
How's this for the obvious -- the user doesn't see anything until php is done
with it. That doesn't mean that the entire operation must be finished, but
rather anything that the user see's (while and after loading) php has already
finished with.
That about right?
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Fri, June 16, 2006 4:04 pm, tedd wrote:
> How's this for the obvious -- the user doesn't see anything until php
> is done with it. That doesn't mean that the entire operation must be
> finished, but rather anything that the user see's (while and after
> loading) php has already finished with.
>
> That about right?
Yes -- Though your concept of PHP being "finished with" and the
Reality *might* not match up.
They probably will, but, for example, if you had all of "War and
Peace" in $foo and did:
echo $foo;
I am not going to guarantee that PHP won't send it out chapter by
chapter and PHP won't be "finished" with the echo before the browser
gets and renders Chapter 1.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
At 3:48 PM -0500 6/16/06, Richard Lynch wrote:
>On Fri, June 16, 2006 7:26 am, tedd wrote:
>> So, there is NOT a way for one running php-application to call another
>> and have it run while having the parent quit?
>
>> 1. There was the suggestion to use includes(). However, includes
>> simply adds code into the current application. It does not terminate
>> the parent nor start another application. It simply bloats the parent.
>
>This is actually going to be the cheapest thing to do.
>
>If there is monstrous data in the "parent" you could unset() it and
>reduce "bloat"
>
>But, really, the "cost" here is a hard drive seek to get the other
>script, and you're going to incur that cost no matter what other
>solution you use.
>
>So this IS the cheapest way to achieve what you want.
>
>> So, what say you fine php people, can anyone give me an example of a
>> php application running (i.e., calling) another? I suspect that php
>> can't, but I don't know why -- it doesn't seem logical. Is this one of
>> those stateless problematic thingies, or what?
>
>You could do an exec() and have the program being executed fork or use
>& and then the parent would quit, but once the parent quits, you lose
>your connection to the browser and stdout/stdin and all that for the
>child.
>
>You could also do a "Location:" header, but again losing all the data
>from parent application, unless you pass it in URL or $_SESSION.
>
Thanks for the additional information -- much to consider here.
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Fri, June 16, 2006 3:51 am, Rob W. wrote:
> Ok. I am trying to figure out if this would be the correct thing to
> do. I start off with Java script that looks like this.
As far as PHP is concerned, Javascript is just "more HTML".
Just cram it into the text of your HTML, or put it into a .js file and
do it like that.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
At 4:06 PM -0500 6/16/06, Richard Lynch wrote:
>On Fri, June 16, 2006 3:51 am, Rob W. wrote:
>> Ok. I am trying to figure out if this would be the correct thing to
>> do. I start off with Java script that looks like this.
>
>As far as PHP is concerned, Javascript is just "more HTML".
As far as PHP is concerned, whatever follows is irrelevant -- it could be
nothing or anything including gibberish. PHP doesn't fail because of bad html
of js, does it? After all, it all happens after php is cyberdust, right?
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
I dunno if AJAX will let you quit partway through, but you could
definitely do this with the lean and mean hand-coded XmlHttpRequest
object and sending HEAD to see if the URL is "there" or not.
It will fail, of course, if they run this app from home or anything
not behind the firewall.
On Fri, June 16, 2006 1:57 am, George Pitcher wrote:
> Hi,
>
> I have several websites that are using a common set of pages (to
> reduce
> maintenance, development and upgrading) and use configuration files to
> give
> the customer the feeling that it is their own unique site. The
> customers are
> all universities and use the sites to manage digitisation and
> copyright
> permission processes. These sites are all hosted om my company server.
>
> I would like them to be able to see whether a PDF file hosted by their
> universities is available or not.
>
> Using file_exists($url) won't work because the actual PDFs should be
> sitting
> behind the universities' firewalls.
>
> I think that something working on the client-side, such as JavaScript
> might
> work, because it would be able to look from the client's machine to
> the PDF,
> both of which should be behind the firewall to the PDF. However, I
> haven't
> been able to find any js that looks like it will do that for me.
>
> Does anyone have any constructive suggestions?
>
> MTIA
>
> George in Oxford
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
I have now officially GIVEN UP on this thread.
On Fri, June 16, 2006 6:03 am, tedd wrote:
> At 12:44 PM +0200 6/16/06, Barry wrote:
>>tedd schrieb:
>>>At 1:44 AM -0400 6/16/06, Chris Shiflett wrote:
>>>>Richard Lynch wrote:
>>>>>It is possible that all "modern" browsers have given
>>>>>in to whichever johnny-come-lately 'standard' made
>>>>>up the Content-disposition header.
>>>>The original RFC for it is dated June 1995, so it's not too recent.
>>>> There are plenty of useful aspects of HTTP not defined in RFC 2616.
>>>>
>>>>>Content-type: application/octet-stream
>>>>There's no reason you can't use both.
>>>>
>>>>Chris
>>>
>>>Chris:
>>>
>>>Barry says you can use these three:
>>>
>>>header("Content-Type: application/force-download");
>>>header("Content-Type: application/octet-stream");
>>>header("Content-Type: application/download");
>>>
>>>Richard says only use this one:
>>>
>>>header("Content-type: application/octet-stream");
>>>
>>>And, you say use both. Which both?
>>>
>>>tedd
>>>
>>Either my three or the one richard mentioned.
>>
>>Both are ok!
>>
>>:)
>>
>>Barry
>
>
> Ahaaa, those four both.
>
> I get it, thanks.
>
> tedd
> --
> ------------------------------------------------------------------------------------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Friday 16 June 2006 08:10, Chris Shiflett wrote:
> Richard's example is the correct Content-Type to use. Barry's is no
> different than this:
>
> header('Content-Type: foo/bar');
>
> It's better to use a valid type and to not have superfluous header()
> calls that do nothing.
>
> Hope that helps.
>
> Chris
I think Richard's point, though, was that while it does nothing now, you have
no way of knowing when it will start having meaning. Sending garbage headers
is sloppy, and opens yourself up to the environment changing out from under
you.
--
Larry Garfield AIM: LOLG42
[EMAIL PROTECTED] ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
--- End Message ---
--- Begin Message ---
On 6/17/06, Mauricio Pellegrini <[EMAIL PROTECTED]> wrote:
Hi ,
In order to enable bcmath I need to recompile php 4.3.4 on suse 8.2.
but , I would like to preserve the actual installation just in case
anything goes wrong ( as this is my production server)
What files should I backup / restore if after compilation php is not
working?
My actual installation consists of php 4.3.4 With the Zend Optimizer
and apache 1.329
Install them in different paths (configure --prefix=...), it will make
it a lot easier.
If you installed originally from rpms, you should be able to find
where it put stuff (rpm -qpl php I think).. If you compiled then
phpinfo will show you the original prefix and you can backup that
structure.
Not sure whether ZO will cope with that, but I guess you'll soon find out ;)
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Yesterday when reading some doc on PHP I noticed the $_REQUEST predefined
array, which looked like a solution to having to check in GET and POST
data (I'm not sure if it will really have an impact on my program yet).
The thing is, I also saw this description:
Variables provided to the script via the GET, POST, and COOKIE input
mechanisms, and which therefore cannot be trusted.
Now, why shouldn't it be trusted?
--
21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' ||
Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional | DBA, Programador,
del Litoral | Administrador
---------------------------------------------------------
--- End Message ---