Wamp server alias won't load files - php

I am using wamp server version 2.4
I have a zend project, and when i create virtual host it works like a charm (http://nasport.localhost/authentication/login). But i need to access it via my IP address (e.g. 127.0.0.1/nasport/). I made an alias in wamp, but when I go to that page, i get only ugly page without css, and login is not working too because it can't access other files. Here is my alias:
Alias /nasport/ "d:/dev/php/nasport/public/"
<Directory "d:/dev/php/nasport/public/">
Options Indexes FollowSymLinks
MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
Please help me.

Related

WAMP 403 Forbidden message on Windows 8

I have installed WAMP on my windows 8 machine. When i browse to localhost in my browser, the WAMP server page is visible.
But when I browse to my IP in my browser, I get the message
403 Forbidden: You don't have permission to access / on this server.
i downloaded wamp server from this page
http://sourceforge.net/projects/wampserver/
and in C:\wamp\alias phpmyadmin file
Alias /phpmyadmin "c:/wamp/apps/phpmyadmin3.5.1/"
# to give access to phpmyadmin from outside
# replace the lines
#
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#
# by
#
# Order Allow,Deny
# Allow from all
#
<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
Any suggestions?
Sounds like you need to make the same changes you made in the phpmyadmin config file to the Apache config file httpd.conf, by default Apache only allows localhost access. Search for httpd.conf and make changes ,I don't know where conf file would be placed by default on Windows box.
You could change :
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
into:
Options Indexes FollowSymLinks ExecCGI
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
That's in my file. Maybe this will help you. You also didn't say if http://localhost or http://127.0.0.1 works fine
But in fact it should work just right after install. If it's not maybe you should try to uninstall wamp and install again.
However if I were you I would consider using another wamp server. I've also used this one but updates are not very often, there are problem with switching php version if you need to do more testing. I recently have moved to http://www.easyphp.org/ and it works very nice, I can switch between php versions without problems and new versions (php/phpmyadmin) appear almost just after release date so I recommend you to test this one.

using PHP within WAMP- how can I create new directories on my local drives?

I am trying to use PHP within my WAMP environment to create new directories (checking if they exists first) on a local drive (U:) which is mapped to a media server (\tr-svrwc-fms)- with no success: I receive a 403 error.
I've tried creating directory Aliases:
Alias /vid "tr-svrwc-fms//"
<Directory "tr-svrwc-fms//">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
and also:
Alias /vid "U:"
<Directory "U:">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow, Deny
Allow from all
</Directory>
I've even tried modifying the root directory settings in httpd.conf to "Allow from all".
my WAMP server version is 2.2 with Apache version 2.2.21
thank you in advance for your help
It is recommended to only use only UNC paths for network resources in httpd.conf
The syntax should look something like this:
Alias /vid "//laptop1/vid"
<Directory "//laptop1/vid">
...
</Directory
Where laptop1 of course will be different in your case.
I've learned that with WAMP installed on my local hard drive, the Apache server (as configured) does not allow for communication outside of the WAMP root folder due to permissions.
This type of communication can however be accomplished via a PHP shell script on the Command Line which doesn't route through the Apache Server.

Can't access apache web apps locally using IP or PC Name

I installed Wamp Server on Windows 8. I then installed a php web application.
I can access it by going http:// localhost/webapp or http:// localhost/phpmyadmin
I want to be able to access this web app from different computers on the same network.
The problem is when I try to visit my web app via this http:// 192.168.133.221/webapp (which is my local ip address) or http:// mypc/webapp (which is my PC's name) - I get the following error
403 Forbidden You don't have permission to access /fengoffice on this
server.
I have disabled both windows firewall and Kaspersky's firewall but still getting the same error.
Any advise?
Salim was on the right track, but he is rather giving away all the crown jewels.
Do not make this change to httpd.conf as it is not necessary to open the wamp home folder up to the world! As this would allow access to your new site, but also any other site you may then want to develop in another folder below c:\wamp\www.
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Replace it with the original, like this
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Deny,Allow
Deny from all
</Directory>
To allow your one site to be accessed from just your internal network, do this. Under the previous section add a new <Directory> block. ( change the folder name webapp as appropriate for your directory name )
<Directory "C:/wamp/www/webapp">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.133
</Directory>
This will allow access from the PC running WAMP AND any ip address on your subnet i.e. all the PC's inside your router. BUT NOT THE WORLD!
You can be more specific if you want and add as many individual IP address's as are required by:
Allow from 192.168.133.1 192.168.133.2 192.168.133.3
Now to allow access to phpMyAdmin from your internal network we use the same idea in the config for phpMyAdmin
Edit c:\wamp\alias\phpmyadmin.conf and make simpliar changes.
<Directory "c:/wamp/apps/phpmyadmin4.0.6/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
Allow from 192.168.133
</Directory>
This way when you decide to open up your router to the world ( port forward port 80 ) so your site is visible to friends/the world you can change the section of code that relates to your sites folder i.e. C:/wamp/www/webapp but external users will not be able to access your wamp homepage or more inportantly your phpMyAdmin and therefore ALL your databases.
And one final thing, you will also have to change the MYSQL userid that you are using ( probably root, although it would be better to create another userid ) so that it is allowed access from a PC that is not on the main WAMP PC.
This may help you with that Add host to mysql user
EDIT: Apache 2.4.x Equivalents
No longer required
Order Deny,Allow
Replece:
Allow from 127.0.0.1 ::1 localhost
with
Require local
Replace:
Allow from 192.168.133
with
Require ip 192.168.133
Replece:
Allow from all
with
Require all granted
Without 127.0.0.1 from all IP address your Apache server is forbidden to access.
Open httpd.conf(Apachee config file) file from where you have installed Wamp Server and see in this file
<Directory "C:/wamp/www/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
And
<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
C:/wamp/www will be as your installed location
Change it to
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
And
<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
And restart service.

How to resolve the Wampserver error?

I just installed WAP 2.2 d, on my local machine. It runs on Wndows 7 Starter. The installation was done smoothly. Then when I hit the URL localhost/phpmyadmin it gave me a message
**Forbidden**
You don't have permission to access /phpmyadmin/on this server.
Then after doing some research on this issue I found one solution as to make the change in file wamp/alias/phpmyadmin.conf
The initial lines were
<Directory "c:/wamp/apps/phpmyadmin3.4.10.1/">
Options Indexes FollowSymLinks MultiViews
Order Deny, Allow
Deny from all
Allow from 127.0.0.1
</Directory>
I changed these line to following lines:
<Directory "c:/wamp/apps/phpmyadmin3.4.10.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow, Deny
Allow from all
</Directory>
Then the phpMyadmin started working properly at URL localhost/phpmyadmin
After that I copied my directory 'XYZ' containing small project of PHP. Hit the URL localhost/XYZ, then it was expected to run the index.php file from the folder XYZ but it's still giving me the error
**Forbidden**
You don't have permission to access /XYZ on this server.
Can you help me to resolve this issue and run the system properly. Except above change to wamp/alias/phpmyadmin.conf I've not done any change to any of configuration file. Thanks in advance.
You must allow access to your XYZ directory in Apache configuration file httpd.conf:
<Directory "c:/wamp/apps/XYZ">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow, Deny
Allow from all
</Directory>
The reason for this problem is most likely because W7 has IPV4 and IPV6 enabled.
Apache is happy to listen to both ranges of port numbers, and by default does.
A better more secure solution would be:
<Directory "c:/wamp/apps/phpmyadmin3.4.10.1/">
Options Indexes FollowSymLinks MultiViews
Require local
</Directory>
Require local is like saying Allow from 127.0.0.1 localhost ::1 i.e. both IP Address ranges alias's for this PC.
Also if you do as you did and Allow from all when you decide to show a friend what you have done and open you router so the world can see your new site, they will also be given access to phpMyAdmin making a hackers life really easy
Secondly, you do not make the change suggested by #user4035, instead edit the httpd.conf and look for this section
<Directory "d:/wamp/www/">
Where is says,
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Change it in the same way as above, to
Require local
For the same security reason as above. When the time comes to show the world your site you can add the
<Directory "c:/wamp/apps/XYZ">
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
To allow anybody to see just that website but nothing else.

Django/mod_wsgi and PHP as Virtual Hosts on same Apache Server using MAMP

UPDATE: My original question is below, but the code I posted with the question has been edited to the final working solution.
I am trying to run multiple sites on my MAMP development server. Some of the sites are wordpress sites that live in the htdocs in MAMP and some of the sites are django apps that live in a folder titled djangoprojects.
I have been trying to implement the solutions from these stack questions:
multiple django sites with apache & mod_wsgi
How do I run Django and PHP together on one Apache server?
but I have not been successful. I was able to run the django site on apache with the code you see in the first VirtualHost brackets (from the daemon process line onward) but then none of the php sites could be visited.
Help is greatly appreciated. I am new with this and I can't work out the errors.
Here is the code from my httpd.conf:
UPDATE: The code below works. Both the Django App and the PHP applications exist on the localhost server. The PHP related VirtualHost stuff was copied from further up in the MAMP httpd.conf file.
<VirtualHost *:80>
ServerName localhost:80
UseCanonicalName Off
DocumentRoot "/Applications/MAMP/htdocs"
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
<Directory "/Applications/MAMP/htdocs">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess site1 display-name=%{GROUP}
WSGIProcessGroup site1
Alias /media/ /Users/sequoia/djangoprojects/dynamics/media/
<Directory /Users/sequoia/djangoprojects/dynamics/media>
Options ExecCGI
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias /dynamics /Users/sequoia/djangoprojects/dynamics/apache/django.wsgi
<Directory /Users/sequoia/djangoprojects/dynamics/apache>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
A couple of problems to start with:
ServerName is mean to specify the host name not a URL path.
You should never set DocumentRoot to be where your Django site source code is.

Categories