OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 4 Oct 2004 11:44:51 -0000 Issue 3033

php-general-digest-helplists.php.net
Date: Mon Oct 04 2004 - 06:44:51 CDT


php-general Digest 4 Oct 2004 11:44:51 -0000 Issue 3033

Topics (messages 198562 through 198584):

Re: Why my browser always chooses UTF-8 charset?
        198562 by: Marek Kilimajer

Re: getting a dom xml node's namespace
        198563 by: Jachin Rupe

Re: How to install php5 on Fedora Core2
        198564 by: Teng Wang

Re: PHP (anti) crash policy?
        198565 by: David Bevan
        198580 by: Olaf van der Spek

Re: HOWTO: Install PHP on Fedora Core / Redhat
        198566 by: John Swartzentruber

output a PDF, over header(). causes corruption on the file?
        198567 by: Louie Miranda
        198569 by: Louie Miranda
        198582 by: Daniel Schierbeck

Downloadcounter
        198568 by: Simon Fredriksson
        198570 by: raditha dissanayake

Newbie needs help with MySQL and multiple databases
        198571 by: Matthew
        198572 by: M. Sokolewicz
        198577 by: - Edwin -

simple math computation..
        198573 by: Louie Miranda
        198574 by: - Edwin -
        198575 by: Matthew Fonda
        198576 by: Louie Miranda

different behaviour converting float to integer
        198578 by: Tomas Kuliavas
        198581 by: M. Sokolewicz

How do I know whether PHP is installed as CGI or Apache Module.
        198579 by: Mulley, Nikhil

Re: [PHP-DEV] Re: different behaviour converting float to integer
        198583 by: Derick Rethans

Using php4 AND php5
        198584 by: Dobermann

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Teng Wang wrote:
> Although I have included charset (GB2312) information in my
> html/php files.
>
> <meta http-equiv=Content-Type content="text/html;
> charset=gb2312">
>
> And my browser has "Auto-select" settings.
> How to make the browser select charset correctly,

W3C:

Conforming user agents must observe the following priorities when
determining a document's character encoding (from highest priority to
lowest):

    1. An HTTP "charset" parameter in a "Content-Type" field.
    2. A META declaration with "http-equiv" set to "Content-Type" and a
value set for "charset".
    3. The charset attribute set on an element that designates an
external resource.

In addition to this list of priorities, the user agent may use
heuristics and user settings. For example, many user agents use a
heuristic to distinguish the various encodings used for Japanese text.
Also, user agents typically have a user-definable, local default
character encoding which they apply in the absence of other indicators.

========
So the solution should be:

header('Content-Type: text/html; charset=gb2312');

attached mail follows:


hi there

I'm parsing xml documents with php4's DOM extension and I would like to
be able to see what namespaces are in the document. Is there any way
to get at the xmlns attributes? Or a way to get the namespace of a
node (not just the prefix).

thanks

-jachin

attached mail follows:


Hi,Marek Kilimajer£º

I had to test each module. That's why I said it's too
complicated (sorrry for the typo). Is there any script to
test it automatically?

                            Teng Wang
                            2004/10/03
                                                        19:57:23
>At Mon, 04 Oct 2004 01:37:38 +0200 £¬You wrote:
> Teng Wang wrote:
> > Finally I succeeded on the installation. Just manually add
> > all --with-EXTENSIONS and remove all unvailable ones. The
> > procedure is too completed. I hope there should be some
> > scripts which automatically check the availability of each
> > extension and generate the configuration file.
> >
> > Anyway, thanks a lot to all warm-hearted experts!
> >
> > Eruisi
> >
>
> You mean something like --enable-all. But then you would not know which
> extensions are installed and which are not.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

*****************************************
* Teng Wang
*
* Univ. of Mass. Amherst
* ECE Department
* USA
*
* (Lab)1-413-545-0923
* (E-mail)twangustc.edu
*****************************************
¡¡

attached mail follows:


On October 3, 2004 12:46, Olaf van der Spek wrote:
> Manuel Lemos wrote:
> > Hello,
> >
> > On 10/03/2004 12:27 PM, Olaf Van Der Spek wrote:
> >>> I think that making all failed memory allocations recoverable is not
> >>> viable because more PHP C code that makes memory allocations assumes
> >>> it only returns if it succeeds. Trying to change that everywhere
> >>> memory is allocated is and monster job that I doubt that any PHP core
> >>> developer will agree on doing.
> >>
> >> You could just create a new function for that: alloc_no_exception
> >> There's no need to change every call, you'd only need to change the
> >> calls that can take a NULL result.
> >
> > I find it hard to justify such function
>
> Why?
> I think a large number of data handling functions would benefit from
> such a function.
> And it'd make PHP more robust.

Olaf, PHP is an open source language is it not?  Since you're so smart why
don't YOU write the code?
--
Regards,
David Bevan

http://www.getanyideas.com

attached mail follows:


David Bevan wrote:
> On October 3, 2004 12:46, Olaf van der Spek wrote:
>
>>Manuel Lemos wrote:
>>
>>>Hello,
>>>
>>>On 10/03/2004 12:27 PM, Olaf Van Der Spek wrote:
>>>
>>>>>I think that making all failed memory allocations recoverable is not
>>>>>viable because more PHP C code that makes memory allocations assumes
>>>>>it only returns if it succeeds. Trying to change that everywhere
>>>>>memory is allocated is and monster job that I doubt that any PHP core
>>>>>developer will agree on doing.
>>>>
>>>>You could just create a new function for that: alloc_no_exception
>>>>There's no need to change every call, you'd only need to change the
>>>>calls that can take a NULL result.
>>>
>>>I find it hard to justify such function
>>
>>Why?
>>I think a large number of data handling functions would benefit from
>>such a function.
>>And it'd make PHP more robust.
>
>
> Olaf, PHP is an open source language is it not? Since you're so smart why
> don't YOU write the code?

Because I don't have time to fix every bug (I encounter) in every open
source app I use.
And I don't know the internals of the PHP code to be sure my patch works
and doesn't break anything else.

attached mail follows:


On 10/3/2004 4:02 PM Matthew Fonda wrote:
> Howdy,
>
> I noticed that quite a few people were having a hard time installing PHP
> on Fedora Core or Redhat, so I put together a little tutorial explaining
> how to do it. Hope it helps :D
> http://mfonda.dotgeek.org/fcrh.php

I'm not complaining about any tutorials, but this doesn't quite fit
with my experience. I installed FC2 (not an upgrade). I then ran
phpinfo() to get the configure options for the installed PHP. I used
those options to configure PHP5. After running make and make install,
I edited "/etc/httpd/conf.d/php.ini" to change the LoadModule line.

I believe I also needed to remove the domxml.ini file from /etc/php.d.
I may have also needed to more some other files around.

My point isn't to provide another tutorial, but to say that a PHP and
linux newbie (me) can install PHP5 without also installing Apache. I
am inexperienced with Apache and PHP, so I'm not claiming it is
*better* not to re-install Apache, just that it isn't necessary under FC2.

attached mail follows:


Im trying to output a pdf over a browser so i can hide the url link to
it. but this one causes corruption.

Try this..
http://dev.axishift.com/php/getpdf.php

i got this part..
"Note: There is a bug in Microsoft Internet Explorer 4.01 that
prevents this from working. There is no workaround. There is also a
bug in Microsoft Internet Explorer 5.5 that interferes with this,
which can be resolved by upgrading to Service Pack 2 or later. "

but im using netscape, and it still has error.

here's the basic source for it..

<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('original.pdf');
?>

what other alternatives can you suggest? i need this asap! please help.

--
Louie Miranda
http://www.axishift.com

attached mail follows:


this is one problem i haven't seen some exact solutions.

i tried this instead..

header("Content-type: application/pdf");
header("Content-transfer-encoding: binary");
header("Content-Disposition: attachment; filename=list.pdf");
$fp = fopen($WCFPriceList, "rb");
fpassthru($fp);

and it did work. but im still waiting for other people's comment.

On Mon, 4 Oct 2004 09:24:33 +0800, Louie Miranda <lmirandagmail.com> wrote:
> Im trying to output a pdf over a browser so i can hide the url link to
> it. but this one causes corruption.
>
> Try this..
> http://dev.axishift.com/php/getpdf.php
>
> i got this part..
> "Note: There is a bug in Microsoft Internet Explorer 4.01 that
> prevents this from working. There is no workaround. There is also a
> bug in Microsoft Internet Explorer 5.5 that interferes with this,
> which can be resolved by upgrading to Service Pack 2 or later. "
>
> but im using netscape, and it still has error.
>
> here's the basic source for it..
>
> <?php
> // We'll be outputting a PDF
> header('Content-type: application/pdf');
>
> // It will be called downloaded.pdf
> header('Content-Disposition: attachment; filename="downloaded.pdf"');
>
> // The PDF source is in original.pdf
> readfile('original.pdf');
> ?>
>
> what other alternatives can you suggest? i need this asap! please help.
>
> --
> Louie Miranda
> http://www.axishift.com
>

--
Louie Miranda
http://www.axishift.com

attached mail follows:


Louie Miranda wrote:
> Im trying to output a pdf over a browser so i can hide the url link to
> it. but this one causes corruption.
>
> Try this..
> http://dev.axishift.com/php/getpdf.php
>
> i got this part..
> "Note: There is a bug in Microsoft Internet Explorer 4.01 that
> prevents this from working. There is no workaround. There is also a
> bug in Microsoft Internet Explorer 5.5 that interferes with this,
> which can be resolved by upgrading to Service Pack 2 or later. "
>
> but im using netscape, and it still has error.
>
> here's the basic source for it..
>
> <?php
> // We'll be outputting a PDF
> header('Content-type: application/pdf');
>
> // It will be called downloaded.pdf
> header('Content-Disposition: attachment; filename="downloaded.pdf"');
>
> // The PDF source is in original.pdf
> readfile('original.pdf');
> ?>
>
> what other alternatives can you suggest? i need this asap! please help.
>
Are you sure that you don't have any whitespace before or after the PHP
tags? Try using exit(); after readfile();

attached mail follows:


I'm writing a file-download system. In order to download, the user will
have to login with username and password. Now, how do I feed the file to
the user if it's not under htdocs? Or should the files be under htdocs
(in subdirs of course) and have some .htaccess limitations?

There is a chance that some files can be several gigs big. Will this be
a problem?

//Simon

attached mail follows:


Hi,
Simon Fredriksson wrote:

> I'm writing a file-download system. In order to download, the user
> will have to login with username and password. Now, how do I feed the
> file to the user if it's not under htdocs? Or should the files be
> under htdocs (in subdirs of course) and have some .htaccess limitations?

This topic is often discusses in this board and you will find tons of
solutions in the archives. In short all you need to do is open the file,
read it's contents and write it to the output stream - of course you
will need to send the correct headers first.

>
> There is a chance that some files can be several gigs big. Will this
> be a problem?

no.

>
> //Simon
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


Hi, im fairly new to php and mysql and need a little help. im running a
forum community and would like to have it run on multiple databases because
of performance issues others have encountered using the same software on on
database. My question is is it possible to have the software connect to 2
different databases depending on which is needed? and if so will users need
to login again when accessing the second database (their user info will only
be on the second database.) Thank You

attached mail follows:


Matthew wrote:
> Hi, im fairly new to php and mysql and need a little help. im running a
> forum community and would like to have it run on multiple databases because
> of performance issues others have encountered using the same software on on
> database. My question is is it possible to have the software connect to 2
> different databases depending on which is needed? and if so will users need
> to login again when accessing the second database (their user info will only
> be on the second database.) Thank You
Users shouldn't have to log in, the whole process should be transparent.

But how, that would depend on what data you want to get from where, (I
gather the 2nd db would be on a different machine?). You'll usually have
to edit the files to get something like that done =/

- Tularis

attached mail follows:


Hi,

On Monday 04 October 2004 12:09, Matthew wrote:
> Hi, im fairly new to php and mysql and need a little help. im
> running a forum community and would like to have it run on
> multiple databases because of performance issues others have
> encountered using the same software on on database. My
> question is is it possible to have the software connect to 2
> different databases depending on which is needed?

Yes.

> and if so
> will users need to login again when accessing the second
> database (their user info will only be on the second
> database.)

No. As have been mentioned, this should be transparent. In other
words, (in a sense) your *scripts* logs in to the database and
not you nor your users :)

> Thank You

HTH,

--
- E - copperwalls was here ;)

attached mail follows:


the percent of 20% is = .20 right?
how can i compute the correct value for this?

my $totalCost is $4,000 and when i compute it to .20 using this method..

$shippingestimate = $totalCost * .20;

i get the value for the shippingestimate = $0.8 which is wrong.. it should $800
what seems to be wrong?

--
Louie Miranda
http://www.axishift.com

attached mail follows:


On Monday 04 October 2004 15:26, Louie Miranda wrote:
> the percent of 20% is = .20 right?

'don't know what's "the pecent of 20% is" ;) but in decimal
form, yes, it's right. Or, just ".2" or "0.2".

> how can i compute the correct value for this?
>
> my $totalCost is $4,000 and when i compute it to .20 using
> this method..
>
> $shippingestimate = $totalCost * .20;
>
> i get the value for the shippingestimate = $0.8 which is
> wrong.. it should $800 what seems to be wrong?

Formatting problem, most likely. Try this:

<?php

$totalCost = 4000;
$shippingEstimate = $totalCost * 0.2;

echo $shippingEstimate;

?>

* I changed the "E" on $shippingEstimate on purpose :)

--
- E - copperwalls was here ;)

attached mail follows:


Howdy.

It seems to work fine for me, perhaps you have a typo along the lines
some where.

<?php
$totalCost = 4000;
$shippingestimate = $totalCost * .20;
echo $shippingestimate;
?>

echoes 800

--
Regards,
Matthew Fonda

On Sun, 2004-10-03 at 23:26, Louie Miranda wrote:
> the percent of 20% is = .20 right?
> how can i compute the correct value for this?
>
> my $totalCost is $4,000 and when i compute it to .20 using this method..
>
> $shippingestimate = $totalCost * .20;
>
> i get the value for the shippingestimate = $0.8 which is wrong.. it should $800
> what seems to be wrong?
>
> --
> Louie Miranda
> http://www.axishift.com

attached mail follows:


i found the culprit. i remembered, that i use to pass the value with..

number_format($totalCost, 2, ".", ",")

so the values being received by my computation has a "," comma 4,000
so that is why i always get wrong values.

thanks again!

On Mon, 04 Oct 2004 00:02:32 -0700, Matthew Fonda <mfondadotgeek.org> wrote:
> Howdy.
>
> It seems to work fine for me, perhaps you have a typo along the lines
> some where.
>
> <?php
> $totalCost = 4000;
> $shippingestimate = $totalCost * .20;
> echo $shippingestimate;
> ?>
>
> echoes 800
>
> --
> Regards,
> Matthew Fonda
>
>
>
> On Sun, 2004-10-03 at 23:26, Louie Miranda wrote:
> > the percent of 20% is = .20 right?
> > how can i compute the correct value for this?
> >
> > my $totalCost is $4,000 and when i compute it to .20 using this method..
> >
> > $shippingestimate = $totalCost * .20;
> >
> > i get the value for the shippingestimate = $0.8 which is wrong.. it should $800
> > what seems to be wrong?
> >
> > --
> > Louie Miranda
> > http://www.axishift.com
>
>

--
Louie Miranda
http://www.axishift.com

attached mail follows:


When php 5.0.2 converts float to integer, it uses biggest possible integer
value. Other php versions overflow and use negalive integers.

How to reproduce it:
echo (int)0xde120495;

Expected result (php 5.0.1, 4.3.9 and 4.1.2):
----------------
-569244523

Actual result (only php 5.0.2):
--------------
2147483647

Is this a standard behaviour of all future php versions or some error in php?

OS details: Linux Debian Sarge

PHP compilation details (vanilla php-5.0.2.tar.bz2):
./configure --disable-debug --with-apxs=/somepath/apache/bin/apxs
--prefix=/somepath/php
--with-config-file-path=/somepath/
--with-pcre-regex --enable-mbstring --enable-session --disable-all
--with-gettext=shared,/usr

php.ini details:
error_reporting=E_ALL
display_errors=on
register_globals=off
asp_tags=on
short_tags=off

Please CC to my email.
--
Tomas

attached mail follows:


You might want to ask this on the internals list (cc'd)

Tomas Kuliavas wrote:
> When php 5.0.2 converts float to integer, it uses biggest possible integer
> value. Other php versions overflow and use negalive integers.
>
> How to reproduce it:
> echo (int)0xde120495;
>
> Expected result (php 5.0.1, 4.3.9 and 4.1.2):
> ----------------
> -569244523
>
> Actual result (only php 5.0.2):
> --------------
> 2147483647
>
> Is this a standard behaviour of all future php versions or some error in php?
>
> OS details: Linux Debian Sarge
>
> PHP compilation details (vanilla php-5.0.2.tar.bz2):
> ./configure --disable-debug --with-apxs=/somepath/apache/bin/apxs
> --prefix=/somepath/php
> --with-config-file-path=/somepath/
> --with-pcre-regex --enable-mbstring --enable-session --disable-all
> --with-gettext=shared,/usr
>
> php.ini details:
> error_reporting=E_ALL
> display_errors=on
> register_globals=off
> asp_tags=on
> short_tags=off
>
> Please CC to my email.

attached mail follows:


Hi All,
 
Is there any way out finding ,How do the PHP is installed ,whether as Apache Module or CGI.
 
Thanks,
Nikhil.

attached mail follows:


On Mon, 4 Oct 2004, M. Sokolewicz wrote:

> You might want to ask this on the internals list (cc'd)
>
> Tomas Kuliavas wrote:
> > When php 5.0.2 converts float to integer, it uses biggest possible integer
> > value. Other php versions overflow and use negalive integers.

There is already a bug report for it, no need to continue this
discussion.

Derick

--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

attached mail follows:


Hi all,

I'd like to know how to install both php 4 and 5 on the same server,
for example with .php4 and .php5 extensions.

I tried editing some part of the source code to change the way Apache
calls php (with application/x-httpd types) but I never get apache to
start :(

I heard about compiling one version as module and the other as cgi but
did not try myself...

If anybody has an idea... :)

Thanks
dob