Closed ernestbuffington closed 1 year ago
@ernestbuffington
First of all, thank you for cloning, trying, and posting about your experience with YaWK. I'm sorry to hear that you've encountered some difficulties with it. To assist you or benefit from this issue: could you please provide some information?
Have you installed YaWK correctly? On which system (Apache? Nginx?) are you attempting to run YaWK?
The setup routine should generate dbconfig.php during the installation process. Typically, when you clone YaWK and open the URL in your browser, you should see the installer and be guided through five installation steps (select your language, setting up the database, adding project information, adding admin information, and finally, logging into the admin panel).
If the installer does not show up, there could be several reasons:
However, I have labeled this as a bug because this fatal error should be caught rather than visible to the user. Improving the installer process is still on the to-do list, and I will prioritize it as soon as possible. I will take care of it.
At first, it did load the install page but failed before it ever installed the database. After 1st run a white page after a refresh to try and run the install again.
I tried multiple versions of PHP on a remote Developer server. The server is running Apache 2, php-fpm. Everything runs as the current user. I currently have gzip off.
I am running all versions of PHP so I normally test them all on every project. My resting PHP version is 8.1.15
The db.php file was looking for dbconfig.php in the setup/classes folder which did not exist. I thought it odd that in the db.php file, the include did specify a path to said file. This led me to believe that maybe one also resided in the root.
/**
* db constructor - Include the database config file
*/
public function __construct()
{ // include config array
require_once ("dbconfig.php");
}
So I created one myself after I looked at the following page. https://docs.yawk.io/dbconfig_8php.html
I also put this file in the root hoping maybe it would not keep getting an error every time it hit line: 46 of the db.php file. It of course was looking at the database port when it hit that line which also seemed odd. It was odd because it seems as though it was able to get the server, username, password, and dbname beforehand. I am sure the error was where it passed the data and the string to the connection. It was not returning the correct information so I assume it was not able to get said information.
Keeping gzip off is a common practice among coders so none of them are currently configured to use gzip.
gzip should be an option of course one that I have never used.
I am not a novice programmer, the 1st thing I considered doing was re-writing the database connecter. That was only because I am not familiar with what is going on everywhere in the code yet.
This all stems from the fact that the setup could not find the correct files.
By default, all scripts running as the user on my server have permission to write or make files within the current user's domain. There are many things to consider when using paths in any version of PHP above 7.4. So I figured I would point at that in your repo the file dbconfig.php appeared to be missing.
Also following was the error on line: 71:
if ($this->connection = $this->connect())
Leading me to believe this question should be structured around how do I fix the connection and what am I doing wrong with the config.
Hi @ernestbuffington
dbconfig.php is not available in the repo, as it is generated during the setup process. However, it resides in system/classes/dbconfig.php
The content of this file will look like this:
<?php
$this->config['server'] = "YOUR DB SERVER";
$this->config['username'] = "DB USERNAME";
$this->config['password'] = "DB PASSWORD";
$this->config['dbname'] = "DB TABLE";
$this->config['prefix'] = "cms_";
$this->config['port'] = "3306";
?>
YaWK works with PHP 7+ (developed on 8.x) and you can enable error reporting or check log files for issues. Currently, there is no check during the setup process to verify if the database credentials are correct. However, this feature will be added soon. So, if you are running the Setup, make sure the entered data is accurate. The data import process should only take a few seconds to complete. Once this is done, you will be asked to enter additional details about your website.
I hope this information helps you to resolve the problem.
I will take care of the setup routine and the installation process as soon as possible, hopefully within the next two weeks.
Is this file also generated during the installation? $filePointer = "system/setup/yawk_database.sql_filepointer";
Is this file also generated during the installation? $filePointer = "system/setup/yawk_database.sql_filepointer";
maybe temporary, during the database import. I will have a look at it soon.
Thank you Daniel
I got it working and added you to the CodersExchange Network. https://yawk.coders.exchange
Implemented XHR database credentials check during setup routine with commit #374. Huge usability improvement.
Add file & folder checks during setup with commit #375
Thanks to the valuable hints from @ernestbuffington , I've added a lot of features to the installer, fixed numerous issues, and improved overall usability. The installer now checks database credentials, sets mandatory fields, and implements form validation, ensuring that setup should not crash anymore. I have tested these improvements on both Apache and Nginx with PHP 8.1, and I can confirm that the setup process has been significantly improved. Setup process improvement is now complete.
overall view of what has been done:
Fatal error: Uncaught mysqli_sql_exception: Access denied for user ''@'localhost' (using password: NO) in /home/yawk/public_html/system/classes/db.php:46 Stack trace: #0 /home/yawk/public_html/system/classes/db.php(46): mysqli->__construct(NULL, NULL, NULL, NULL, NULL) #1 /home/yawk/public_html/system/classes/db.php(71): YAWK\db->connect() #2 /home/yawk/public_html/system/classes/settings.php(472): YAWK\db->query('SELECT value FR...') #3 /home/yawk/public_html/system/classes/language.php(50): YAWK\settings::getSetting(Object(YAWK\db), 'frontendLanguag...') #4 /home/yawk/public_html/index.php(69): YAWK\language->init(Object(YAWK\db), 'frontend') #5 {main} thrown in /home/yawk/public_html/system/classes/db.php on line 46