Open zoltang-cmyk opened 1 year ago
The error messages indicate problems with the database transactions, specifically that there are no active transactions when trying to roll back, and missing tables in the database.
To resolve this issue, try the following steps:
Hi, jweese74,
Thanks for answering so fast! Yes, I realized that I made a mistake at the first install and I wanted to use another existing database (todoapp) to put formtools tables in there. So I deleted everything from this first install attempt, copied the unzipped install files in /home/zg/.local/bin/formtools (here I have to make a note that at the first install attempt I got an error which looked like the script couldn't find __MACOSX directory, so at that time I copied it in the formtools directory, and that seemed to handle that error), I created a new database called formtools and started over the installation from scratch.... Still no success. :(
Here is the config.php settings:
<?php
// main program paths - no trailing slashes! $g_root_url = "http://localhost:8000/formtools"; $g_root_dir = "/home/zg/.local/bin/formtools";
// database settings $g_db_hostname = "localhost"; $g_db_port = "3306"; $g_db_name = "formtools"; $g_db_username = "zg"; $g_db_password = "formtools"; $g_tableprefix = "ft";
?>
Here is the output from the terminal screen:
@.:~/.local/bin$ systemctl start mysql.service @.:~/.local/bin$ systemctl status mysql.service ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset> Active: active (running) since Thu 2023-03-23 11:46:21 PDT; 27s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3986 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (co> Main PID: 4025 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 9058) Memory: 367.7M CPU: 1.408s CGroup: /system.slice/mysql.service └─4025 /usr/sbin/mysqld
Mar 23 11:46:20 zg-ThinkPad-T460 systemd[1]: Starting MySQL Community Server... Mar 23 11:46:21 zg-ThinkPad-T460 systemd[1]: Started MySQL Community Server. lines 1-16/16 (END) ^C @.***:~/.local/bin$ php -S localhost:8000 [Thu Mar 23 11:47:38 2023] PHP 8.1.2-1ubuntu2.11 Development Server (http://localhost:8000) started [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Accepted [Thu Mar 23 11:55:35 2023] PHP Fatal error: Uncaught Error: Call to a member function prepare() on null in /home/zg/.local/bin/formtools/global/code/Database.class.php:71 Stack trace:
FormTools\Database->query()
FormTools\Settings::get()
FormTools\User->__construct()
FormTools\Core::initUser()
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 71 [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 [500]: GET /formtools - Uncaught Error: Call to a member function prepare() on null in /home/zg/.local/bin/formtools/global/code/Database.class.php:71 Stack trace:
FormTools\Database->query()
FormTools\Settings::get()
FormTools\User->__construct()
FormTools\Core::initUser()
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 71 [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Closing
This is a different error than at the first time, and at this time I didn't get any progress in the installation, just a blank page on the browser screen.
On 2023-03-23 05:26, jweese74 wrote:
The error messages indicate problems with the database transactions, specifically that there are no active transactions when trying to roll back, and missing tables in the database.
To resolve this issue, try the following steps:
- Ensure that your MySQL service is running correctly.
- Check your database configuration in the Form Tools installation files. Verify that the database name, username, password, and host are correct.
- Ensure that the user specified in the configuration has proper privileges (CREATE, ALTER, INSERT, UPDATE, DELETE, and SELECT) for the database.
- Clear any previous installations by dropping the database and creating a new one. You can do this using a MySQL client or via the command line. Back up any data you want to save before dropping the database.
- Restart the Form Tools installation process.
-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>
[1] https://github.com/formtools/core/issues/902#issuecomment-1481106182 [2] https://github.com/notifications/unsubscribe-auth/AMOB3RLDZ6UUN2774ZSC6ZLW5Q6O7ANCNFSM6AAAAAAWES3XXQ
The error message Call to a member function prepare() on null indicates that the prepare() function is being called on a null object, which likely means the database connection was not established properly.
To troubleshoot this issue, follow these steps:
Check the global/code/Database.class.php file to make sure the database connection is being established correctly. Look for the constructor function in the Database class (it should look like public function __construct()) and make sure it's using the correct credentials from your config.php file.
Test the database connection manually using a separate PHP script. Create a new PHP file (e.g., test_db_connection.php) with the following content:
<?php
$host = 'localhost'; $port = '3306'; $db_name = 'formtools'; $username = 'zg'; $password = 'formtools';
try { $conn = new PDO("mysql:host=$host;port=$port;dbname=$db_name", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo 'Connected successfully'; } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); }
?>
Run this script using the PHP built-in server (php -S localhost:8000), and access it via your browser at http://localhost:8000/test_db_connection.php. If the connection is successful, you should see "Connected successfully". If not, it will display the error message.
If the connection test is successful, but the Form Tools installation still fails, it's possible that there's an issue with the Form Tools installation files. In this case, try downloading the latest version of Form Tools and repeat the installation process.
If the connection test fails, double-check your database credentials and make sure the MySQL server is running and accepting connections from your localhost.
On Thu, Mar 23, 2023, 10:36 p.m. zoltang-cmyk @.***> wrote:
Hi, jweese74,
Thanks for answering so fast! Yes, I realized that I made a mistake at the first install and I wanted to use another existing database (todoapp) to put formtools tables in there. So I deleted everything from this first install attempt, copied the unzipped install files in /home/zg/.local/bin/formtools (here I have to make a note that at the first install attempt I got an error which looked like the script couldn't find __MACOSX directory, so at that time I copied it in the formtools directory, and that seemed to handle that error), I created a new database called formtools and started over the installation from scratch.... Still no success. :(
Here is the config.php settings:
<?php
// main program paths - no trailing slashes! $g_root_url = "http://localhost:8000/formtools"; $g_root_dir = "/home/zg/.local/bin/formtools";
// database settings $g_db_hostname = "localhost"; $g_db_port = "3306"; $g_db_name = "formtools"; $g_db_username = "zg"; $g_db_password = "formtools"; $g_tableprefix = "ft";
?>
Here is the output from the terminal screen:
@.:~/.local/bin$ systemctl start mysql.service @.:~/.local/bin$ systemctl status mysql.service ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset> Active: active (running) since Thu 2023-03-23 11:46:21 PDT; 27s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3986 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (co> Main PID: 4025 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 9058) Memory: 367.7M CPU: 1.408s CGroup: /system.slice/mysql.service └─4025 /usr/sbin/mysqld
Mar 23 11:46:20 zg-ThinkPad-T460 systemd[1]: Starting MySQL Community Server... Mar 23 11:46:21 zg-ThinkPad-T460 systemd[1]: Started MySQL Community Server. lines 1-16/16 (END) ^C @.***:~/.local/bin$ php -S localhost:8000 [Thu Mar 23 11:47:38 2023] PHP 8.1.2-1ubuntu2.11 Development Server (http://localhost:8000) started [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Accepted [Thu Mar 23 11:55:35 2023] PHP Fatal error: Uncaught Error: Call to a member function prepare() on null in /home/zg/.local/bin/formtools/global/code/Database.class.php:71 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Settings.class.php(87):
FormTools\Database->query()
1 /home/zg/.local/bin/formtools/global/code/User.class.php(50):
FormTools\Settings::get()
2 /home/zg/.local/bin/formtools/global/code/Core.class.php(864):
FormTools\User->__construct()
3 /home/zg/.local/bin/formtools/global/code/Core.class.php(400):
FormTools\Core::initUser()
4 /home/zg/.local/bin/formtools/index.php(16): FormTools\Core::init()
5 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 71 [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 [500]: GET /formtools - Uncaught Error: Call to a member function prepare() on null in /home/zg/.local/bin/formtools/global/code/Database.class.php:71 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Settings.class.php(87):
FormTools\Database->query()
1 /home/zg/.local/bin/formtools/global/code/User.class.php(50):
FormTools\Settings::get()
2 /home/zg/.local/bin/formtools/global/code/Core.class.php(864):
FormTools\User->__construct()
3 /home/zg/.local/bin/formtools/global/code/Core.class.php(400):
FormTools\Core::initUser()
4 /home/zg/.local/bin/formtools/index.php(16): FormTools\Core::init()
5 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 71 [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Closing
This is a different error than at the first time, and at this time I didn't get any progress in the installation, just a blank page on the browser screen.
On 2023-03-23 05:26, jweese74 wrote:
The error messages indicate problems with the database transactions, specifically that there are no active transactions when trying to roll back, and missing tables in the database.
To resolve this issue, try the following steps:
- Ensure that your MySQL service is running correctly.
- Check your database configuration in the Form Tools installation files. Verify that the database name, username, password, and host are correct.
- Ensure that the user specified in the configuration has proper privileges (CREATE, ALTER, INSERT, UPDATE, DELETE, and SELECT) for the database.
- Clear any previous installations by dropping the database and creating a new one. You can do this using a MySQL client or via the command line. Back up any data you want to save before dropping the database.
- Restart the Form Tools installation process.
-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>
Links:
[1] https://github.com/formtools/core/issues/902#issuecomment-1481106182 [2]
https://github.com/notifications/unsubscribe-auth/AMOB3RLDZ6UUN2774ZSC6ZLW5Q6O7ANCNFSM6AAAAAAWES3XXQ
— Reply to this email directly, view it on GitHub https://github.com/formtools/core/issues/902#issuecomment-1482169283, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACED2LVGCA65DNQ6ZHEYPHDW5UCCVANCNFSM6AAAAAAWES3XXQ . You are receiving this because you commented.Message ID: @.***>
I searched the global/code/Database.class.php file for "__construct(" and there is only one instance of it in line 27, however my programming abilities are not enough to check if it's using the correct credentials from the config.php file or not. If you give me instructions what code should I insert in there (or at line 71 where I get the error at installation) then I can do that.
However I created the "test_db_connection.php" program and ran it from the browser and it ran successfully:
@.:~/programming/books/PHP_MySQL/test_pgms$ systemctl start mysql.service @.:~/programming/books/PHP_MySQL/test_pgms$ systemctl status mysql.service ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled) Active: active (running) since Fri 2023-03-24 12:28:03 PDT; 13s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3247 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 3286 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 9058) Memory: 432.5M CPU: 1.432s CGroup: /system.slice/mysql.service └─3286 /usr/sbin/mysqld
Mar 24 12:28:02 zg-ThinkPad-T460 systemd[1]: Starting MySQL Community Server... Mar 24 12:28:03 zg-ThinkPad-T460 systemd[1]: Started MySQL Community Server. @.***:~/programming/books/PHP_MySQL/test_pgms$ php -S localhost:8000 [Fri Mar 24 12:28:55 2023] PHP 8.1.2-1ubuntu2.11 Development Server (http://localhost:8000) started [Fri Mar 24 12:32:02 2023] 127.0.0.1:46160 Accepted
/test_db_connection.php [Fri Mar 24 12:32:02 2023] 127.0.0.1:46160 Closing @.:~/programming/books/PHP_MySQL/test_pgms$ php -ver PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies @.:~/programming/books/PHP_MySQL/test_pgms$ mysql --version mysql Ver 8.0.32 for Linux on x86_64 (MySQL Community Server - GPL)
Do you have any other idea what the program could be?
On 2023-03-23 19:52, jweese74 wrote:
The error message Call to a member function prepare() on null indicates that the prepare() function is being called on a null object, which likely means the database connection was not established properly.
To troubleshoot this issue, follow these steps:
Check the global/code/Database.class.php file to make sure the database connection is being established correctly. Look for the constructor function in the Database class (it should look like public function __construct()) and make sure it's using the correct credentials from your config.php file.
Test the database connection manually using a separate PHP script. Create a new PHP file (e.g., test_db_connection.php) with the following content:
<?php
$host = 'localhost'; $port = '3306'; $db_name = 'formtools'; $username = 'zg'; $password = 'formtools';
try { $conn = new PDO("mysql:host=$host;port=$port;dbname=$db_name", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo 'Connected successfully'; } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); }
?>
Run this script using the PHP built-in server (php -S localhost:8000), and access it via your browser at http://localhost:8000/test_db_connection.php. If the connection is successful, you should see "Connected successfully". If not, it will display the error message.
If the connection test is successful, but the Form Tools installation still fails, it's possible that there's an issue with the Form Tools installation files. In this case, try downloading the latest version of Form Tools and repeat the installation process.
If the connection test fails, double-check your database credentials and make sure the MySQL server is running and accepting connections from your localhost.
On Thu, Mar 23, 2023, 10:36 p.m. zoltang-cmyk @.***> wrote:
Hi, jweese74,
Thanks for answering so fast! Yes, I realized that I made a mistake at the first install and I wanted to use another existing database (todoapp) to put formtools tables in there. So I deleted everything from this first install attempt, copied the unzipped install files in /home/zg/.local/bin/formtools (here I have to make a note that at the first install attempt I got an error which looked like the script couldn't find __MACOSX directory, so at that time I copied it in the formtools directory, and that seemed to handle that error), I created a new database called formtools and started over the installation from scratch.... Still no success. :(
Here is the config.php settings:
<?php
// main program paths - no trailing slashes! $g_root_url = "http://localhost:8000/formtools"; $g_root_dir = "/home/zg/.local/bin/formtools";
// database settings $g_db_hostname = "localhost"; $g_db_port = "3306"; $g_db_name = "formtools"; $g_db_username = "zg"; $g_db_password = "formtools"; $g_tableprefix = "ft";
?>
Here is the output from the terminal screen:
@.:~/.local/bin$ systemctl start mysql.service @.:~/.local/bin$ systemctl status mysql.service ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset> Active: active (running) since Thu 2023-03-23 11:46:21 PDT; 27s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3986 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (co> Main PID: 4025 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 9058) Memory: 367.7M CPU: 1.408s CGroup: /system.slice/mysql.service └─4025 /usr/sbin/mysqld
Mar 23 11:46:20 zg-ThinkPad-T460 systemd[1]: Starting MySQL Community Server... Mar 23 11:46:21 zg-ThinkPad-T460 systemd[1]: Started MySQL Community Server. lines 1-16/16 (END) ^C @.***:~/.local/bin$ php -S localhost:8000 [Thu Mar 23 11:47:38 2023] PHP 8.1.2-1ubuntu2.11 Development Server (http://localhost:8000) started [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Accepted [Thu Mar 23 11:55:35 2023] PHP Fatal error: Uncaught Error: Call to a member function prepare() on null in /home/zg/.local/bin/formtools/global/code/Database.class.php:71 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Settings.class.php(87):
FormTools\Database->query()
1 /home/zg/.local/bin/formtools/global/code/User.class.php(50):
FormTools\Settings::get()
2 /home/zg/.local/bin/formtools/global/code/Core.class.php(864):
FormTools\User->__construct()
3 /home/zg/.local/bin/formtools/global/code/Core.class.php(400):
FormTools\Core::initUser()
4 /home/zg/.local/bin/formtools/index.php(16): FormTools\Core::init()
5 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 71 [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 [500]: GET /formtools - Uncaught Error: Call to a member function prepare() on null in /home/zg/.local/bin/formtools/global/code/Database.class.php:71 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Settings.class.php(87):
FormTools\Database->query()
1 /home/zg/.local/bin/formtools/global/code/User.class.php(50):
FormTools\Settings::get()
2 /home/zg/.local/bin/formtools/global/code/Core.class.php(864):
FormTools\User->__construct()
3 /home/zg/.local/bin/formtools/global/code/Core.class.php(400):
FormTools\Core::initUser()
4 /home/zg/.local/bin/formtools/index.php(16): FormTools\Core::init()
5 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 71 [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Closing
This is a different error than at the first time, and at this time I didn't get any progress in the installation, just a blank page on the browser screen.
On 2023-03-23 05:26, jweese74 wrote:
The error messages indicate problems with the database transactions, specifically that there are no active transactions when trying to roll back, and missing tables in the database.
To resolve this issue, try the following steps:
- Ensure that your MySQL service is running correctly.
- Check your database configuration in the Form Tools installation files. Verify that the database name, username, password, and host are correct.
- Ensure that the user specified in the configuration has proper privileges (CREATE, ALTER, INSERT, UPDATE, DELETE, and SELECT) for the database.
- Clear any previous installations by dropping the database and creating a new one. You can do this using a MySQL client or via the command line. Back up any data you want to save before dropping the database.
- Restart the Form Tools installation process.
-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.***>
Links:
[1] https://github.com/formtools/core/issues/902#issuecomment-1481106182 [2]
https://github.com/notifications/unsubscribe-auth/AMOB3RLDZ6UUN2774ZSC6ZLW5Q6O7ANCNFSM6AAAAAAWES3XXQ
-- Reply to this email directly, view it on GitHub https://github.com/formtools/core/issues/902#issuecomment-1482169283, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACED2LVGCA65DNQ6ZHEYPHDW5UCCVANCNFSM6AAAAAAWES3XXQ . You are receiving this because you commented.Message ID: @.***>
-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you authored the thread.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/formtools/core/issues/902#issuecomment-1482177774", "url": "https://github.com/formtools/core/issues/902#issuecomment-1482177774", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ] The error message Call to a member function prepare() on null indicates that the prepare() function is being called on a null object, which likely means the database connection was not established properly. To troubleshoot this issue, follow these steps:
- Check the global/code/Database.class.php file to make sure the database connection is being established correctly. Look for the constructor function in the Database class (it should look like public function construct()) and make sure it's using the correct credentials from your config.php file. 2. Test the database connection manually using a separate PHP script. Create a new PHP file (e.g., test_db_connection.php) with the following content: Run this script using the PHP built-in server (php -S localhost:8000), and access it via your browser at http://localhost:8000/test_db_connection.php. If the connection is successful, you should see "Connected successfully". If not, it will display the error message. 3. If the connection test is successful, but the Form Tools installation still fails, it's possible that there's an issue with the Form Tools installation files. In this case, try downloading the latest version of Form Tools and repeat the installation process. 4. If the connection test fails, double-check your database credentials and make sure the MySQL server is running and accepting connections from your localhost. On Thu, Mar 23, 2023, 10:36 p.m. zoltang-cmyk @.***> wrote: > Hi, jweese74, > > Thanks for answering so fast! > Yes, I realized that I made a mistake at the first install and I wanted > to use another existing database (todoapp) to put formtools tables in > there. > So I deleted everything from this first install attempt, copied the > unzipped install files in /home/zg/.local/bin/formtools (here I have to > make a note that at the first install attempt I got an error which > looked like the script couldn't find MACOSX directory, so at that time > I copied it in the formtools directory, and that seemed to handle that > error), I created a new database called formtools and started over the > installation from scratch.... Still no success. :( > > Here is the config.php settings: > > > > Here is the output from the terminal screen: > > @.:~/.local/bin$ systemctl start mysql.service > @.:~/.local/bin$ systemctl status mysql.service > ● mysql.service - MySQL Community Server > Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor > preset> > Active: active (running) since Thu 2023-03-23 11:46:21 PDT; 27s ago > Docs: man:mysqld(8) > http://dev.mysql.com/doc/refman/en/using-systemd.html > Process: 3986 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre > (co> > Main PID: 4025 (mysqld) > Status: "Server is operational" > Tasks: 39 (limit: 9058) > Memory: 367.7M > CPU: 1.408s > CGroup: /system.slice/mysql.service > └─4025 /usr/sbin/mysqld > > Mar 23 11:46:20 zg-ThinkPad-T460 systemd[1]: Starting MySQL Community > Server... > Mar 23 11:46:21 zg-ThinkPad-T460 systemd[1]: Started MySQL Community > Server. > lines 1-16/16 (END) > ^C > @.***:~/.local/bin$ php -S localhost:8000 > [Thu Mar 23 11:47:38 2023] PHP 8.1.2-1ubuntu2.11 Development Server > (http://localhost:8000) started > [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Accepted > [Thu Mar 23 11:55:35 2023] PHP Fatal error: Uncaught Error: Call to a > member function prepare() on null in > /home/zg/.local/bin/formtools/global/code/Database.class.php:71 > Stack trace: > #0 /home/zg/.local/bin/formtools/global/code/Settings.class.php(87): > FormTools\Database->query() > #1 /home/zg/.local/bin/formtools/global/code/User.class.php(50): > FormTools\Settings::get() > #2 /home/zg/.local/bin/formtools/global/code/Core.class.php(864): > FormTools\User->__construct() > #3 /home/zg/.local/bin/formtools/global/code/Core.class.php(400): > FormTools\Core::initUser() > #4 /home/zg/.local/bin/formtools/index.php(16): FormTools\Core::init() >
5 {main} > thrown in
/home/zg/.local/bin/formtools/global/code/Database.class.php > on line 71 > [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 [500]: GET /formtools - Uncaught Error: Call to a member function prepare() on null in > /home/zg/.local/bin/formtools/global/code/Database.class.php:71 > Stack trace: > #0 /home/zg/.local/bin/formtools/global/code/Settings.class.php(87): > FormTools\Database->query() > #1 /home/zg/.local/bin/formtools/global/code/User.class.php(50): > FormTools\Settings::get() > #2 /home/zg/.local/bin/formtools/global/code/Core.class.php(864): > FormTools\User->__construct() > #3 /home/zg/.local/bin/formtools/global/code/Core.class.php(400): > FormTools\Core::initUser() > #4 /home/zg/.local/bin/formtools/index.php(16): FormTools\Core::init() > #5 {main} > thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php > on line 71 > [Thu Mar 23 11:55:35 2023] 127.0.0.1:43548 Closing > > This is a different error than at the first time, and at this time I > didn't get any progress in the installation, just a blank page on the > browser screen. > > On 2023-03-23 05:26, jweese74 wrote: > > > The error messages indicate problems with the database transactions, > > specifically that there are no active transactions when trying to roll > > back, and missing tables in the database. > > > > To resolve this issue, try the following steps: > > > > Ensure that your MySQL service is running correctly. > > Check your database configuration in the Form Tools installation > > files. Verify that the database name, username, password, and host are > > correct. > > Ensure that the user specified in the configuration has proper > > privileges (CREATE, ALTER, INSERT, UPDATE, DELETE, and SELECT) for the > > database. > > Clear any previous installations by dropping the database and > > creating a new one. You can do this using a MySQL client or via the > > command line. Back up any data you want to save before dropping the > > database. > > * Restart the Form Tools installation process. > > > > -- > > Reply to this email directly, view it on GitHub [1], or unsubscribe > > [2]. > > You are receiving this because you authored the thread.Message ID: > > @.> > > > Links: > ------ > [1] https://github.com/formtools/core/issues/902#issuecomment-1481106182 > [2] > > https://github.com/notifications/unsubscribe-auth/AMOB3RLDZ6UUN2774ZSC6ZLW5Q6O7ANCNFSM6AAAAAAWES3XXQ > > -- > Reply to this email directly, view it on GitHub > , > or unsubscribe > > . > You are receiving this because you commented.Message ID: > @.> > -- Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread. Message ID: [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/formtools/core/issues/902#issuecomment-1482177774", "url": "https://github.com/formtools/core/issues/902#issuecomment-1482177774", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
[1] https://github.com/formtools/core/issues/902#issuecomment-1482177774 [2] https://github.com/notifications/unsubscribe-auth/AMOB3RL3BTMEHYAJBVKAHW3W5UD5DANCNFSM6AAAAAAWES3XXQ
Hmm, okay. Let's try this - The way I see it, you have two options here depending on your comfort level:
Since the test_db_connection.php script was successful, your database connection details in config.php should be correct. Let's try to identify the issue in the Form Tools installation.
Based on the information provided, it seems like the Form Tools installation is not properly connecting to the database or initializing the Database class. Let's add some debugging information to the __construct()
function of the Database
class in the global/code/Database.class.php
file:
Find the __construct()
function and modify it to look like this:
public function __construct()
{
$this->dbh = null;
$hostname = Core::getDbHostname();
$port = Core::getDbPort();
$db_name = Core::getDbName();
$username = Core::getDbUsername();
$password = Core::getDbPassword();
// Add these lines for debugging:
echo "Hostname: $hostname<br>";
echo "Port: $port<br>";
echo "DB name: $db_name<br>";
echo "Username: $username<br>";
echo "Password: $password<br>";
try {
$this->dbh = new PDO("mysql:host=$hostname;port=$port;dbname=$db_name;charset=utf8", $username, $password);
$this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
}
Now, run the installation again, and you should see debugging information printed on the screen. This will help you confirm if the correct database details are being used.
If the database connection is still not being established, it could be an issue with the Form Tools codebase. In this case, you may have to wait for @benkeen to respond, but understand while this is a fantastic tool; @benkeen has much more on his plate than Form Tools.
In the meantime, you can also try installing an older version of Form Tools (e.g., 3.0.x) to see if the issue persists. This can help you determine if the issue is specific to the version you are trying to install or if it's related to your environment.
/var/log/apache2/error.log
. For Nginx, you may find it in /var/log/nginx/error.log
. The PHP error log location can be found in the php.ini configuration file. Look for the error_log
directive to see where the log is saved.https://xdebug.org/docs/install
Ctrl + Shift + I
(Windows/Linux) or Cmd + Opt + I
(Mac).Remember that while these methods can help you identify issues without modifying the Form Tools scripts, they might not provide the same level of detail or control as directly adding debugging information to the code. It's always a good idea to revert any changes you've made to the scripts after you've finished debugging to ensure the application runs as expected.
Call to a member function prepare() on null in /home/zg/.local/bin/formtools/global/code/Database.class.php:71
indicates that there is an issue with the database connection, even though your test_db_connection.php
script worked correctly. This inconsistency needs to be investigated.This is about all I've got friend, good luck to you.
There is no problem with my comfort level :) so first I started with Approach 1. I changed the whole __construct() function of the Database class in the global/code/Database.class.php file with the given code, but no success:
zg@zg-ThinkPad-T460:~/.local/bin$
systemctl start mysql.service
zg@zg-ThinkPad-T460:~/.local/bin$ php -S localhost:8000
[Sat Mar 25 14:42:06 2023] PHP 8.1.2-1ubuntu2.11 Development Server (http://localhost:8000) started
[Sat Mar 25 14:42:58 2023] 127.0.0.1:33604 Accepted
[Sat Mar 25 14:42:58 2023] PHP Fatal error: Uncaught Error: Call to undefined method FormTools\Core::getDbHostname() in /home/zg/.local/bin/formtools/global/code/Database.class.php:30
Stack trace:
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 30 [Sat Mar 25 14:42:58 2023] 127.0.0.1:33604 [500]: GET /formtools/ - Uncaught Error: Call to undefined method FormTools\Core::getDbHostname() in /home/zg/.local/bin/formtools/global/code/Database.class.php:30 Stack trace:
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 30`
I looked for error_log files, I could find only Apache2 error log:
[Fri Mar 24 12:05:32.366416 2023] [mpm_prefork:notice] [pid 982] AH00163: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations [Fri Mar 24 12:05:32.368688 2023] [core:notice] [pid 982] AH00094: Command line: '/usr/sbin/apache2' [Sat Mar 25 00:00:05.554632 2023] [mpm_prefork:notice] [pid 982] AH00171: Graceful restart requested, doing restart AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
I downloaded the ver. 3.1.0 and 3.0.20 Form tools also from https://github.com/formtools/ but the core and the other modules were not bundled and instead of trying to put together the whole program I just compared the global/code/Database.class.php files with the 3.1.1 version, and I saw that all of them contain the same __construct() method, so there was no reason to try to install them.
Then I checked out the browser debug data, see the attached screenshots.
Then installed the xdebug but I could not integrate it in VS Code yet. (I never used it before, and I have to learn this first.) So this where I stand right now.
Meantime I progressed with Xdebug and VS Code. Here is a screenshot of an Access Denied error found in __construct() that shows that somehow my setup must not be correct (however I have been doing things successfully with it already):
I'm using Linux for a couple years now but honestly these user permission things/rules/methods are still not fully clear to me. When I installed MySQL and PHP I did my best, and by my opinion they work, what I would say "I find the way they do what I want" but maybe they still not configured properly.
For example as I learn PHP I try out different code snippets, examples from tutorials, etc. I save these codes in separate directories by their subjects and if I want to run one of them I go in that folder with the browser, open a terminal window in that directory and start PHP development server in that directory.
So, for example I put Formtools' unzipped files in /home/zg/.local/bin/ and if I want to start /formtools/index.php then in the browser I can start like "localhost:8000/formtools/" and it will find it. But might be a better way like some basic and global configuration, what I don't know how to do.
Anyway, here are 3 screenshots, 2 of them are the mysql data directory and it's user permissions, the 3rd one is the way I log in to mysql in the console command line under my user name. (By the way as everything is installed on one laptop what I use solely, I gave myself - the zg user - full administrator rights in mysql.) These data may give you some clue what can be the source (and the solution for) the problem in this data access errors (which maybe not the Formtools bugs but my own system bugs that haven't come to light until now).
Thank you for your dedicated work to develop this system and provide customer services, too!
My apologies for the confusion earlier. It seems I made a mistake in my previous response. The FormTools\Core
class does not have methods like getDbHostname()
, getDbName()
, etc.
Let's revert the changes made in Database.class.php
and try another approach to debug the issue.
Database.class.php
by removing the lines we added earlier.Database.class.php
file and add the following lines after line 28 (just before the $dsn
variable is defined):error_log("PDO DSN: mysql:host=$hostname;port=$port;dbname=$db_name;charset=utf8");
error_log("PDO Username: $username");
error_log("PDO Password: $password");
This will log the PDO connection details to the error log, which will help us ensure that the correct database credentials are being used.
PDO DSN: mysql:host=localhost;port=3306;dbname=formtools;charset=utf8
PDO Username: zg
PDO Password: formtools
Please make sure that the logged values match the values in your config.php
file. If there's any discrepancy, we can investigate further.
Regarding the Apache error log, it does not seem to contain any relevant information related to Form Tools at the moment, as it is mostly related to the Apache configuration itself. Since you are using PHP's built-in development server (php -S localhost:8000
), the Apache log might not be relevant to the current issue. Make sure to check the PHP error log, which should be in a different location or file (e.g., /var/log/php_errors.log
).
Also, this is my first attempt at helping anyone, I'm not the FormTools support or, well -- even a programmer for the most part. I'm work in "Information Management and Data Storage Security" ... I build disk arrays. Good luck.
As I started to learn and play with VS Code debug tools I looked into different program segments and some (possible?) errors. I took screenshots (66 of them), ZIPed and attached them. I hope they are legit problems and this will help to correct them. I tried to show the individual errors but on some shots there are several same type errors on one picture. Pay attention to that.
It definitely looks like I don't have access to formtools database and this causes the problem - but I don't understand how can that be. I have ALL rights granted on every of my databases, including formtools.
Today I did a step-by-step debug to find the problem. First I inserted the 3 error_log lines in the _construct() function, and the output of the parameters are correct...
...but still creates an exception error... ...then later in the query() function creates exception error again ... ... and finally crashes with Fatal error. I was thinking how could we test these situations first and catch the error, but I'm not that familiar with PDO that I could solve this problem (yet).
I think #916 is maybe the same. I tried to do a clean install with PHP 8.2 and this is not working....
I seemingly successfully installed Formtools (except for it didn't want to continue after Step 3, however it did create empty tables, but I could handle this problem simply write Step 4 at the end of the URL in the browser's address line) but after that I saw that it actually gave error messages in the server log and it doesn't do anything when I want to start it:
`zg@zg-ThinkPad-T460:~/.local/bin$ systemctl start mysql.service zg@zg-ThinkPad-T460:~/.local/bin$ php -S localhost:8000 [Tue Mar 21 19:46:23 2023] PHP 8.1.2-1ubuntu2.11 Development Server (http://localhost:8000) started [Tue Mar 21 19:50:44 2023] 127.0.0.1:46114 Accepted [Tue Mar 21 19:50:47 2023] PHP Fatal error: Uncaught PDOException: There is no active transaction in /home/zg/.local/bin/formtools/global/code/Database.class.php:148 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Database.class.php(148): PDO->rollBack()
1 /home/zg/.local/bin/formtools/global/code/Installation.class.php(933): FormTools\Database->rollbackTransaction()
2 /home/zg/.local/bin/formtools/install/actions-installation.php(186): FormTools\Installation::createDatabase()
3 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 148 [Tue Mar 21 19:50:47 2023] 127.0.0.1:46114 [500]: POST /formtools/install/actions-installation.php?page=3 - Uncaught PDOException: There is no active transaction in /home/zg/.local/bin/formtools/global/code/Database.class.php:148 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Database.class.php(148): PDO->rollBack()
1 /home/zg/.local/bin/formtools/global/code/Installation.class.php(933): FormTools\Database->rollbackTransaction()
2 /home/zg/.local/bin/formtools/install/actions-installation.php(186): FormTools\Installation::createDatabase()
3 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 148 [Tue Mar 21 19:50:47 2023] 127.0.0.1:46114 Closing [Tue Mar 21 19:53:41 2023] 127.0.0.1:59898 Accepted [Tue Mar 21 19:53:41 2023] 127.0.0.1:59898 [400]: POST /formtools/install/actions-installation.php?page=3 [Tue Mar 21 19:53:41 2023] 127.0.0.1:59898 Closing [Tue Mar 21 19:53:51 2023] 127.0.0.1:43010 Accepted [Tue Mar 21 19:53:53 2023] PHP Fatal error: Uncaught PDOException: There is no active transaction in /home/zg/.local/bin/formtools/global/code/Database.class.php:148 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Database.class.php(148): PDO->rollBack()
1 /home/zg/.local/bin/formtools/global/code/Installation.class.php(88): FormTools\Database->rollbackTransaction()
2 /home/zg/.local/bin/formtools/install/actions-installation.php(180): FormTools\Installation::deleteTables()
3 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 148 [Tue Mar 21 19:53:53 2023] 127.0.0.1:43010 [500]: POST /formtools/install/actions-installation.php?page=3 - Uncaught PDOException: There is no active transaction in /home/zg/.local/bin/formtools/global/code/Database.class.php:148 Stack trace:
0 /home/zg/.local/bin/formtools/global/code/Database.class.php(148): PDO->rollBack()
1 /home/zg/.local/bin/formtools/global/code/Installation.class.php(88): FormTools\Database->rollbackTransaction()
2 /home/zg/.local/bin/formtools/install/actions-installation.php(180): FormTools\Installation::deleteTables()
3 {main}
thrown in /home/zg/.local/bin/formtools/global/code/Database.class.php on line 148 [Tue Mar 21 19:53:53 2023] 127.0.0.1:43010 Closing [Tue Mar 21 19:54:10 2023] 127.0.0.1:40452 Accepted [Tue Mar 21 19:54:16 2023] 127.0.0.1:40452 Closed without sending a request; it was probably just an unused speculative preconnection [Tue Mar 21 19:54:16 2023] 127.0.0.1:40452 Closing [Tue Mar 21 19:55:49 2023] 127.0.0.1:49106 Accepted [Tue Mar 21 19:55:49 2023] 127.0.0.1:49106 [200]: POST /formtools/install/actions-installation.php?page=4 [Tue Mar 21 19:55:49 2023] 127.0.0.1:49106 Closing [Tue Mar 21 19:58:06 2023] 127.0.0.1:50834 Accepted [Tue Mar 21 19:58:06 2023] 127.0.0.1:50834 [200]: POST /formtools/install/actions-installation.php?page=5 [Tue Mar 21 19:58:06 2023] 127.0.0.1:50834 Closing [Tue Mar 21 19:59:18 2023] 127.0.0.1:39738 Accepted [Tue Mar 21 19:59:18 2023] PHP Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'todoapp.ft_settings' doesn't exist in /home/zg/.local/bin/formtools/global/code/Database.class.php:71`