Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 425945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:25:49+00:00 2026-05-12T19:25:49+00:00

I am getting expected notices and warnings and would like to turn them off

  • 0

I am getting expected notices and warnings and would like to turn them off in my PHP file. The error is:

Warning: fsockopen()

And the notice are:

Notice: A non well formed numeric value encountered in

I am planning to use cron for this PHP script and do not want to get any errors or notices logged anywhere.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:25:50+00:00Added an answer on May 12, 2026 at 7:25 pm

    When you are sure your script is perfectly working, you can get rid of warning and notices like this: Put this line at the beginning of your PHP script:

    error_reporting(E_ERROR);
    

    Before that, when working on your script, I would advise you to properly debug your script so that all notice or warning disappear one by one.

    So you should first set it as verbose as possible with:

    error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
    

    UPDATE: how to log errors instead of displaying them

    As suggested in the comments, the better solution is to log errors into a file so only the PHP developer sees the error messages, not the users.

    A possible implementation is via the .htaccess file, useful if you don’t have access to the php.ini file (source).

    # Suppress PHP errors
    php_flag display_startup_errors off
    php_flag display_errors off
    php_flag html_errors off
    php_value docref_root 0
    php_value docref_ext 0
    
    # Enable PHP error logging
    php_flag  log_errors on
    php_value error_log  /home/path/public_html/domain/PHP_errors.log
    
    # Prevent access to PHP error log
    <Files PHP_errors.log>
     Order allow,deny
     Deny from all
     Satisfy All
    </Files>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting Expected ',' or '{' but found '#44559' error. My code looks like this:
I keep getting an expected identifier error at this line in my code =/
Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
I keep on getting this error error: expected specifier-qualifier-list for core data code im
I am getting this error While running this LoadError: Expected /home/user/Desktop/Tripurari/myapp/app/models/host.rb to define Host##
given the following script <?php ini_set('display_errors','On'); error_reporting(E_ALL); thisisanerror ?> I get the expected Notice:
I am getting Expected declaration specifiers or '...' before string constant error in mach_override.c
I am getting an Expected Identifier error when trying to compile an applet with
Am getting an Expected expression error but can't figure out why on an IBAction
I am having some trouble getting expected results out of the zip command. Cases

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.