Hello there, I installed PHP & MariaDB via docker.
So when I run ‘bin/cake server’ command it tells ‘built-in server is running in http://localhost:8765/’.
But when I type this URL, the browser shows:
‘can’t reach this page
localhost refused to connect’.
Do I still need a real web server for this to work?
This could be due to e.g. a firewall blocking HTTP requests to localhost
But as you can see in my tutorial series this should work fine without a problem.
I tried turning off the Windows firewall but it still not working.
How did you install PHP and execute composer?
Its been a long time since I tried that on Windows but I remember it being rather straight forward with XAMPP which has its own Apache webserver and MariaDB
Also see Installation - 4.x on how to correctly set the docroot (which should be the webroot
folder)
Then you don’t need to run the bin/cake server
command since you are running a proper webserver.
I’m wondering if it has something to do with the specific PHP tag being installed(from, cli, etc). I used Dockerfile to install php:8.2.0-fpm, and composer, then used composer to install CakePHP. It was working in combination of PHP+nginx, I just decided to test PHP development server.
Document root is pointed to webroot as well👇
you are inside docker, not windows. Therefore localhost
isn’t Windows but the container.
I’d recommend you get a bit more acostumed to Docker because your problem is associated to your docker setup, not CakePHP
As @KevinPfeifer mentioned, the issue is with your docker setup not CakePHP. The server is running on port 8765 inside the container, not host machine. You have to map the port using -p 8765:8765
option when you start the docker container.