Solved

php Error Reporting

Posted on 2014-02-26
24
417 Views
Last Modified: 2014-02-27
I am in the process of moving a large & complex site from another hosting company to GoDaddy. Yesterday, I was able to get it basically working; there was an issue with php generated emails, but for the most part, it worked.

Today, it behaves quite differently. Now, it is reporting php Warning errors, which I DO NOT want.

See attached jpg for example.

The GoDaddy people are clueless about this, so it occurred to me to change the php error reporting level. There was already a php.ini file there, I added the error_reporting parameter (see attached).

I Still get the same thing.

How can I suppress the php WARNING errors but keep the others?

Thanks
LSS-Menu.jpg
php.ini
0
Comment
Question by:Richard Korts
  • 11
  • 7
  • 3
  • +1
24 Comments
 
LVL 35

Accepted Solution

by:
Kimputer earned 250 total points
ID: 39889262
if the server allows you to use php.ini, adding this is already enough:

date.timezone = "US/Central"
Correct allowed time zone strings are here: http://www.php.net/manual/en/timezones.php

If php.ini editing is not allowed, in the php file add

date_default_timezone_set('America/New_York');

Again, use same link for correct strings.
0
 

Author Comment

by:Richard Korts
ID: 39889297
To Kimputer

The example I showed dealt with the php date() function; there are HUNDREDS of other Warning error messages.

I want to TURN OFF all warning messages.
0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39889332
php.ini:


display_errors = off
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39889348
The GoDaddy people are clueless...
And that is exactly why I do not recommend GoDaddy hosting.  The only time you need an interaction with a smart person at a hosting company is when things go wrong.  As you have seen, you cannot get this interaction at GoDaddy.

You never want to suppress the error messages.  Instead the right thing is to find out what is causing them and correct the underlying causes.  In this case, you've got a good answer to the date/timezone issue.

In a deployed application, a reasonable setting might include error_reporting(E_ALL) combined with ini_set('display_errors', FALSE) and ini_set('log_errors', TRUE). This would give you a record of the errors without showing them to the client browser.  If the error_log file appears in any of your directories, you can look at it and find out what went wrong.
0
 

Author Comment

by:Richard Korts
ID: 39889421
Ray,

I applied your recommended settings to the php.ini file.

See attached.

I uploaded the file to the root folder of my account.

It still does the same thing.

What did I do wrong?
php.ini
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39889466
It isn't just Godaddy, most 'tech support' people are 'clueless'... because they are told not to help you with programming because it takes Way too much time.  

Last time I checked, on Godaddy you needed to name your added 'php.ini' as 'php5.ini'.  And even that Only works on Linux hosting on Godaddy.  If you try to add a 'php.ini' file on Windows hosting, you have to add the Entire file... which of course is not available.

Also, I know that Godaddy is only up to PHP 5.3.  If you try to move the site to 'better hosting' with PHP 5.4 or 5.5, you will see some of those warnings become errors.  Always better to fix the errors and warnings before they become more difficult later.
0
 

Author Comment

by:Richard Korts
ID: 39889491
To Dave Baldwin,

I saved the ini file as php5.ini & uploaded it.

Nothing changed, same Warning errors.

There must be something wrong with the error reporting lines in the ini file.

Thanks
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 125 total points
ID: 39889548
Run 'phpinfo()' on that hosting and see what it says.  I am not having these problems on my Linux and Windows accounts on Godaddy.  You will have to fix the 'date' problem to make it go away.  I don't believe there is any 'error' setting that will make that one disappear.  

What are some of the other warning and errors?
0
 

Author Comment

by:Richard Korts
ID: 39889604
It says error_reporting no value.

The current host is 1 & 1; the attached is a piece of the phpinfo there.

Note is says error_reporting 30719. What does that mean? Can I just say (in php.ini "error_reporting = 30719"?

I didn't look far enough, but, so far, the only other errors SEEM to be related to the timezone nonsense. For example:

Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone.
settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/rkorts1/public_html/schedappt2.php on line 88
0
 

Author Comment

by:Richard Korts
ID: 39889613
I forgot to attach.
error-rpt-1and1.jpg
0
 

Author Comment

by:Richard Korts
ID: 39889628
To all,

I changed the php.ini file to the attached; note the inclusion of the recommended date.timezone parameter, I saved this BOTH as php.ini and php5.ini.

The same problem still persists.

Is there something wrong with the php.ini?

Do I have to do something differently?

Thanks
php.ini
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39889712
Yes, you really need to move away from 1and1 hosting.  I just went to check a file on the only client account I have there... and instead of '404 Not Found', it put up an advertisement for Other Web sites.  Frankly 1and1 makes Godaddy look very good.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:Richard Korts
ID: 39889722
Yes, that's why I picked them, contrary to what some people say, before this fiasco, I have found their customer support to be EXCELLENT.

But I really need to solve the php.ini problem now.

Thanks
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39889752
I don't think it's a 'php.ini' problem.  As I said, I don't believe you can get rid of the 'date' warning without simply fixing the problem.  And you have not posted any other warnings or errors that you are getting.  And by the way, when I checked the 1and1 account, they were still running PHP 4.4.9 which is Way out of date.  If the account you are transferring from was a PHP 4.4.9 account, you may have more surprises to come.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39890343
1and1 makes Godaddy look very good
+1 for that.  Truth.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 125 total points
ID: 39890353
I have only one active site on GoDaddy.  Here is the content of my php5.ini file, which is in the web root directory:
register_globals = off
allow_url_fopen = on

expose_php = Off
max_input_time = 1800
max_execution_time = 1800
variables_order = "EGPCS"
extension_dir = ./

precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

log_errors = On
log_errors_max_len = 1024
error_log = error_log

display_errors = Off

session.bug_compat_warn = Off
session.bug_compat_42 = Off

session.save_path = tmp
upload_tmp_dir = /tmp

magic_quotes_gpc = Off

Open in new window

This INI has the effect of making the error display invisible (it's a deployed application) and writing the error messages to the error_log file.
0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39890381
Please note that not all web hosters allow you to use your own php.ini file
Maybe the other user of GoDaddy just got lucky, and you landed on a server farm which doesn't allow it.
Try to set it during runtime (inside the php files):

error_reporting(0);
0
 

Author Closing Comment

by:Richard Korts
ID: 39890456
FYI, I will try to get GoDaddy to tell me WHY I can't use php.ini (or why it doesn't seem to take effect).
0
 

Author Comment

by:Richard Korts
ID: 39892179
To all:

It turns out that at GoDaddy, the php.ini file has to be called .user.ini (with the leading . like .htaccess

That MAY be just for my plan (Ultimate with Cpanel) because the rep first told me that it had to be php5.ini.

Also, the item date.timezone = "US/Arizona"; does NOT work, maybe the syntax has to be different?

Just FYI.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39892501
Here is the list of supported Time Zones: http://us1.php.net/manual/en/timezones.php  America/Phoenix is probably the only one that works for Arizona since it does not support Daylight Savings Time.
0
 

Author Comment

by:Richard Korts
ID: 39892632
Thanks, Dave.

In the individual php programs, I am using date_default_timezone_set('US/Central');

This works; no errors. I am just going to put this in an include & include it in ALL programs.

Not sure where the "Arizona" came from.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39892682
"US/Central" is listed Only for backwards compatibility.  http://us1.php.net/manual/en/timezones.others.php

You could use "America/Chicago" .  http://us1.php.net/manual/en/timezones.america.php

The 'standard' time zones that you may be thinking of do not correspond to the 'legal' time zones that have been implemented.  Arizona, for example, really does have it's own time zone for Date and Time purposes that is different than it's neighboring states.
0
 

Author Comment

by:Richard Korts
ID: 39893184
Thanks Dave; that may be why it does not work.

But I'm preparing to bail ship at GoDaddy; their support in this case ranges from clueless to trying to be helpful but still not able to resolve issues.

Richard
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39893269
You will not get much help from any hosting company for coding issues.  That's you ask questions here.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now