Answer the question
In order to leave comments, you need to log in
How can I remove the email notification about these errors in a specific PHP file?
Installed Vesta (fresh) on CentOS 7.3.1611 x64
I run a php file in cron and there are some errors and my soap registered in Vesta receives such letters with the header: (Cron Daemon) <[email protected]>
and text:
PHP Notice: Undefined index: SERVER_PROTOCOL in /home/admin/web/my-domen.ru/public_html/file.php on line 21
PHP Notice: Undefined index: SERVER_PROTOCOL in /home/admin/web/my-domen.ru/public_html/file.phpp on line 21
PHP Notice: Undefined index: SERVER_PORT in /home/admin/web/my-domen.ru/public_html/file.php on line 22
PHP Notice: Undefined index: SERVER_PORT in /home/admin/web/my-domen.ru/ public_html/file.php on line 22
PHP Notice: Undefined index: SERVER_NAME in /home/admin/web/my-domen.ru/public_html/file.php on line 24
PHP Notice: Undefined index: REQUEST_URI in /home/admin/web/my-domen.ru/public_html/file.php on line 24
how to remove these notices from this file?
Answer the question
In order to leave comments, you need to log in
Such and such solutions (choose one):
First - remove the error? Well, as an option.
The second is to change the email profile under which the task was created in cron.
Third - click "Turn off notifications" in the panel, in the Cron section.
Judging by the text, the script was not originally intended to be called by a non-Web server, and therefore assumes that the $_SERVER superglobal variable is always set to parameters related to the calling client and the request. To adapt the script, you can go through the lines indicated in the log and replace the text there with:
$_SERVER ["SERVER_PROTOCOL"] with (isset ($_SERVER ["SERVER_PROTOCOL"]) ? $_SERVER ["SERVER_PROTOCOL"] : "http")
$ _SERVER["SERVER_PORT"] to (isset ($_SERVER ["SERVER_PORT"]) ? $_SERVER ["SERVER_PORT"] : 80)
$_SERVER ["SERVER_NAME"] to (isset ($_SERVER ["SERVER_NAME"]) ? $ _SERVER ["SERVER_NAME"] : "example.com")
$_SERVER ["REQUEST_URI"] on (isset ($_SERVER ["
? - this is a ternary operator, to the left of which a boolean expression is indicated, and to the right - variants of the execution result separated by a colon: to the left of the colon is the result issued if the expression evaluates to true, to the right - if false . isset is a function that checks for the presence (in this case) of an element in an array. There is a parameter in the $_SERVER array - we return it. No - we return some convenient default value (you can substitute your own to, for example, catch in the logs).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question