Cannot install nextcloud 10, or 11

Yesterday, I had a working installation of owncloud 9 on my private server. I followed the migration to nextcloud 9 steps, and it was all working.

This morning, I decided to kill the installation entirely, and roll a new install of nextcloud 11. I followed the same process as I’ve done installing owncloud. I have shared hosting on a service called hostrocket, with cloudLinux, apache, suPHP, PHP 7, and my SQL. Remember this was successfully running an owncloud instance before.

the nextcloud install simply refuses to run. When I try to access the address: I get a 500 internal server error.

When I SSH into the server and try to run occ I get this:

php occ
An unhandled exception has been thrown:
Error: Call to undefined function OC\Files\json_encode() in /home/techfact/public_html/cloud/lib/private/Files/Filesystem.php:788
Stack trace:
#0 /home/techfact/public_html/cloud/lib/private/Files/Filesystem.php(555): OC\Files\Filesystem::normalizePath('')
#1 /home/techfact/public_html/cloud/lib/private/Files/View.php(106): OC\Files\Filesystem::isValidPath('')
#2 /home/techfact/public_html/cloud/lib/private/Server.php(120): OC\Files\View->__construct()
#3 /home/techfact/public_html/cloud/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#4 /home/techfact/public_html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php(103): Pimple\Container->offsetGet('EncryptionManag...')
#5 /home/techfact/public_html/cloud/lib/private/ServerContainer.php(89): OC\AppFramework\Utility\SimpleContainer->query('EncryptionManag...')
#6 /home/techfact/public_html/cloud/lib/private/Server.php(755): OC\ServerContainer->query('EncryptionManag...')
#7 /home/techfact/public_html/cloud/lib/base.php(853): OC\Server->getEncryptionManager()
#8 /home/techfact/public_html/cloud/lib/base.php(755): OC::registerEncryptionWrapper()
#9 /home/techfact/public_html/cloud/lib/base.php(1074): OC::init()
#10 /home/techfact/public_html/cloud/console.php(56): require_once('/home/techfact/...')
#11 /home/techfact/public_html/cloud/occ(11): require_once('/home/techfact/...')

What could this be?!

Is the php json module installed? Take a look at the requirements:

Wow, you’re right.

I checked my cpanel which can control the PHP modules installed, and JSON is checked! However, I ran this code on a page on my server:

function __fatalHandler()
    $error = error_get_last();
//check if it's a core/fatal error, otherwise it's a normal shutdown
    if ($error !== NULL && in_array($error['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING))) {
        echo "<pre>fatal error:\n";
        echo "</pre>";

$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);


and lo and behold:

fatal error:
    [type] => 1
    [message] => Uncaught Error: Call to undefined function json_encode() in /home/techfact/public_html/cloud/test.php:16
Stack trace:
#0 {main}
    [file] => /home/techfact/public_html/cloud/test.php
    [line] => 16

You were right! But that means my cpanel config is actually not really working… time to talk with my hosting provider :sob:

Wrote to my hosting company - cpanel config had messed up. Reset cpanel and all configurations and now successfully running my nextcloud isntance on PHP 7 / CloudLinux! Huzzah :smile: