givanz / Vvveb

Powerful and easy to use cms to build websites, blogs or ecommerce stores.
https://www.vvveb.com
GNU Affero General Public License v3.0
239 stars 49 forks source link

Got Internal Server Error 500 on my first login. #105

Closed nwkyz closed 3 months ago

nwkyz commented 3 months ago

I am totally a newbie to vvveb and php, I wanna install vvveb on ubuntu 22.04. I installed xampp and put all the vvveb files into xampp's /opt/lampp/htdocs folder and opened 'localhost/index.php', installed vvveb and got this (I created a blank database in xampp named vvvebcms and used for installation): 截图 2024-03-30 00-00-00

This is the message showed on the dashboard:

FUNCTION vvvebcms.JSON_ARRAYAGG does not exist
SELECT  pd.*,products.*, products.product_id as array_key

                ,(SELECT JSON_ARRAYAGG( JSON_OBJECT('id', pi.product_image_id, 'image', pi.image) ) 
                FROM product_image as pi WHERE pi.product_id = products.product_id GROUP BY pi.product_id) as images

        FROM product AS products

            LEFT JOIN product_to_site p2s ON (products.product_id = p2s.product_id) 
            LEFT JOIN product_content pd ON (
                products.product_id = pd.product_id

                    AND pd.language_id = 1

            )  

            WHERE p2s.site_id = 1

            ORDER BY products.product_id DESC
        LIMIT 0, 4
 - SELECT  pd.*,products.*, products.product_id as array_key

                ,(SELECT JSON_ARRAYAGG( JSON_OBJECT('id', pi.product_image_id, 'image', pi.image) ) 
                FROM product_image as pi WHERE pi.product_id = products.product_id GROUP BY pi.product_id) as images

        FROM product AS products

            LEFT JOIN product_to_site p2s ON (products.product_id = p2s.product_id) 
            LEFT JOIN product_content pd ON (
                products.product_id = pd.product_id

                    AND pd.language_id = :language_id

            )  

            WHERE p2s.site_id = :site_id

            ORDER BY products.product_id DESC
        LIMIT :start, :limit

/opt/lampp/htdocs/system/db/mysqli.php on line 303 Code throw new \Exception($message, $e->getCode()); // <==

list($parameters, $types) = $this->paramsToQmark($sql, $params, $paramTypes);

        try {

            $stmt = self::$link->prepare($sql);

        } catch (\mysqli_sql_exception $e) {

            $message = $e->getMessage() . "\n" . $this->debugSql($origSql, $params, $paramTypes) . "\n - " . $origSql;

            throw new \Exception($message, $e->getCode());   // <==

        }

        if ($stmt && ! empty($types)) {

            array_unshift($parameters, $types);

            //hack for php 7.x bind_param "expected to be a reference, value given" stupid warning

Trace

#0 /opt/lampp/htdocs/storage/model/admin/productsql.mysqli.php(5896): Vvveb\System\Db\Mysqli->execute('SELECT  pd.*,pr...', Array, Array)
#1 /opt/lampp/htdocs/admin/component/products.php(52): Vvveb\Sql\ProductSQL->getAll(Array)
#2 /opt/lampp/htdocs/system/component/component.php(226): Vvveb\Component\Products->results()
#3 /opt/lampp/htdocs/system/component/component.php(96): Vvveb\System\Component\Component->loadComponents()
#4 /opt/lampp/htdocs/system/component/component.php(63): Vvveb\System\Component\Component->__construct(Object(Vvveb\System\Core\View), false, NULL)
#5 /opt/lampp/htdocs/system/core/view.php(345): Vvveb\System\Component\Component::getInstance(Object(Vvveb\System\Core\View), false, NULL)
#6 /opt/lampp/htdocs/system/core/response.php(102): Vvveb\System\Core\View->render()
#7 /opt/lampp/htdocs/system/core/frontcontroller.php(251): Vvveb\System\Core\Response->output()
#8 /opt/lampp/htdocs/system/core/frontcontroller.php(298): Vvveb\System\Core\FrontController::call('Vvveb\\Controlle...', 'index', '/opt/lampp/htdo...')
#9 /opt/lampp/htdocs/system/core/frontcontroller.php(364): Vvveb\System\Core\FrontController::redirect('Index', 'index')
#10 /opt/lampp/htdocs/system/core/startup.php(366): Vvveb\System\Core\FrontController::dispatch()
#11 /opt/lampp/htdocs/index.php(138): Vvveb\System\Core\start()
#12 /opt/lampp/htdocs/admin/index.php(41): include('/opt/lampp/htdo...')
#13 {main}

Is there any solutions? Thanks very much.

givanz commented 3 months ago

JSON_ARRAYAGG was added in MySQL version 5.7.22 and in MariaDB version 10.5.0

The latest Xampp version has MariaDB 10.4.32

You can stop Mysql/MariadBD from Xampp and install the latest version of MariaDB https://mariadb.org/download/ and use it instead of the one shipped with Xampp.

nwkyz commented 3 months ago

I downloaded the newer version of MariaDB but I don't know how to replace the old version in xampp, either directly copy and replacing in /opt/lampp folder or install the deb version for ubuntu got the same error below: 截图 2024-03-30 11-07-05

Is there some solutions? Thanks again.

givanz commented 3 months ago

To use phpmyadmin with the new database you need to update

$dbuser='root';
$dbpass='password';

in C:/xampp/phpMyAdmin/config-db.php

To reinstall Vvveb using the new database just remove /config/db.php

nwkyz commented 3 months ago

Uh, on Ubuntu it doesn't work, but I tried directly manually configure on MySQL 8.0-36 on my host machine and it works now. Probably the MariaDB version in Xampp is too old. Solved, thanks.