CentOS7 - PHP 7.2 - SQLSTATE[HY000]: General error: 1 near "WITH": syntax error
See original GitHub issueHey,
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:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s also mentioned in the projects README, but ok, let’s add this to new PrerequisiteChecker (#639), created #805 to track this.
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