Today I met a problem above:
[03-Nov-2017 19:29:02 Asia/Shanghai] PHP Fatal error: Call to undefined function header() in /www/xxxx/api/login.php on line 5
[03-Nov-2017 19:27:37 Asia/Shanghai] PHP Fatal error: Call to undefined function dirname() in /www/xxxx/index.php on line 9
...
I cannot find the reason and solution. anyone helps me, thanks.
add my code.
<?php
header('Content-type:text/html; charset=utf8');
include_once dirname(__FILE__). '/global.inc.php';
echo 'HELLO WORLD';
this problem happens sometimes and have last for one day, in my online website. what i can do is to reload each 1 hour.
anyone knows how to solve it??? THXTHX
UPDATE: Server Info added: Nginx Server, CentOS release 6.3. PHP Version 5.4.41
What confuse me most is that this problem happened suddenly on my online website with no changes published.
A really wild guess, but these errors could be deceiving you.
[03-Nov-2017 19:29:02 Asia/Shanghai] PHP Fatal error: Call to undefined function header() in /www/xxxx/api/login.php on line 5
[03-Nov-2017 19:27:37 Asia/Shanghai] PHP Fatal error: Call to undefined function dirname() in /www/xxxx/index.php on line 9
What if header() and dirname() contain a leading unicode character that is invisible or was somehow stripped from your log files? They might look like built-in PHP functions, but maybe your code contains special characters either in compiled form, or at runtime. In other words, header() might not be what you think it is. Even though it looks that way in the log.
I suggest a quick review of the following:
Who is writing code and in what editor? Is their editor adding a BOM (Byte Order Marker) to the beginning of each file? If so, don't do that. See: UTF-8 BOM signature in PHP files
Do your PHP files begin with a declare(encoding=...) line? If so, is that correct; i.e., does it match the editor's encoding? Better to exclude this.
Is zend.multibyte enabled in php.ini? If so, does enabling or disabling this make any difference? See: http://php.net/manual/en/ini.core.php#ini.zend.multibyte
Is zend.script_encoding set in php.ini? If so, does changing this improve the situation? See: http://php.net/manual/en/ini.core.php#ini.zend.script-encoding
Is zend.detect-unicode set in php.ini? If so, does changing that improve anything? See: http://php.net/manual/en/ini.core.php#ini.zend.detect-unicode
Are you running an OPcache extension? e.g, APC, Zend Optimizer, the newer built-in OPcache? If so, are these becoming corrupted when you monitor?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With