amnuts / opcache-gui

A clean, effective and responsive interface for Zend OPcache
1.21k stars 197 forks source link

array_merge(): Argument #1 is not an array #37

Closed df1paw closed 5 years ago

df1paw commented 5 years ago

Hi.

I currently experience the following error: Warning: array_merge(): Argument #1 is not an array in /homepages/[....]/opcache.php on line 198

And no data is shown on the dashboard

Any ideas?

Kind regards, Andreas

amnuts commented 5 years ago

Hi, thanks for getting in touch.

It sounds like it can't get some of the information required from opcache, or it's not coming back as an array. If you check the values (var_dump them or something) for $status['memory_usage'] and $status['opcache_statistics'] just before the $overview = array_merge( line then you should see if you're actually getting any info back. Depending on what that is it may affect how you handle things.

Andy

ArturNadolski commented 5 years ago

Same error at my site. $status['memory_usage'] and $status['opcache_statistics'] are NULL.

I think it's Apache/PHP configuration issue not the script.

> php --ri 'Zend OPcache'

Zend OPcache

Opcode Caching => Up and Running
Optimization => Enabled
SHM Cache => Disabled
File Cache => Enabled
Startup => OK

When I dump opcache_get_status() I'm getting: ["opcache_enabled"]=> bool(false) The problem appeared just after switching from PHP5.6 to PHP7.2.

amnuts commented 5 years ago

Thanks for the detailed feedback! This script should handle these kinds of issues without throwing errors, so I'll look into it soon.

df1paw commented 5 years ago

Hi. I'm using the latest version from here. I just changed opcache.file_cache_only=1; to =0 in my php.ini -> seems to work now ;-)

Regards, Andreas

ArturNadolski commented 5 years ago

Just checked what df1paw found and I can confirm it. It's working when "file cache only" option is disabled. So this is only workaround not final solution.

amnuts commented 5 years ago

Unfortunately, the opcache_get_statistics returns very, very little information when the file_cache_only setting it 1, which leaves the gui basically just displaying the opcache settings and the links to the functions. If this ever changes then I'll update the code, but there's little I can do with this right now other than making it not break if you have the setting to 1.

Sorry it took a while!