XF 2.2 I can't get the XF installation to start

Miri

Well-known member
I'm trying to perform a fresh installation of XenForo 2.2.7 for a new project, but unfortunately, I'm encountering an issue right from the start. As soon as I attempt to access the URL to begin the installation, I receive the following error:

An exception occurred: [mysqli_sql_exception] Access denied for user ''@'localhost' (using password: NO) in src/XF/Db/Mysqli/Adapter.php on line 161

mysqli->real_connect() in src/XF/Db/Mysqli/Adapter.php at line 161
XF\Db\Mysqli\Adapter->makeConnection() in src/XF/Db/Mysqli/Adapter.php at line 28
XF\Db\Mysqli\Adapter->getConnection() in src/XF/Db/AbstractAdapter.php at line 62
XF\Db\AbstractAdapter->connect() in src/XF/Db/Mysqli/Adapter.php at line 113
XF\Db\Mysqli\Adapter->escapeString() in src/XF/Db/AbstractAdapter.php at line 518
XF\Db\AbstractAdapter->quote() in src/XF/Db/AbstractAdapter.php at line 496
XF\Db\AbstractAdapter->quote() in src/XF/DataRegistry.php at line 139
XF\DataRegistry->readFromDb() in src/XF/DataRegistry.php at line 84
XF\DataRegistry->get() in src/XF/DataRegistry.php at line 227
XF\DataRegistry->offsetGet() in src/XF/Install/App.php at line 73
XF\Install\App->XF\Install\{closure}() in src/XF/Container.php at line 30
XF\Container->offsetGet() in src/XF/App.php at line 2318
XF\App->setupAddOnComposerAutoload() in src/XF/Install/App.php at line 159
XF\Install\App->setup() in src/XF.php at line 485
XF::setupApp() in src/XF.php at line 508
XF::runApp() in install/index.php at line 14

I contacted my hosting provider because I suspected it might be related to "mod_security," but on two separate occasions, they suggested that it could be an issue with XenForo.

I've tried different PHP versions and temporarily disabled "mod_security" to check for any conflicts.

Could someone please advise me on what to do?
Thank you
 
Solution
But I find it puzzling that it should at least bring up the installation interface. It doesn't make sense that as soon as I upload the files via FTP, if I go to the URL to initiate the installation, it gives me the credentials error without ever having made any changes or entered credentials anywhere.

That sounds like some sort of server caching is involved.
That's a MySQL authentication error. It looks like your XenForo config.php file has no username in the $config['db']['username'] variable.

Either way, as far as your MySQL server is concerned, there is no valid user that has no username, no password, connecting from localhost.
 
So, I've tried several things, but something is escaping me. I've gone through the entire procedure, downloaded the package multiple times, extracted it on my computer, and uploaded it via FTP without using the 'file manager' to avoid any corrupted files.

I've created a database and a username, granting all privileges. I've used an alphanumeric password without special characters, just to get this blessed installation started.

In the /scr folder, there's a file called config.php.default.

I've tried several things:
  • I followed the installation URL as per the documentation, and it gives me the error mentioned above.
  • I tried manually creating a config.php file without credentials, and it gives me the same error as before.
  • I attempted to create a config.php file manually, this time with credentials, and it gave me a slightly different error.
    An exception occurred: [mysqli_sql_exception] Table '..._cxf.xf_data_registry' doesn't exist in src/XF/Db/Mysqli/Statement.php on line 37

    mysqli->prepare() in src/XF/Db/Mysqli/Statement.php at line 37
    XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 56
    XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 96
    XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 177
    XF\Db\AbstractAdapter->fetchPairs() in src/XF/DataRegistry.php at line 139
    XF\DataRegistry->readFromDb() in src/XF/DataRegistry.php at line 84
    XF\DataRegistry->get() in src/XF/DataRegistry.php at line 227
    XF\DataRegistry->offsetGet() in src/XF/Install/App.php at line 73
    XF\Install\App->XF\Install\{closure}() in src/XF/Container.php at line 30
    XF\Container->offsetGet() in src/XF/App.php at line 2318
    XF\App->setupAddOnComposerAutoload() in src/XF/Install/App.php at line 159
    XF\Install\App->setup() in src/XF.php at line 485
    XF::setupApp() in src/XF.php at line 508
    XF::runApp() in install/index.php at line 14
  • I also tried inserting the same credentials into the config.php.default file, but I keep receiving the error.
I've tried all of these things multiple times.

I'm doing a cross-check with another XF installation of mine, and I've noticed that the /db folder is missing. I assume it gets created during the installation, and other than that, I have nothing else to report.

If you have the correct URL, you should see the XenForo installer.
I'm just wondering why I don't receive the XF installation screen but it immediately brings me back to the credentials error which in theory I should enter through the installation interface?

Gosh, I just can't seem to move forward. Am I missing something or skipping an essential step in the installation?
 
Last edited:
In the /scr folder, there's a file called config.php.default.
That is not the file used to connect to the database. It is src/config.php .

That file should be automatically created as part of the installation routine, when you are prompted to enter the database information.
A success message is displayed when the file is written out to the server.

It sounds like your installation is corrupt.
Delete internal_data/install-lock.php and src/config.php and start over.
 
I don't have any internal_data/install-lock.php file. I deleted the src/config.php file, and the same error appears (in reality, I understand the dynamics of 'config.php' and 'config.php.default' files, but I created it manually hoping to resolve the issue in some way).

I tried completely removing XenForo and the database with the user, downloaded the XF package again, uploaded it to the server, recreated the database and user, and I still receive the same error. I've attempted this multiple times.

I'm starting to think that the files I download might be corrupted. I'll try to perform a fresh installation on another test domain to check if it's somehow related to the current domain in use, and I'll let you know.
 
No, the files aren't not likely corrupted unless you're doing something to them between the time you download them and put them on the server. Are you letting Xenforo create the config.php file? or are you still trying to manually create it? People make many mistakes in doing in manually...

I've done 6 XF 2.2.x installs today, zero issues with the packages provided.

I usually upload the .zip package to the server directly, unzip the files into a working folder (on the server) and build the install from there. So long as the server is setup correctly with PHP and required attributes (db, db user/pass, etc.), each setup runs flawlessly.

How about the XF test script? Does that work? (Download from here...)
 
Yes, I tried the script.
XenForo®-2-system-requirements-test.webp
But I find it puzzling that it should at least bring up the installation interface. It doesn't make sense that as soon as I upload the files via FTP, if I go to the URL to initiate the installation, it gives me the credentials error without ever having made any changes or entered credentials anywhere. Of course, it seems strange to me too. I've never encountered any problems with XenForo before.
 
But I find it puzzling that it should at least bring up the installation interface. It doesn't make sense that as soon as I upload the files via FTP, if I go to the URL to initiate the installation, it gives me the credentials error without ever having made any changes or entered credentials anywhere. Of course, it seems strange to me too. I've never encountered any problems with XenForo before
In my experience, that indicates that there are some residual issues going on either with the server configuration or perhaps there are issues where the install is placed (or leftover files it's finding...)

If you put in the /install URL and something other than the installation start screen appears, there's something else going on that's not related to XF. I don't know anything about your infrastructure, but I'm confident that it's a configuration issue at the server side (db/web/php) somewhere.

Sorry that's not super helpful. 🙁
 
This is an installation in a main subfolder. I already have a CMS installed on the domain. I appreciate your input though. It might be something (definitely my fault) that I can't find it myself.
 
  • Like
Reactions: ENF
But I find it puzzling that it should at least bring up the installation interface. It doesn't make sense that as soon as I upload the files via FTP, if I go to the URL to initiate the installation, it gives me the credentials error without ever having made any changes or entered credentials anywhere.

That sounds like some sort of server caching is involved.
 
Solution
Google console interprets it as error 500.
screenshot-err-500.png
That sounds like some sort of server caching is involved.
Ok and it could be, but in theory if I try to rename the folder from where I install it shouldn't have anything to do with the cache. As I said previously, I also tried to install it in another different domain and still the same error.

Is it somehow related to my expired subscription for that license?
 
The error indicates it is simply a database connection issue, no more, no less.

Try the same credentials from the command line, I bet they don't work.

mysql -uusername -ppassword -hhostname database

Also, try replacing "localhost" with 127.0.0.1 - I've seen a few times where name resolution is turned off for MySQL and it needs the IP address.
 
Or you can use something like this if CLI isn't available.
Name it db-check.php , enter the DB credentials, upload it to the server, and navigate to it in the browser.

PHP:
<?php
$servername = "localhost";
$username = "username";
$dbname = "dbname";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $dbname, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
 
Thank you for your responses. They will certainly be useful for similar scenarios. In my case, as I described above, regardless of the folder or domain (always on the same host) where I was uploading the files, when I clicked the link to start the installation, instead of the installation interface, an error message appeared. Only after disabling the cache extensions was I able to proceed with the installation. It's likely that some cache from a previous installation was lingering in memory, preventing me from moving forward.
 
  • Like
Reactions: ENF
Back
Top Bottom