[Pushed] Fatal error in archive/global.php
#1
Fatal error: Uncaught Error: Call to undefined function exec() in /home/hlf2/public_html/forum2/archive/global.php:215 Stack trace: #0 /home/hlf2/public_html/forum2/archive/index.php(14): require_once() #1 {main} thrown in /home/hlf2/public_html/forum2/archive/global.php on line 215

Line 215 is
	if($uptime = @exec('uptime'))

I don't believe the function exists. Grep results for "uptime" in distribution files:

.../mybb_1833/Upload$ grep -r "uptime"
archive/global.php:	if($uptime = @exec('uptime'))
archive/global.php:		preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $uptime, $regs);
inc/functions.php:			$load = @exec("uptime");

Fixed with this line 215 in archive/global.php
	if(function_exists('uptime') ? $uptime = @exec('uptime') : false)

More info here. https://bobcares.com/blog/how-to-enable-...n-php-ini/

The exec is an inbuilt PHP function. It replaces a currently running process with the new program. PHP uses the function to execute a program and it returns the last line of the output.

At the same time, the function may be disabled on the server.

The code change detects the function and processes accordingly.
Reply
#2
https://github.com/mybb/mybb/pull/4665
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)