The server command is not working when a directory is given
leocavalcante opened this issue · 18 comments
**phpctl server 8000 ./public**
Running opencodeco/phpctl:php82
[Thu Feb 1 21:56:35 2024] PHP 8.2.15 Development Server (http://0.0.0.0:8000) started
Chrome show as: ERR_CONNECTION_REFUSED
http://127.0.0.1:8000
http://localhost:8000
Originally posted by @fhferreira in #9 (comment)
@leocavalcante same here!
I ran phpctl self-update
to make sure everything was up-to-date and it looks fine!
Adding details:
MAC OS + Valet Installed (nginx/dnsmaq/php7.4)
@leocavalcante just for understand, did you install "valet" first? and start it?
I think it is some conflict between valet (dnsmaq/nginx) and frankenphp/phpctl serve
Don't see where Valet comes into play for phpctl server
, it is just a Facade for php -S
inside the phpctl container.
Let me try with Valet installed.
Just got that message.
Valet only supports the Mac operating system.
In-fact, I'd say that Valet is not compatible with phpctl
because phpctl
runs on top of Linux-Alpine images and Valet seams to work only in macOS.
And it is working just fine, even with Valet installed, which is expected since there is no interaction between running phpctl server
(or any other phpctl
command) with the valet
script at ~/.composer/vendor/bin
.
Please, check if there isn't a bind to 8000
already. Try a different random port like:
phpctl server 8765 ./public
http://127.0.0.1:8765
http://localhost:8765
both same error: ERR_CONNECTION_REFUSED
Even showing:
[Tue Feb 6 21:37:00 2024] PHP 8.2.15 Development Server (http://0.0.0.0:9765) started
What is in ./public
and what appears when you run docker ps
while the server is running?
public has a project with latest laravel version
phpctl server 8765 ./public
[Wed Feb 7 00:11:40 2024] PHP 8.2.15 Development Server (http://0.0.0.0:8765) started
The docker ps show:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ecb4e1834d67 opencodeco/phpctl:php82 "sh -c 'php -S 0.0.0…" 39 seconds ago Up 39 seconds phpctl_40c816338f1b
dc73ab98bc54 99f89471f470 "/storage-provisione…" 3 days ago Up 3 days k8s_storage-provisioner_storage-provisioner_kube-system_f7f50e77-20df-46b0-b8a3-e371c6a4daad_7
e38b499d4ac3 556098075b3d "/kube-vpnkit-forwar…" 3 days ago Up 3 days k8s_vpnkit-controller_vpnkit-controller_kube-system_46ee46f2-a2c8-44cc-8b97-2a9fc9b5e02a_4
341b05e5f937 ead0a4a53df8 "/coredns -conf /etc…" 3 days ago Up 3 days k8s_coredns_coredns-5dd5756b68-k6ngg_kube-system_8d254664-0cd9-4cc4-8e82-ce49f7f205dc_4
92d41ab66308 ead0a4a53df8 "/coredns -conf /etc…" 3 days ago Up 3 days k8s_coredns_coredns-5dd5756b68-7rjpz_kube-system_cea5b902-467b-47cf-8ed4-db55b326a2e7_4
21cff309c16f c120fed2beb8 "/usr/local/bin/kube…" 3 days ago Up 3 days k8s_kube-proxy_kube-proxy-fshtw_kube-system_5215e2f4-1700-4056-bfd7-eb950e56d8a2_4
72033c72c1ba registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_vpnkit-controller_kube-system_46ee46f2-a2c8-44cc-8b97-2a9fc9b5e02a_4
12661cac9351 registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_storage-provisioner_kube-system_f7f50e77-20df-46b0-b8a3-e371c6a4daad_4
0e63ce8e9b11 registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_coredns-5dd5756b68-k6ngg_kube-system_8d254664-0cd9-4cc4-8e82-ce49f7f205dc_4
cf55000db3c2 registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_coredns-5dd5756b68-7rjpz_kube-system_cea5b902-467b-47cf-8ed4-db55b326a2e7_4
2efa80f8d0ba registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_kube-proxy-fshtw_kube-system_5215e2f4-1700-4056-bfd7-eb950e56d8a2_4
744dab58393d 7a5d9d67a13f "kube-scheduler --au…" 3 days ago Up 3 days k8s_kube-scheduler_kube-scheduler-docker-desktop_kube-system_1ee6a7ec32eae6f5618962896aecb119_4
42417b02415e 55f13c92defb "kube-controller-man…" 3 days ago Up 3 days k8s_kube-controller-manager_kube-controller-manager-docker-desktop_kube-system_bb03e46a28a7e9d525994111b43870c9_4
74f2635331a9 73deb9a3f702 "etcd --advertise-cl…" 3 days ago Up 3 days k8s_etcd_etcd-docker-desktop_kube-system_9564c0b6c2ed03f8021e5adc73583688_4
033f17b03990 cdcab12b2dd1 "kube-apiserver --ad…" 3 days ago Up 3 days k8s_kube-apiserver_kube-apiserver-docker-desktop_kube-system_2768abb6b8ce05d1a5b70f0a69aca592_4
8a3d8bc826bd registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_etcd-docker-desktop_kube-system_9564c0b6c2ed03f8021e5adc73583688_4
c1c3d7db77f4 registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_kube-controller-manager-docker-desktop_kube-system_bb03e46a28a7e9d525994111b43870c9_4
c12e77ae4cf4 registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_kube-scheduler-docker-desktop_kube-system_1ee6a7ec32eae6f5618962896aecb119_4
58475dc98dcd registry.k8s.io/pause:3.9 "/pause" 3 days ago Up 3 days k8s_POD_kube-apiserver-docker-desktop_kube-system_2768abb6b8ce05d1a5b70f0a69aca592_4
the same error with
phpctl php artisan serve
apparently I cannot access the port externally
Can you please try without phpctl
?
Something like
docker run --net host -v $(pwd):/app -w /app php -S 0.0.0.0:8765 -t ./public
This will call docker
directly using the official PHP image. No phpctl
involved. If it still doesn't work we can discard something in phpctl
.
sure, same error here:
docker run --net host -v $(pwd):/app -w /app php -S 0.0.0.0:8765 -t ./public
Unable to find image 'php:latest' locally
latest: Pulling from library/php
c57ee5000d61: Pull complete
e8c14b2bf4d5: Pull complete
8ce454101f9e: Pull complete
5cc00f80902c: Pull complete
9c93b039e2f6: Pull complete
8e322fa51f82: Pull complete
5f30cef47716: Pull complete
827545b65ad8: Pull complete
2adcc917f3c8: Pull complete
Digest: sha256:fc30b665b620e6c0094cca72259ebf16bea4874719c792aba1c87aacb08f1e29
Status: Downloaded newer image for php:latest
[Wed Feb 7 17:59:07 2024] PHP 8.3.2 Development Server (http://0.0.0.0:8765) started
tried with:
localhost and 127.0.0.1
Yeah. Sorry, man. It looks like something out of the phpctl
scope.
No worry, tks for try.
I will see if I discover it soon.