0

I have a strange problem, that I can't spin up a php server on my machine.

I just want to access my php app remotely.

Firstly I have root access on server, and using ufw for port management. (It doesn't work also when ufw inactive)

I allowed ports like 80,8000,7171 which I used on ufw.

When I try to spin up a php server I usually type php -S localhost:8000

if I want to access the server remotely php -S 0.0.0.0:8000 then get an log screen like this.

[Sun Jan  9 20:16:03 2022] PHP 7.4.3 Development Server (http://0.0.0.0:8000) started
 
Listening on 0.0.0.0:8000

And I can access the server both localy and remotely.

For now if I use localhost or 127.0.0.1 I can access my files locally. But remote access still doesn't work.

By the way I can't see the Listening... part. This could cause this problem? Have you any ideas?

My system information

php -v
PHP 7.4.3 (cli) (built: Nov 25 2021 23:16:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Linux kernel  5.4.0-84-generic 
Description: Ubuntu 20.04.3 LTS

I am using Godaddy's vps. I contact them. But can't resolve.

Is there a way about check firewall or something else blocking my requests?

SOLVED!

Finally found the problem! As you guess, it was firewall. Neither ufw nor iptables solved my problem. Then I found the answer here

https://stackoverflow.com/a/49722535/5481342

This command in answers solved my problem. firewall-cmd --list-ports

I only see the ssh port as my expect.

Then I add firewall-cmd --add-port=7171/tcp --permanent

and don't forget to firewall-cmd --reload now works!!

Thank you all for your comments. I hope this question will be helpful.

Thanks.

msalihbindak
  • 592
  • 6
  • 21

1 Answers1

0

The reason I think this is a firewall problem is because:

For now if I use localhost or 127.0.0.1 I can access my files locally. But remote access still doesn't work.

It indicates that the PHP service has been started and the port is opened correctly.

yes I can ping the IP

It indicates that the network between the local computer and the server is unblocked.

So only a firewall will block your access, but I'm just not sure which one is.

shingo
  • 18,436
  • 5
  • 23
  • 42