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:
        [EMAIL PROTECTED]

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

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


----------------------------------------------------------------------
--- Begin Message ---

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!~

--- End Message ---
--- Begin Message ---
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/

--- End Message ---
--- Begin Message --- 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

--- End Message ---
--- Begin Message ---
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
[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 ---
*sigh* 
http://www.google.com/search?hl=en&q=PHP+format+double+as+money&btnG=Search

On 5/5/07, Larry Garfield <[EMAIL PROTECTED]> 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
[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

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



--- End Message ---
--- Begin Message ---
I'd use number_format, money_format is OS dependent.

-- 
itoctopus - http://www.itoctopus.com
"Todd Cary" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>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 

--- End Message ---
--- Begin Message ---
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:[EMAIL PROTECTED] 
Sent: Saturday, May 05, 2007 23:58
To: [EMAIL PROTECTED]
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      = '[EMAIL PROTECTED]';
> $subject = 'the subject';
> $message = 'hello.......';
> $headers = 'From: [EMAIL PROTECTED]' . "\r\n" .
>     'Reply-To: [EMAIL PROTECTED]' . "\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

--- End Message ---
--- Begin Message ---
On 5/6/07, Andy B. <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
Sent: Saturday, May 05, 2007 23:58
To: [EMAIL PROTECTED]
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      = '[EMAIL PROTECTED]';
> $subject = 'the subject';
> $message = 'hello.......';
> $headers = 'From: [EMAIL PROTECTED]' . "\r\n" .
>     'Reply-To: [EMAIL PROTECTED]' . "\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



--- End Message ---
--- Begin Message --- 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

--- End Message ---

Reply via email to