Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contao 4 on IIS can't connect to database #1324

Closed
CaptinJackSparow opened this issue Jan 18, 2018 · 9 comments
Closed

Contao 4 on IIS can't connect to database #1324

CaptinJackSparow opened this issue Jan 18, 2018 · 9 comments
Assignees
Labels
Milestone

Comments

@CaptinJackSparow
Copy link

CaptinJackSparow commented Jan 18, 2018

I'm trying to run Contao 4 on IIS and get it to connect to a database on a different machine. I can connect to it when running MAMP on my Mac.
I can also connect to the database server from the same machine I'm trying to install Contao 4 on, with an older version of Contao.
I would like Contao to show or log why it can't connect to the database.

@leofeyer
Copy link
Member

leofeyer commented Feb 6, 2018

Did you check the log files?

@CaptinJackSparow
Copy link
Author

I tried, but there are no log files.

@leofeyer
Copy link
Member

leofeyer commented Feb 6, 2018

Please try it in debug mode (app_dev.php).

@fritzmg
Copy link
Contributor

fritzmg commented Feb 6, 2018

I can confirm that any error regarding the database connection in the install tool will not be logged or displayed anywhere, even in the dev environment. There will be no log entry and Symfony's profiler will also show no reason for the failed connection.

This should definitely be changed. It's important to know the actual error text and code of the failed connection attempt in order to figure out the problem.

@CaptinJackSparow
Copy link
Author

CaptinJackSparow commented Feb 6, 2018

Okay, well I guess I have more issues then that. I believe I was getting the "Could not connect to database" error because I had gone through a domain to the install. When I try to go through localhost, I can't login. (To the contao install)
On the one install of 4.4 I am getting an invalid token request.

On a fresh install of 4.5.3 (manual or composer) I type my password in and it just reloads the page and continues to ask for the password. It doesn't say invalid password or anything like that.
It shows this for depreciations but no errors.

Time Channel Message
10:11:13
php User Deprecated: Using the Contao\RequestToken class has been deprecated and will no longer work in Contao 5.0. Use the Symfony CSRF service via the container instead.
Show context Show trace
10:11:13
php User Deprecated: The "contao.install_tool" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
Show context Show trace
10:11:13
php User Deprecated: The "contao.install_tool_user" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
Show context Show trace

@CaptinJackSparow
Copy link
Author

An update...
I changed the php version to 7.2 and now I can login to the install through localhost.
However, here is all the info it gives when I try to connect to the database.

Depreciations

Time Channel Message
18:00:09
php User Deprecated: Using the Contao\RequestToken class has been deprecated and will no longer work in Contao 5.0. Use the Symfony CSRF service via the container instead.
Show context Show trace
18:00:09
php (2 times) User Deprecated: The "contao.install_tool" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
Show context Show trace
18:00:09
php User Deprecated: The "contao.install_tool_user" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.
Show context Show trace

Then under errors and info it shows this

INFO
18:00:09
request Matched route "contao_install".
Hide context
[▼
"route" => "contao_install"
"route_parameters" => [▼
"_scope" => "backend"
"_token_check" => true
"_controller" => "Contao\InstallationBundle\Controller\InstallationController::installAction"
"_route" => "contao_install"
]
"request_uri" => "http://localhost/contao/install"
"method" => "POST"
]

Now it's also printing this in the log:

[2018-02-06 18:09:18] request.INFO: Matched route "contao_install". {"route":"contao_install","route_parameters":{"_scope":"backend","_token_check":true,"_controller":"Contao\InstallationBundle\Controller\InstallationController::installAction","_route":"contao_install"},"request_uri":"http://localhost/contao/install","method":"POST"} []
[2018-02-06 18:09:19] request.INFO: Matched route "_wdt". {"route":"_wdt","route_parameters":{"_controller":"web_profiler.controller.profiler:toolbarAction","token":"6af897","_route":"_wdt"},"request_uri":"http://localhost/_wdt/6af897","method":"GET"} []

@CaptinJackSparow
Copy link
Author

Well I have figured out finally why it wouldn't connect... I browsed the "main page" and saw something about pdo connection. So I checked my php settings and pdo_mysql was disabled.
Something that I think should be added to the contao check would be to check if that is enabled or not... would have helped. :)

Now, I have yet another problem. When using the app.php the backend theme won't display, however when using the app_dev.php it shows? There's no css at all. It does give a contao message saying that javascript is disabled, but it isn't. There are no error logs either.

At least I'm getting closer though :)

@CaptinJackSparow
Copy link
Author

Okay, another update on the css... Maybe I should post it in a new issue, because it seems to be related to Contao 4.5, as I've put Contao 4.4 on and it's all working now. :D

@leofeyer leofeyer added this to the 4.4.14 milestone Feb 12, 2018
@leofeyer leofeyer self-assigned this Feb 13, 2018
leofeyer added a commit to contao/installation-bundle that referenced this issue Feb 13, 2018
@leofeyer
Copy link
Member

This should definitely be changed. It's important to know the actual error text and code of the failed connection attempt in order to figure out the problem.

Fixed in contao/installation-bundle@9ca96ed.

@leofeyer leofeyer modified the milestones: 4.4.14, 4.4 May 14, 2019
leofeyer added a commit that referenced this issue Feb 14, 2020
Description
-----------

Fixes #1205 

<img width="550" alt="" src="https://user-images.githubusercontent.com/1192057/74481571-43b0e380-4eb3-11ea-9bfa-3a5eb743441a.png">

Commits
-------

42f85a4e Sort the back end menu items alphabetically by label (see #1205)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants