Undefined index error

Undefined index error

by Bill Weinheimer -
Number of replies: 3

I'm running Moodle 1.6 as production server and Certificates have been working fine until this weekend.  On Sunday I added the Certificate module and Activity Locking to what I hope to become my new production version of Moodle running 1.9.4.

I did not work yesterday (Monday) but when I arrived today I find that the 1.6 site was down yesterday.  The config.php file had a trashed top line.  The people on duty restored a backup version of config.php and restored Moodle to operation. 

Now the issue is the Certificates no longer work.  When I try to view a certificate I get the message:

Notice: "Undefined index:p in /srv/www/htdocs/moodle/config.php on line 1"

Warning:  Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/moodle/config.php:l) in /srv/www/htdocs/moodle/lib/fpdf/fpdf.php on line 1022

FPDF error:  Some data has already been output to browser, can't send PDF file

I know someone out there must know what the issue is.  Please help me since my job is on the line.

Thanks,

Bill

Average of ratings: -
In reply to Bill Weinheimer

Re: Undefined index error

by Kaalgat - -
Hi Bill

The server outputs an unnecessary NOTICE which causes the PDF output to fail.

Add this line to the top of config.php (and possibly also fpdf.php):

error_reporting(E_ERROR);

It should instruct the page not to output any NOTICEs.

Kaalgat.

In reply to Kaalgat -

Re: Undefined index error

by Bill Weinheimer -

Thanks Kaalgat, you nailed it.  Everything is working again. 

If you don't mind, do you have any suggestions as to why this started happening all of a sudden?  As I posted before I am getting a new instance of Moodle ready to release to our users but nothing is shared between them as far as I know.  Separate folders, versions of both Moodle and the Certificate mod, separate tables in the mySQL database, etc.

Thanks,

Bill

In reply to Bill Weinheimer

Re: Undefined index error

by Kaalgat - -
Hi Bill

Pleasure.

I think it could be a PHP setting on the server that shows "Notices, Warnings and Errors", instead of just "Errors". An administrator could have changed it, or maybe upgraded the PHP on the server.

For a developent site you would like to also see the warnings, but for a production server you only want to see the errors. The php.ini file on the server has these values available that could be set accordingly:
error_reporting = E_ERROR
display_errors = Off

Or maybe that one line could have been missing from the files that your ISP replaced from the backups.

Kaalgat.