question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CentOS7 - PHP 7.2 - SQLSTATE[HY000]: General error: 1 near "WITH": syntax error

See original GitHub issue

Hey,

I’m not sure how to tackle this one. I’m running an updated CentOS 7 build with PHP 7.2 installed. However, when the loading the root domain for grocy I encounter the following error.

Type: PDOException
Code: HY000
Message: SQLSTATE[HY000]: General error: 1 near "WITH": syntax error
File: /var/www/html/services/DatabaseService.php
Line: 45
Trace

#0 /var/www/html/services/DatabaseService.php(45): PDO->exec('CREATE TABLE re...')
#1 /var/www/html/services/DatabaseMigrationService.php(47): Grocy\Services\DatabaseService->ExecuteDbStatement('CREATE TABLE re...')
#2 /var/www/html/services/DatabaseMigrationService.php(23): Grocy\Services\DatabaseMigrationService->ExecuteSqlMigrationWhenNeeded(43, 'CREATE TABLE re...')
#3 /var/www/html/controllers/LoginController.php(70): Grocy\Services\DatabaseMigrationService->MigrateDatabase()
#4 [internal function]: Grocy\Controllers\LoginController->Root(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#5 /var/www/html/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call_user_func(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#6 /var/www/html/vendor/slim/slim/Slim/Route.php(356): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#7 /var/www/html/middleware/SessionAuthMiddleware.php(26): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#8 [internal function]: Grocy\Middleware\SessionAuthMiddleware->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#9 /var/www/html/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Grocy\Middleware\SessionAuthMiddleware), Array)
#10 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#11 /var/www/html/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#12 /var/www/html/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#13 /var/www/html/vendor/slim/slim/Slim/Route.php(334): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#14 /var/www/html/vendor/slim/slim/Slim/App.php(515): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
#15 /var/www/html/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#16 /var/www/html/vendor/slim/slim/Slim/App.php(406): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#17 /var/www/html/vendor/slim/slim/Slim/App.php(314): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#18 /var/www/html/app.php(71): Slim\App->run()
#19 /var/www/html/public/index.php(3): require_once('/var/www/html/a...')
#20 {main}

Refreshing the page results in a slightly different error that seems to stick. This second error refers to an entry in the database already being there. Looks like fixing the above might fix the latter.

Thanks for any help!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
berrndcommented, Apr 28, 2020

It’s also mentioned in the projects README, but ok, let’s add this to new PrerequisiteChecker (#639), created #805 to track this.

0reactions
bendauphineecommented, Apr 27, 2020

Might be worth adding a prerequisite check script that runs before anything else to make sure the server has the right versions of everything. I’ve run into the same issue, and it took me a few minutes to locate this thread via Google. CentOS 7, SQLite 3.7.17

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQLSTATE[HY000]: General error: 1 near ".": syntax error in
My PHP file looks like this: <?php $statement = "UPDATE `users` SET `users`.`name` = :usersName WHERE ...
Read more >
SQLSTATE[HY000]: General error: 1 near ">": syntax error ...
Once I select a period and click run, I am getting the following mistake: Error: SQLSTATE[HY000]: General error: 1 near ">": syntax error....
Read more >
Microsoft SQL Server and Sybase Functions (PDO_DBLIB)
PDO_DBLIB is a driver that implements the PHP Data Objects (PDO) interface ... spaces were triggering the error "SQLSTATE[HY000] General SQL Server error: ......
Read more >
How to fix InnoDB corruption cases for the MySQL ...
DATABASE ERROR!!! Database psa database found, but version undefined. A table cannot be properly queried with the SELECT statement: select * from db_example ......
Read more >
SQLSTATE[HY000]: General error: 1 near "(": syntax error
I've got "SQLSTATE[HY000]: General error: 1 near "(&q. ... also with PHP 7.2 and 7.3, it really seems like a wrong sqlite3/mysql sql ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found