PHP Error Messages as String in a Variable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Benjamin Dickgießer

    PHP Error Messages as String in a Variable

    Hi,
    Can I put all errors which PHP outputs when error_reporting (E_ALL); is
    activated into a variable? I want to react if an error occurs.
    I'm working on a Script to check if an ftp is running or not. The only way
    to get the error message of the ftp when the connection fails is if
    error_reporting (E_WARNING); or error_reporting (E_ALL); is activated. I want
    to format the Error Message. E.g. The errormessage is:
    Warning: ftp_login() [function.ftp-login]: Sorry, Over 2 connection not
    allow in c:\inetpub\wwwr oot\scripts\vbb _ftp.php on line 13.

    I only want this output: "Status: Sorry, Over 2 connection not allow "
    Thx for your help!
    Benjamin Dickgießer


  • Tom Thackrey

    #2
    Re: PHP Error Messages as String in a Variable


    On 16-Oct-2003, "Benjamin Dickgießer" <Benjamin@dickg iesser.net> wrote:
    [color=blue]
    > Can I put all errors which PHP outputs when error_reporting (E_ALL); is
    > activated into a variable? I want to react if an error occurs.
    > I'm working on a Script to check if an ftp is running or not. The only way
    > to get the error message of the ftp when the connection fails is if
    > error_reporting (E_WARNING); or error_reporting (E_ALL); is activated. I
    > want
    > to format the Error Message. E.g. The errormessage is:
    > Warning: ftp_login() [function.ftp-login]: Sorry, Over 2 connection not
    > allow in c:\inetpub\wwwr oot\scripts\vbb _ftp.php on line 13.[/color]

    You can trap the errors with an error handling function see
    set_errror_hand ler()

    It seems to me that checking the error return from the function would be
    easier.

    --
    Tom Thackrey

    tom (at) creative (dash) light (dot) com
    do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

    Comment

    Working...