Remote PHP Interpreter with Docker Compose
I have configured debugger as described in documentation, but still have this issue.
and here is idea.log data I get.
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose\cli\main.py", line 81, in main
File "compose\cli\main.py", line 196, in perform_command
File "compose\metrics\decorator.py", line 18, in wrapper
File "compose\cli\main.py", line 440, in config
File "c:\python39\lib\encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode character '\u0422' in position 55: character maps to <undefined>
[12364] Failed to execute script docker-compose
at com.intellij.docker.remote.DockerComposeCredentialsEditorLanguageContribution.getDockerComposeConfigurationInfo(DockerComposeCredentialsEditorLanguageContribution.java:67)
at com.intellij.docker.remote.DockerComposeCredentialsEditor.lambda$updateServiceNameComboBox$2(DockerComposeCredentialsEditor.java:131)
at com.intellij.docker.remote.DockerComposeCredentialsEditor$2.run(DockerComposeCredentialsEditor.java:155)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:962)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:472)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)
Does anybody know what is the problem?
Please sign in to leave a comment.
Would it be possible to share a copy of your 'docker-compose.yml' file?
Sure
Thanks for sharing the file. Actually, it works perfectly fine for me:
Just in case, what version of Docker/Docker Compose do you have installed?
(could be checked in "File | Settings | Build, Execution, Deployment | Docker | Tools")
Here is what I see in Docker->Tools. It's 1.29.0
Please try the following simple 'docker-compose.yml' file on your setup, would it work fine?
No, nothing new. When I start listening for PHP debug connections I get into index.php
but doesn't get into the function where my breakpoint is. And I still have this issue what I described in first comment.
Hm, actually, IDE PHP CLI Interpreter configuration has nothing to do with web debugging and there is no need to configure the interpreter in IDE for that.
Back to the original issue, do I understand it correctly that you were able to add PHP CLI Interpreter from my "docker-compose.yml" file and it was read fine?
This is my steps that I make:
In CLI Interpreters I click +, then From Docker, Vagrant, VM, WSL... -> in new pop-up I choose Docker Compose and get same error as in original issue. And I use your docker-compose.yml.
Could you please confirm that 'docker-compose' works fine on your system apart from the IDE?
This is what I get when I run docker compose up
C:\dev\Тeha\teha-backend>docker compose up
level=warning msg="Found orphan containers ([teha-backend_test001_1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
[+] Running 4/4
- Container pg-docker Recreated 0.8s
- Container teha-backend_admin_1 Recreated 0.7s
- Container teha-backend_web_1 Recreated 0.7s
- Container teha-backend_pgadmin_1 Recreated 0.4s
Attaching to pg-docker, admin_1, pgadmin_1, web_1
admin_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using {port}. Set the 'ServerName' directive globally to suppress this message
admin_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using {port}. Set the 'ServerName' directive globally to suppress this message
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using {port}. Set the 'ServerName' directive globally to suppress this message
admin_1 | [Fri May 28 17:26:58.772480 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.15 configured -- resuming normal operations
admin_1 | [Fri May 28 17:26:58.772550 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
web_1 | [Fri May 28 17:26:58.890680 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.15 configured -- resuming normal operations
web_1 | [Fri May 28 17:26:58.890757 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
pg-docker |
pg-docker | PostgreSQL Database directory appears to contain a database; Skipping initialization
pg-docker |
pg-docker | 2021-05-28 14:27:03.659 GMT [1] LOG: starting PostgreSQL 12.2 (Debian 12.2-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
pg-docker | 2021-05-28 14:27:03.659 GMT [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
pg-docker | 2021-05-28 14:27:03.660 GMT [1] LOG: listening on IPv6 address "::", port 5432
pg-docker | 2021-05-28 14:27:03.713 GMT [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
pg-docker | 2021-05-28 14:27:03.945 GMT [27] LOG: database system was interrupted; last known up at 2021-05-28 14:26:06 GMT
pg-docker | 2021-05-28 14:27:32.103 GMT [27] LOG: database system was not properly shut down; automatic recovery in progress
pg-docker | 2021-05-28 14:27:32.262 GMT [27] LOG: redo starts at 0/3AFF910
pg-docker | 2021-05-28 14:27:32.282 GMT [27] LOG: invalid record length at 0/3AFF9F8: wanted 24, got 0
pg-docker | 2021-05-28 14:27:32.283 GMT [27] LOG: redo done at 0/3AFF9C0
pg-docker | 2021-05-28 14:27:32.863 GMT [1] LOG: database system is ready to accept connections
pgadmin_1 | NOTE: Configuring authentication for SERVER mode.
pgadmin_1 |
pgadmin_1 | [2021-05-28 14:27:53 +0000] [1] [INFO] Starting gunicorn 20.0.4
pgadmin_1 | [2021-05-28 14:27:53 +0000] [1] [INFO] Listening at: http://[::]:80 (1)
pgadmin_1 | [2021-05-28 14:27:53 +0000] [1] [INFO] Using worker: threads
pgadmin_1 | [2021-05-28 14:27:53 +0000] [89] [INFO] Booting worker with pid: 89
pgadmin_1 | 2021-05-28 14:28:29,437: ERROR pgadmin: 400 Bad Request: The CSRF session token is missing.
pgadmin_1 | Traceback (most recent call last):
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 256, in protect
pgadmin_1 | validate_csrf(self._get_csrf_token())
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 94, in validate_csrf
pgadmin_1 | raise ValidationError('The CSRF session token is missing.')
pgadmin_1 | wtforms.validators.ValidationError: The CSRF session token is missing.
pgadmin_1 |
pgadmin_1 | During handling of the above exception, another exception occurred:
pgadmin_1 |
pgadmin_1 | Traceback (most recent call last):
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask/app.py", line 1948, in full_dispatch_request
pgadmin_1 | rv = self.preprocess_request()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask/app.py", line 2242, in preprocess_request
pgadmin_1 | rv = func()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 224, in csrf_protect
pgadmin_1 | self.protect()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 259, in protect
pgadmin_1 | self._error_response(e.args[0])
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 302, in _error_response
pgadmin_1 | raise CSRFError(reason)
pgadmin_1 | flask_wtf.csrf.CSRFError: 400 Bad Request: The CSRF session token is missing.
pgadmin_1 | ::ffff:172.18.0.1 - - [28/May/2021:14:28:29 +0000] "GET /dashboard/dashboard_stats/1/16384?chart_names=session_stats,tps_stats,ti_stats,to_stats,bio_stats HTTP/1.1" 400 150 "http://localhost:8800/browser/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
pgadmin_1 | ::ffff:172.18.0.1 - - [28/May/2021:14:29:04 +0000] "GET /dashboard/dashboard_stats/1/16384?chart_names=session_stats,tps_stats,ti_stats,to_stats,bio_stats HTTP/1.1" 400 150 "http://localhost:8800/browser/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
pgadmin_1 | 2021-05-28 14:29:04,878: ERROR pgadmin: 400 Bad Request: The CSRF session token is missing.
pgadmin_1 | Traceback (most recent call last):
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 256, in protect
pgadmin_1 | validate_csrf(self._get_csrf_token())
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 94, in validate_csrf
pgadmin_1 | raise ValidationError('The CSRF session token is missing.')
pgadmin_1 | wtforms.validators.ValidationError: The CSRF session token is missing.
pgadmin_1 |
pgadmin_1 | During handling of the above exception, another exception occurred:
pgadmin_1 |
pgadmin_1 | Traceback (most recent call last):
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask/app.py", line 1948, in full_dispatch_request
pgadmin_1 | rv = self.preprocess_request()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask/app.py", line 2242, in preprocess_request
pgadmin_1 | rv = func()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 224, in csrf_protect
pgadmin_1 | self.protect()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 259, in protect
pgadmin_1 | self._error_response(e.args[0])
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 302, in _error_response
pgadmin_1 | raise CSRFError(reason)
pgadmin_1 | flask_wtf.csrf.CSRFError: 400 Bad Request: The CSRF session token is missing.
pgadmin_1 | 2021-05-28 14:30:04,845: ERROR pgadmin: 400 Bad Request: The CSRF session token is missing.
pgadmin_1 | Traceback (most recent call last):
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 256, in protect
pgadmin_1 | validate_csrf(self._get_csrf_token())
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 94, in validate_csrf
pgadmin_1 | raise ValidationError('The CSRF session token is missing.')
pgadmin_1 | wtforms.validators.ValidationError: The CSRF session token is missing.
pgadmin_1 |
pgadmin_1 | During handling of the above exception, another exception occurred:
pgadmin_1 |
pgadmin_1 | Traceback (most recent call last):
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask/app.py", line 1948, in full_dispatch_request
pgadmin_1 | rv = self.preprocess_request()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask/app.py", line 2242, in preprocess_request
pgadmin_1 | rv = func()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 224, in csrf_protect
pgadmin_1 | self.protect()
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 259, in protect
pgadmin_1 | self._error_response(e.args[0])
pgadmin_1 | File "/venv/lib/python3.8/site-packages/flask_wtf/csrf.py", line 302, in _error_response
pgadmin_1 | raise CSRFError(reason)
pgadmin_1 | flask_wtf.csrf.CSRFError: 400 Bad Request: The CSRF session token is missing.
pgadmin_1 | ::ffff:172.18.0.1 - - [28/May/2021:14:30:04 +0000] "GET /dashboard/dashboard_stats/1/16384?chart_names=session_stats,tps_stats,ti_stats,to_stats,bio_stats HTTP/1.1" 400 150 "http://localhost:8800/browser/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
Would it be possible to enable the extended PHP logging, reproduce the error message both with mine and yours 'docker-compose.yml' files and collect & upload log files?
To extend the log level, please add the following line to the "Help > Diagnostic Tools > Debug Log Settings":
#com.jetbrains.php
Afterwards, you may upload log files to JetBrains upload services:
https://uploads.jetbrains.com/
I hope that can help to get closer to the solution.
Upload id: 2021_05_29_XHQJyVRr8JyFwnDX (files: with_your_yml_file_logs.txt, with_my_yml_file_logs.txt)
Sorry about the delay and thank you for sharing the log files.
In the meanwhile, I have managed to reproduce the issue on my side. It looks like your project path has a non-Latin "T" in its name:
I have tried to create a similar path with Cyrillic Т instead of a Latin T and got exactly the same message. Could you please try to rename the directory and check if it helps?
Hi and thank you! It was very helpful. But after all I have another issue
It says that PHP and debugger not installed, but in another interpreter I can see versions of both.
I hope I can find solution for that.
Again, thank you for your help Vasiliy!
I build my docker-compose up and this solved my issue.
Fantastic, thank you for the update, I am happy to hear that things work fine now.
I don't know should I open new issue. I was able to use debugger yesterday, but today debugger stops only in php.info if I choose Break at first line in PHP scripts, but doesn't stop on breakpoints. And the event log shows this information
Googling didn't help much, but someone fixed this issue with downgrading Xdebug version. Even if it can help, I don't understand why debugger stopped working with breakpoints.
Please try to remove server records from the "PHP > Servers" and start the debug session again. Would the "Incoming connection" message appear?
After removing server I wanted to listen, this message appeared
Does the remote debugging work now after re-adding mappings anew?
I am very grateful for your help, Vasiliy! Now everything works as it should.