Results 1 to 4 of 4

Thread: suppressing warnings?

  1. #1
    Join Date
    Apr 2004
    Posts
    4,811
    Rep Power
    0

    Default suppressing warnings?

    Is there a way to suppress warnings that php spits out. I wrote a script that is suppose to open a socket and when it doesn't it will say "Connection failed!!"

    e.g.
    <?php

    $conn = fsockopen("192.168.0.1","5083")
    if (!$conn) {
    echo 'Connection Failed!!';
    }

    ?>

    I want the connection to fail seeing it's just a test. But php prints out it's warning + mine. So the question again is can i suppress the php wanrings??

  2. #2
    Join Date
    Jul 2002
    Posts
    818
    Rep Power
    0

    Default Re: suppressing warnings?

    Placing a '@' at the begining of the line with the probable error will supress PHP's message.

    @$conn = fsockopen("192.168.0.1","5083") ;
    -I didn't spel chek.
    The stuff I do

  3. #3
    Join Date
    Apr 2004
    Posts
    4,811
    Rep Power
    0

    Default Re: suppressing warnings?

    ahhh yes, respect Cknight.... death_knight u nuh have not a use!!

  4. #4
    Join Date
    Jun 2004
    Posts
    296
    Rep Power
    0

    Default

    you could also turn of displaying of warnings in php.ini to affect all pages, or also you could use functions ini_set or error_reporting to affect just one page that you are working with.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •