3

So I am using WAMP with the latest version and Im currently running a project with url http://localhost:8080 since I am using php -S localhost:8080 to run my app.

The computer's ip address is 192.168.1.4 and I access it through another computer by using IPAddress/phpmyadmin for testing. It works.

Now my problem is, how can I do that with a port? I tried 192.168.1.4:8080 but no luck.

Any help would be much appreciated.

wobsoriano
  • 12,348
  • 24
  • 92
  • 162

5 Answers5

0

First you need ip address then after colon you need to mention port number.

192.168.1.4:8000/WebDirectory

You need to replace "WebDirectory" with that directory name where you script is saved. If you script is in root directory then you don't need to "WebDirectory" or any other directory name. In this case you will use just ip address and port number after colon.

192.168.1.4:8000
  • I dont want to access the database. I am currently running an app with address localhost:8000 – wobsoriano Jan 30 '17 at 06:15
  • @FewFlyBy i have updated my answer. Please let me know, now can you access it ? –  Jan 30 '17 at 06:19
  • No dude haha i dont want to access phpmyadmin. I can access it directly with 192.168.1.4/phpmyadmin. My problem is that I have a website that runs with localhost:8000 and i dont know how to access it on another computer – wobsoriano Jan 30 '17 at 06:21
  • @FewFlyBy PhpMyAdmin was just example. you have to replace PhpMyAdmin with that folder where you script is saved. –  Jan 30 '17 at 06:23
0

you need to make a change in httpd.conf file.

#your root directory address in full

Directory "C:/WAMP/www"

Order allow, deny

Allow from all

Directory

After changing, you need to restart your WAMP server. then you can access from out side your own machine

AmitChaudhary
  • 151
  • 2
  • 15
0

If you are using php -S localhost:8080 to run your site then you are not using Apache to run the site you are using PHP's inbuilt dev server. You cannot use that remotely.

If you can access phpMyAdmin from another PC on your lan using ipaddress/phpMyAdmin then that is using Apache & PHP and doing so on Port 80.

Then assuming you have your site code in wamp\www\folder you should be able to run your site from another PC using the url ipaddress/folder and that will be using Apache and of course the default port 80

You should also read The need for Virtual Hosts on the WAMPServer forum and create a Virtual Host for each of your sites/developments

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Problem is that I am using a framework (makoframework) and if I put it in www the routes and asset files will not work properly – wobsoriano Feb 02 '17 at 04:21
0

To access the built-in php server from another computer, this is what worked for me:

1.- Navigate on the terminal to locate the folder of your php project. Let's say we have a folder named myFolder containing the file home.php

2.- Find your ipv4 ( ipconfig on Windows or ip addr on ubuntu). Let's say you get: 192.168.9.8

3.- Start the php buil-in server by using any port (for example 4000, 4800, 8000, etc. ): php -S 192.168.9.8:4800

4.- Now you can access your project by typing http://192.168.9.8:4800/home.php from other devices within your private network.

You can also read from the documentation: https://www.php.net/manual/en/features.commandline.webserver.php

Valdemar
  • 221
  • 2
  • 4
0

You can make the web server accessible on port 8080 to any interface with:

php -S 0.0.0.0:8080

Warning

The built-in Web Server should not be used on a public network.

You can see this for more information

Abdulwehab
  • 1,356
  • 2
  • 10
  • 12