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 6 May 2007 15:33:29 -0000 Issue 4776

php-general-digest-helplists.php.net
Date: Sun May 06 2007 - 10:33:29 CDT


php-general Digest 6 May 2007 15:33:29 -0000 Issue 4776

Topics (messages 254478 through 254486):

Re: Feisty Fawn and apt-get
        254478 by: Mike Shanley

Re: multipart/form-data POST request with empty file part
        254479 by: Manuel Lemos

Best way to format double as money?
        254480 by: Todd Cary
        254481 by: Larry Garfield
        254482 by: heavyccasey.gmail.com
        254485 by: itoctopus

Re: mail() only working with php-cli
        254483 by: Andy B.
        254484 by: Tijnema !

Removing commas from number
        254486 by: Todd Cary

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:


Davi wrote:
> First: use aptitude instead apt-get... =]
> Second: use an debian-list to debian's questions instead an php-list... =]
>
Third: Go Feisty!!!

--
        ~Mike Shanley~

    ~you are almost there~

  ~no, wait. you are there!~

attached mail follows:


Hello,

on 05/04/2007 09:44 AM Emmanuel Raulo-Kumagai said the following:
> Hello
>
> I'm writting a client in PHP for some CMS.
> I need to send an HTTP POST request with a multipart/form-data content.
> One of the parts is a file which must look like the request was issued
> after submitting a web form with a <input type="file" ...> field left
> empty, which is *NOT* the same as sending an empty file.
> This means the part should look like this in the request:
>
> -----------------------------8179530329826\r\n
> Content-Disposition: form-data; name="file"; filename=""\r\n
> Content-Type: application/octet-stream\r\n
> \r\n
> \r\n
> -----------------------------8179530329826\r\n
>
> Is there a way to do so with cURL ?

I use this HTTP client class that implicitly composes HTTP requests like
that when it is used to upload files emulating Web forms.

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

attached mail follows:


I have a MySQL DB that stores currency values as doubles. I want to
display the values in the #,##0.00 format. What is the best way to do that?

Todd

--
Ariste Software
2200 D Street Ext
Petaluma, CA 94952
(707) 773-4523

attached mail follows:


http://www.php.net/money_format

On Saturday 05 May 2007, Todd Cary wrote:
> I have a MySQL DB that stores currency values as doubles. I want to
> display the values in the #,##0.00 format. What is the best way to do
> that?
>
> Todd
>
> --
> Ariste Software
> 2200 D Street Ext
> Petaluma, CA 94952
> (707) 773-4523

--
Larry Garfield AIM: LOLG42
larrygarfieldtech.com 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

attached mail follows:


*sigh* http://www.google.com/search?hl=en&q=PHP+format+double+as+money&btnG=Search

On 5/5/07, Larry Garfield <larrygarfieldtech.com> wrote:
> http://www.php.net/money_format
>
> On Saturday 05 May 2007, Todd Cary wrote:
> > I have a MySQL DB that stores currency values as doubles. I want to
> > display the values in the #,##0.00 format. What is the best way to do
> > that?
> >
> > Todd
> >
> > --
> > Ariste Software
> > 2200 D Street Ext
> > Petaluma, CA 94952
> > (707) 773-4523
>
>
> --
> Larry Garfield AIM: LOLG42
> larrygarfieldtech.com 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I'd use number_format, money_format is OS dependent.

--
itoctopus - http://www.itoctopus.com
"Todd Cary" <toddaristesoftware.com> wrote in message
news:463D5FBE.7070903aristesoftware.com...
>I have a MySQL DB that stores currency values as doubles. I want to
>display the values in the #,##0.00 format. What is the best way to do
>that?
>
> Todd
>
> --
> Ariste Software
> 2200 D Street Ext
> Petaluma, CA 94952
> (707) 773-4523

attached mail follows:


Oliver,

Yes I also analyzed the log files from apache, but all they are telling me
is that I am accesing the file "mail.php" with my browser. Error.log stays
empty.

I wish that it were possible to reproduce an error when accessing mail()
that would somewhat look like this:

"cannot access /usr/sbin/sendmail: permission denied", then at least I know
what needs to be done. However I doubt that my php configuration is
forbidden to access this file.

----
Andy

-----Original Message-----
From: Oliver Block [mailto:listsblock-online.eu]
Sent: Saturday, May 05, 2007 23:58
To: php-generallists.php.net
Cc: Andy B.
Subject: Re: [PHP] mail() only working with php-cli

Hello Andy,

did you take a look into the apache log files?

Regards,

Oliver

Am Samstag, 5. Mai 2007 22:53 schrieb Andy B.:
> Is there any way to debug the mail() function within PHP4 or PHP5?
>
> The following code is not working when called from a browser, but it does
> work from the command line:
>
> <?php
> $to = 'myself.com';
> $subject = 'the subject';
> $message = 'hello.......';
> $headers = 'From: foobar.com' . "\r\n" .
> 'Reply-To: foobar.com' . "\r\n" .
> 'X-Mailer: PHP/' . phpversion();
>
> if(mail($to, $subject, $message, $headers))
> echo "IT WORKED";
> else
> echo "DAMN!!!";
> ?>
>
>
> php and php-cli use the same php.ini file. Php via Apache is launched as a
> module, NOT as CGI!
>
> sendmail_path is correctly set to /usr/sbin/sendmail -t -i
>
> the /var/log/mail.log only shows activity when I try my code via command
> line, so my best guess is that sendmail is never reached when run from the
> browser.
>
> I went a little deeper and modified the sendmail_path to /tmp/test.sh,
> which contains:
>
> #!/bin/bash
> echo "I was used!!" > /tmp/test.log
>
> (chmod 777 /tmp/test.sh)
>
> Again I tried my script from the web and from the command line. Same
> result... command line is fine and generates the test.log file. In the
> browser no log file is created.
>
> I have already made numerous LAMP installations, but I never had this kind
> of mail() issue. This installation is quite simple: standard Apache 2.0
> with php5, php5-mysql, php5-gd, ... This makes it even more frustrating
:-(
>
> What am I missing?
>
> Thanks a lot!!
>
> ----
> Andy

attached mail follows:


On 5/6/07, Andy B. <globihot.lu> wrote:
> Oliver,
>
> Yes I also analyzed the log files from apache, but all they are telling me
> is that I am accesing the file "mail.php" with my browser. Error.log stays
> empty.
>
> I wish that it were possible to reproduce an error when accessing mail()
> that would somewhat look like this:
>
> "cannot access /usr/sbin/sendmail: permission denied", then at least I know
> what needs to be done. However I doubt that my php configuration is
> forbidden to access this file.
>
> ----
> Andy

That isn't very rare, sbin is a folder that only root can
access(atleast that's how it was designed)

Since you can execute the PHP CLI binary, you have SSH access to the machine.
You first should check the permissions of the sendmail binary with
ls -l /usr/sbin/sendmail
and check the output.

If you have access to the root account, then you could also try to su
to the user PHP is running on and then try to access the sendmail
binary.

Tijnema
>
>
> -----Original Message-----
> From: Oliver Block [mailto:listsblock-online.eu]
> Sent: Saturday, May 05, 2007 23:58
> To: php-generallists.php.net
> Cc: Andy B.
> Subject: Re: [PHP] mail() only working with php-cli
>
> Hello Andy,
>
> did you take a look into the apache log files?
>
> Regards,
>
> Oliver
>
>
> Am Samstag, 5. Mai 2007 22:53 schrieb Andy B.:
> > Is there any way to debug the mail() function within PHP4 or PHP5?
> >
> > The following code is not working when called from a browser, but it does
> > work from the command line:
> >
> > <?php
> > $to = 'myself.com';
> > $subject = 'the subject';
> > $message = 'hello.......';
> > $headers = 'From: foobar.com' . "\r\n" .
> > 'Reply-To: foobar.com' . "\r\n" .
> > 'X-Mailer: PHP/' . phpversion();
> >
> > if(mail($to, $subject, $message, $headers))
> > echo "IT WORKED";
> > else
> > echo "DAMN!!!";
> > ?>
> >
> >
> > php and php-cli use the same php.ini file. Php via Apache is launched as a
> > module, NOT as CGI!
> >
> > sendmail_path is correctly set to /usr/sbin/sendmail -t -i
> >
> > the /var/log/mail.log only shows activity when I try my code via command
> > line, so my best guess is that sendmail is never reached when run from the
> > browser.
> >
> > I went a little deeper and modified the sendmail_path to /tmp/test.sh,
> > which contains:
> >
> > #!/bin/bash
> > echo "I was used!!" > /tmp/test.log
> >
> > (chmod 777 /tmp/test.sh)
> >
> > Again I tried my script from the web and from the command line. Same
> > result... command line is fine and generates the test.log file. In the
> > browser no log file is created.
> >
> > I have already made numerous LAMP installations, but I never had this kind
> > of mail() issue. This installation is quite simple: standard Apache 2.0
> > with php5, php5-mysql, php5-gd, ... This makes it even more frustrating
> :-(
> >
> > What am I missing?
> >
> > Thanks a lot!!
> >
> > ----
> > Andy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Thanks to the suggestions, I use number_format($my_number, 2) to format the
number in an edit field. Now I need to reenter it into MySQL. How should I use
preg_replace to remove the commas?

This removes the commas *and* the decimal point:

preg_replace('/\D/', '', $str)

In reviewing patterns, I cannot find the purpose of the "/" character in the above.

Many thanks....

Todd