How to access my Wamp Server on another Local Computer - php

How can i access my local wamp server on another computer
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
i use this code in http.config file but not work

You could simply use the Put Online option of your WAMP Server and you can use this current system IP address and to directly access from the other computer.
Do this on system tray
Then, you could find your IP address using typing ipconfig or whatismyip.com website and then access it on another system.

As you are able to access it from the local computer that run the server by http://localhost you have two options to access it from your local area network LAN:
Using the local IP of the computer for example: http://192.168.1.20
Using the computer name for example: http://computer1/
To know your current IP:
Start -> in search field write cmd and hit enter to open the command line -> in the command line write: ipconfig you will get something like that:
Your computer IP address is the value of IPv4 Address.
To know your computer name just right click on the computer icon in the start menu then choose properties to get this screen shot:
However, for computer name method you have to be sure that every computer in your LAN has a unique name.
Update
There are some routers firmware supports local DNS on the router, so you have not need to edit the hosts files for every machine in the network. For example that I already have, dd-wrt firmware on Linksys WRT54G:

Mine wasn't working before when I tried using my computer's IP in the URL.
I found the reason to be the line in httpd.conf:
ServerName localhost:80
which I updated to be
ServerName {My comp's IP}:80

Step 1 : Press window button + R at the same time which opens the run tool of Windows.
Step 2 : Write CMD, then press 'Enter' button. This operation opens CMD terminal.
Step 3 : Then write 'ipconfig' command
Step 4 : Then note your ipv4 Address : 192.168.x.x (From Wireless Lan Adapter Wi-Fi Header) (This Ip address is needed by other computers in the place of localhost in URL)
Step 5 : Go to phpmyadmin.conf file of hosting system(Where wamp is installed...File path -> C:\wamp\alias\phpmyadmin.conf)
Step 6 : Replace this statement
<ifDefine APACHE24>
Require local
</ifDefine>
<ifDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from localhost ::1 127.0.0.1
</ifDefine>
with
Require local
Require ip 192.168.0
Note : (If your Ip is something like 192.147.x.x) then you write 'Require 192.147.0' instead of 'require 192.168.0')
Step 7 : Restart your Wamp server
Step 8 : Enter the link 192.x.x.x/phpmyadmin in the url bar of your own system from which you want to access the hosting wamp server
Step 9 : End.

If you just need to access the wamp server from another LAN PC, as some of the answers have pointed out, you can use the LAN IP or Computer-Name in the URL, as long as VirtualHost's ServerName or ServerAlias directive contains that LAN IP or Computer-Name (so Apache can return the correct website).
But if you need to use a domain-name, you'll have to edit every PC's Hosts file and update it with the correct domain-name to LAN IP address resolve (and make sure that LAN IP is assigned each time to the correct device by the Router).
Though there are much better solutions that will work for all devices (including Mac, Linux, mobile devices such as iPhones, Android phones, etc) if you have a WiFi Router that can either be flashed with one of the open firmwares or is already capable of DNS Masquerading as outlined here: Accessing Websites on a Local Network (LAN) Web Server. "DNS Masquerading" (in this context) is basically using the WiFi Router's own "Hosts file" to do the domain-name to LAN IP resolve.

Hope this helps
I couldn't connect event after doing all the above-mentioned steps. Then I uninstalled my current wampserver (3.0 version) and installed 2.5 version of wampserver. And it worked perfectly. You just need to click on 'Put Online' and you are done. Others can access your server by putting your ip address in the URL instead of localhost.

stop the wamp server and open C:\wamp64\bin\apache\apache2.4.41\conf\extra\httpd-vhosts.conf
replace
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
add
Require all granted
above the Directory closing tag.
Then turn off the windows firewall for [domain, private,
public] networks in my case only [private network] works
Re-Start wamp server

Related

access xampp server from other PC over LAN

I just downloaded the latest XAMPP version installed it on my new PC.
however I cannot access the local webserver via browser(Google Chrome) from another PC on my LAN.
I allowed MySQL and Apache through my Firewall.
setup a static IP on my server PC. (192.168.1.130)
I also changed the configuration of httpd.conf file
from
<Directory />
AllowOverride none
Require all denied
</Directory>
to
<Directory />
AllowOverride All
Require all denied
</Directory>
then I restarted apache.. still cannot access it via IP or Computer name.
Okay so after tons of searches, I finally found an answer, here's what I did..
Go into the Windows Firewall settings and click the "Advanced" button, and in the next dialog click "Inbound Rules" - click "New Rule"
In the rule type window, choose Port
In the program window, leave All Programs selected
In protocols and ports, leave protocol as TCP, and Local Ports should be "Specific Ports", enter 80,443
In the scope window, don't enter any specific ip addresses
In the action window, Allow the Connection
In the profile window, leave them all ticked
And finally, in the name, call it something useful, like HTTP_ports
credits to this link

wordpress domain name not working on lan + wamp server

i setup my wordpress site on my computer by using wamp server and every thing is ok ,
i can access my site via lan or wan by using the ip address like :
192.168.1.11/site
my host file like this :
127.0.0.1 demo.it
127.0.0.1 www.demo.it
192.168.1.11 demo.it
my vhost file like this
<VirtualHost *:80>
ServerName demo.it
DocumentRoot "c:/wamp/www/point"
<Directory "c:/wamp/www/point">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
i can browse the site on my computer by using the domain (demo.it) , but it's not working from other machine
help please
sorry for my english :)
You will have to enter the IP address of your local machine and the domain name as you have in your hosts file into any machine that wants to access your local wamp server.
192.168.1.11 demo.it
Of course, first the other machines must be able to reach 192.168.1.11, but as you said, they can access your site from http://192.168.1.11/site so that must mean they can reach you.
Just check via ping to be double sure. Open Command prompt and check output of
ping 192.168.1.11
If you can, there might be a way to configure your router or switch such that specific domain requests are routed to your IP address, but I don't know how to do it.

Are there cmd prompts to quickly change httpd.conf DocumentRoot directories

I have multiple websites in folders that I need to switch back and forth too constantly. Each time I have to go to the httpd.conf file to find them and change DocumentRoot and Directory lines. I was wondering if there is a faster way to do this, maybe with a cmd prompt? Or maybe a php inc file I can create.
Thanks.
You would be much better off setting all your sites up as Virtual Hosts. They are always available and you dont have to change anything other than the url to access each individually.
HowTo: Create Virtual Hosts in WAMP
BEFORE DOING ANY OF THIS PLEASE ENSURE APACHE AND MYSQL ARE WORKING PROPERLY FIRST!!!
Create a new folder outside the wamp directory structure. For example
C:\websites\www
but this can be on any disk drive visible to the PC running wamp
Create a subfolder in c:\websites for each site you want to create. for example:
C:\websites\www\site1
C:\websites\www\site2
Edit the file C:\wamp\bin\apache\apachex.y.z\conf\extra\httpd-vhosts.conf where x,y and z are the version numbers of apache that you actually have installed.
NOTE: If you are switching between 2 or more versions of apache this will have to be done to all your versions of apache in turn.
SUGGESTION: I like to use the format sitename.dev to make it obvious to me that I am dealing with my localhost development copy of a site, you may prefer another notation, thats ok, the word dev has no actual defined meaning in this case, its just my way of naming my development versions of a live site.
NOTE: Remove or better still comment out ( using the # in column 1 ) the lines that already exists in this file. They are just examples.
example contents:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
## must be first so the the wamp menu page loads when you use just localhost as the domain name
## Also NEVER change the security to anything other than Allow from 127.0.0.1 localhost ::1
## Then a drive by Ip address hack should return a 403 denied access
<VirtualHost *:80>
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias localhost
**Using Apache 2.2 syntax**
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
## For every ip in the subnet, just use the first 3 numbers of the subnet
## Check you actual subnet for the actual values to use here
Allow from 192.168.0
</Directory>
**Using Apache 2.4 syntax**
<Directory "C:/wamp/www">
Require local
## And possibly allow access from you local network
## Check you subnet for the actual values to use here
Require ip 192.168.0
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/websites/www/site1"
ServerName site1.dev
ServerAlias www.site1.dev
Options Indexes FollowSymLinks
**Using Apache 2.2 syntax**
<Directory "C:/websites/www/site1">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
#If you want to allow access from your internal network
# For specific ip addresses add one line per ip address
#Allow from 192.168.0.nnn
# For every ip in the subnet, just use the first 3 numbers of the subnet
#Allow from 192.168.0
# If you want to allow access to everyone
#Allow from all
</Directory>
**Using Apache 2.4 syntax**
<Directory "C:/websites/www/site1">
AllowOverride All
Require local
#If you want to allow access from your internal network
# For specific ip addresses add one line per ip address
#Require ip 192.168.0.nnn
# For every ip in the subnet, just use the first 3 numbers of the subnet
#Require ip 192.168.0
# If you want to allow access to everyone
#Require all granted
</Directory>
</VirtualHost>
Add as many as you require so each of your sites have one, changing the DocumentRoot, ServerName and any other of the parameters as appropriate.
This also allows you to make SITE SPECIFIC changes to the configuration.
NOTE: This will make the wamp manager "Put Online" function no longer have any effect on these new vhost'ed sites as the security for each one is now part of the vhost definition, so leave WAMP, OFFLINE.
If you want to put one or more sites online you will have to change the Allow commands MANUALLY in the httpd-vhosts.conf file.
To check your subnet do the following:
Launch a command window, and run
>ipconfig
Look for the line "Default Gateway" in the output and use the third number in your Allow commands.
Edit your httpd.conf file and search for these lines, they are near the bottom of the file.
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
Remove the '#' comment character on this line to Include your newly changed vhosts, this will cause apache to register their existance. eg
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
While still editing your httpd.conf file search for
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
DO NOT CHANGE THESE LINES!
Add the following after the <\Directory> tag to secure your new C:\websites folder.
<Directory "C:/websites/">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
This is to set security on your new directory structure so that access to these new sites is only allowed from 127.0.0.1 (localhost) unless amended from within a specific VHOST.
P.S. Your internal network will probably be something like 192.168.x.y, check your system first!
Now in order for your browser to know how to get to these new domain names i.e. site1.dev and site2.dev, we need to tell windows what IP address they are located on. There is a file called HOSTS that is a hangover from the days before Domain Name Servers (DNS) were invented. It is a way of giving nice easy rememberable names to IP address's, which of course is what DNS Servers do for us all now.
Edit your HOSTS file, this can be found in C:\windows\system32\drivers\etc , the file does not have an extension.
Windows protects this file so you must be an Administrator to be allowed to save changes to this file.
If you are using VISTA or Windows7/8 you may think you are an Administrator BUT YOU ARE NOT!!!!
So to edit this file you must launch your editor, or Notepad in a specific way to gain Administrator rights. To do this find your editors icon and launch it using the following key strokes:
Shift + Right Click over its icon, this will display a menu, click the item "Run as Administrator", and click "Allow" on the challenge dialog that will appear.
Now you are ready to edit the hosts file so navigate your editor to c:\windows\system32\drivers\etc\hosts
Add the following lines to this file
127.0.0.1 site1.dev
127.0.0.1 site2.dev
NOTE: You will need to add one line in this file for each of your new virtual hosts.
Once you have saved these changes you need to make windows refresh its 'domain name - ipaddress cross reference' cache.
To do this launch a command window as an Administrator ( Shift + Left Click over the command window icon ) and run these 2 commands.
>net stop "DNS Client"
>net start "DNS Client"
Note: The quotes are required as there is a space in the services name.
In order for Apache to pick up these changes you must bounce ( restart ) apache.
DO this by: Wamp manager -> Apache -> Service -> Restart Service
You should now be able to use the address site1.dev in your browser to get to your new sites.
Copy your sites code into the "C:/websites/xxxx" folder if you already have a site coded or,
place a quick and simple index.php file into the "c:\websites\xxxx" folder to proove it all works.
example:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>SITE1</title>
</head>
<body>
<?php
echo '<div style="background-color:red;color;white;text-align:center;font-size:18px">HELLO FROM Site1</div>';
?>
</body>
</html>
TROUBLE SHOOTING:
If you have used the new domain name ( site1.dev ) and it has not found the site.
a. Check the changes to the hosts file.
b. Restart the "DNS Service" that runs in windows. This caches all doman names that you use in a browser so that the browser does not have to query a DNS Server each time you re-use a domain name. This may have cached your failed attempt but a restart is easy and should solve the problem and is quicker that re-booting windows, which should also work.

I want to access the files in htdocs on my smartphone inside the same network

I am developing in php and I have mysql as backend, on a windows 7 machine. I have installed xampp server and i'm using apache 2.4 as the web server. I have a mtnl router and all my devices are connected to it. I want to access everything which is present in the htdocs folder on my android smartphone. I saw some posts about editing httpd.conf file but no use. Please specify what to edit in the conf file.
Thanks in advance!
my ip-config o/p is:
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix:
Link-local IPv6 Address: fe80::853e:7ced:1b5e:91cc%12
IPv4 Address: 192.168.1.103
Subnet Mask : 255.255.255.0
Default Gateway:192.168.1.1
my httpd.conf file ka edits looks like this:
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 :: 192.168.1
Allow from 127.0.0.1
Allow from 192.168.1
**SOLUTION FOUND:**
As #BenH said we have to edit the httpd.conf as he's shown
Goto firewall and add apache server to the exception list
to setup a static ip go to network and sharing and open adapter settings,
select current connected adapter rightclick and click on the properties
click on ipv4 properties click on the use the following ip address
ur ip address: 192.168.1.xyz
xyz can be anything from 02 to 255
subnet mask:255.255.255.0
default gateway: 192.168.1.1
for mtnl preferred dns server in mumbai is :59.185.0.23
alt:203.94.227.70
click ok
restart the apache
Thank u everyone especially BenH for helping me out :)
Set static IP to each devices on your local network. Then you'll have to configure apache to allow connection from all and not only from 127.0.0.1, it should be in httpd.conf :
AllowOverride All
Order Deny,Allow
Deny from all
Allow from all
Try turning off your firewall.

Virtual not working in other system wamp

Virtual host not working in the NETWORK
I just followed this site tutorial,
Virtual host steps
The tutorial was excellent but when I try this alias URL in another system, its not working. I have checked in my other system, I am able to see my application, after I did these changes I am not able to see my application on the other system.
I have even changed Allow from 127.0.0 to all but that is not working.
My C:\wamp\bin\apache\Apache2.2.11\conf\extra\httpd-vhosts.conf
This what I added
<VirtualHost *:80>
ServerAdmin webmaster#developertalk
DocumentRoot "C:/wamp/www/developertalk"
ServerName developertalk
ServerAlias www.developertalk
ErrorLog "logs/developertalk-error.log"
CustomLog "logs/developertalk-access.log" common
<directory "C:/wamp/www/developertalk">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
When hitting URL in another system, getting following error:
Server not found
In my local host i am having 3 web application.
Due to above changes my local host other sites not working.
How to make it work other sites.
You need to use local DNS to say every PC in Your network, that You have on Your PC host 'myApp', also You can add to every client's hosts file something like myapp 192.168.1.2 where 192.168.1.2 Your static IP in network
For every computer you want to have access to http://developertalk, you need to edit the Hosts file in each one.
Located at (xp/win7): C:\Windows\System32\drivers\etc\
You need to add only 1 line on every computer.
(your static internal ip) www.developertalk
example:
192.168.1.71 www.developertalk
you can check your internal ip address on your windows by opening cmd and typing ipconfig.
Look for the IPv4 address under the Ethernet adapter Local Area Connection column.
If you don't request or assign a static internal IP to your computer, others will not be able to connect to http://developertalk which was forwarded to your old internal IP.
Egor Sazanovich has actually answered your question and provided you with extra information, so accept his instead of this one, if this helped at all.

Categories