Hello, we want to migration a SYMFONY project on a UBUNTU / CPANEL server to our ENHANCE Cluster.
But we are facing some problems and are unable to figure out why and how to solve them...
Our migration process took place in two major phases: stabilizing the web server (Apache/PHP), and then stabilizing the database connection (MariaDB/Doctrine).
--- Phase 1: Resolving the "403 Forbidden" Bug (SOLVED, I just include it here in case it's the cause / origine of the remaining problem)
The main initial obstacle was a 403 Forbidden error code that prevented access to our Symfony site's main URL.
Step Taken: File System Permissions
Corrective Action: We changed the ownership of the project files to www-data:www-data and corrected the permissions (folders 775, files 664) to grant rights to the Apache user.
Success Achieved: The www-data user was able to read and browse the project directory, eliminating the first cause of the 403 error.
Step Taken: Parent Directory Blockage
Corrective Action: We changed the group of the parent directory (/var/www/e3ad1fe0-c1df-4741-a5b0-f98772983460/) to www-data and applied browse permissions (775).
Success Achieved: Access to the application root became possible for the Apache user.
Step Taken: Apache Authorization
Corrective Action: We added the AllowOverride All directive in the <Directory> block of the Apache VirtualHost.
Success Achieved: Apache was authorized to read and apply the rewrite rules defined in the .htaccess file.
Step Taken: .htaccess Path Correction
Corrective Action: We moved the .htaccess file into the /public folder and modified the rewrite rule to point correctly to index.php.
Success Achieved: Our Symfony site was able to correctly execute the index.php front controller, resolving the 403 error and making the site accessible.
--- Phase 2: Stabilizing the MariaDB Connection (UNSOLVED... NEED HELP / ADVISE)
Once the site was accessible, our console tools (php bin/console) encountered database connection errors.
Step Taken: Socket Connection
Problem Diagnosed (Error Code): SQLSTATE[HY000] [2002] No such file or directory
Solution Applied: We updated the DATABASE_URL to change from localhost to the server's IP (62.84.176.99), forcing a TCP/IP connection.
Step Taken: Internal Host Issue
Problem Diagnosed (Error Code): Host '10.xx.0.xx' is not allowed
Solution Applied: We identified the application's internal IP (10.169.0.1) and added this IP to the list of allowed hosts for the "espace_a1_user" (the website's db user) user in the database control panel.
Step Taken: Cache Clearing
Problem Diagnosed: The application was not using the new DATABASE_URL with the internal IP (10.169.0.1).
Solution Applied: We ran the php bin/console cache:clear command to force Symfony to load the new environment variable.
--- Current Status: Connection Refused Bug 🛑 ---
Despite all these successes, our current problem is the recurring error:
An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused
Current situation:
User permissions are set (10.xx.0.xx is authorized).
The application configuration is up-to-date (it is using 10.xx.0.xx).
The MariaDB server is still refusing the connection.
What are we doing wrong please ?