Installation issue with 8.5.0 version - could not connect to DB

Hello.
I was looking testing suiteCRM, so I tried to install it but faced some issues at last step. I hope you would be able to solve it. :slight_smile:

I install it on a VM running latest Lubuntu LTS version.
I downloaded PHP and followed all steps to include modules, I Installed composer as well. I run test verification for PHP and it works.
I unzip suiteCRM in /var/www/html and rename folder as being CRM. So the root of suiteCRM is under /var/www/html/CRM/
I updated rwx rights for user for CRM folder, files and sub repositories.
I updated default apache2.conf file to include suiteCRM folder as follows:
DocumentRoot /var/www/html/CRM/public
<Directory /var/www/html/CRM/public>
AllowOverride All
Order Allow,Deny
Allow from All

Issue is faced when trying to install suiteCRM.
When trying to install it from browser, I can well see the files in http://localhost/CRM.
But when trying to do localhost/CRM/#/install , nothing is happening…

I therefore tries to do install from CLI, I got an error message “An error occurred while checking the Database Host Connection step: check-db-connection | status: failed Could not connect to db”.

Obviously, something is wrong with DB. any idea of what I missed to solve it?
Thanks in advance.
Regards,

Have you checked your DB credentials? How are they set in the .env files?

You can check with

cat .env* | grep DATABASE_URL

Thanks for trying to help me!

Well, under my /var/www/html/CRM, file .env contains no line with DATABASE_URL.

Note that there may be several .env files, typically:

.env
.env.local
.env.prod
.env.dev

Identify the DATABASE_URL lines inside them and check if those MySQL strings are correct: ip, port, user name, password.

hum… Ok we got an issue then because I’m getting only 1 .env file : .env
Under my /var/www/html/CRM, there is no :

.env.local
.env.prod
.env.dev

supposedly the database url should be populated when you enter the database details (server, user, password, database) on the install screen.

does your web server process have permissions to write files? who is the owner of said files on the crm root?

Ok, to be more formal, the full logic is this:

  • you have an .env file on the root of your installation
  • inside that, there is a line (around line 15) specifying the environment, like this: APP_ENV=prod
  • that sends Symfony looking for another file called .env.prod or .env.local
  • inside that other file, there should be a line with DB credentials that looks something like this:

DATABASE_URL="mysql://root:somepassword@10.0.0.32:3307/SuiteCRMv8"

If you don’t have at that, the installer might be breaking before it gets a chance to do anything. In which case @maverickws ’ advice is pointing you in the right direction - check ownerships, permissions, etc.

1 Like

Following up on @pgr reply and just to make clear how the link is formed:

DATABASE_URL="mysql://root:somepassword@10.0.0.32:3306/SuiteCRMv8"

Where

  • root = database_user
  • somepasswd = database_password
  • 10.0.0.32 represents the sql server
  • 3307 represents the sql server port - default port is 3306
  • SuiteCRMv8 = database_name

But again, when you fill this on the install page, the web server should create a .env.local file with it.
I would check both the ownership of the files, see what user is running the web server process, and heck take a look at the error_log should have something too.

Ok we progress. I missed that Webserver process was running with user www-data profile.
Therefore, rights for my path /var/www/html/CRM and subdirectories were set on a different users.
I applied change user command and change rights following instructions:

find . -type d -not -perm 2755 -exec chmod 2755 {} ;
find . -type f -not -perm 0644 -exec chmod 0644 {} ;
find . ! -user www-data -exec chown www-data:www-data {} ;
chmod +x bin/console

it worked except for 2 files (even with sudo command) :

./public/legacy/suitecrm.log
./bin/console

Then, message error change when trying to run ./bin/console suitecrm:app:install commande
Here is the message

The stream of file “/var/www/html/CRM/logs/prod/prod.log” could not be opened in append mode: Failed to open stream : Permission denied

try this at SuiteCRM root:

sudo chown -R www-data:www-data .
sudo -uwww-data bin/console suitecrm:app:install

Although I’m not sure I ever ran that second command. Anyway run the command using sudo -u user

sudo chown -R www-data:www-data . is generating a eror message:
chown: incorrect group: www-data:www-data

seems still some rights issues

if you do

id www-data

what is the output ?

uid=33(www-data) gid=33(www-data) groupes=33(www-data)

Check if you have any other program / terminal locking the log files…

weird. the group is www-data (as expected).
And if we use a command similar to yours initial:

find . -type d -exec chown www-data:www-data {} \; && find . -type f -exec chown www-data:www-data {} \;

Does this return ok?

It worked but I had to run it as root user.
I did again ./bin/console suitecrm:app:install but still got last same error message

Please share screenshots that you are doing on terminal. So we could help you more.

I have to say I’m still a bit clueless about this install ran on the terminal

Why don’t you just access the browser and do the install from there? What error shows now, that the file permissions are supposedly correct?

Thanks all for your support (very much appreciated).

I attached screenshot when trying to do it via CLI.

With Web browser, I got a blank screen (nothing is happening). I use http://localhost (redirected to http:://localhost/index.php)

Note: I didn’t mention that there was a message about PHP deprecated (I suppose it should work even if this message is displayed).

What is your PHP version?

If this is just a development server I would reboot it to see if there is something locking your file. If it’s not that, then it must be permissions issues, you probably still don’t have that quite right…