How to change from localhost to localhost.local in wamp? - facebook

I'm using cakephp 2.1 and WAMP for one of my app which is making use of Facebook Connect plugin. Getting an error saying
An error occurred. Please try later
Googled and found this
http://ardentdev.com/no-facebook-connect-cookies-for-localhost-development/
But not coming to know how to chance the settings from localhost to localhost.local for app in WAMP.

First, you need to add a virtual host. To do this, edit the apache configuration file that came with WAMP. This is assuming you're on OSX.
/bin/apache/Apache2.2.17/conf/http.conf
# add the following
<VirtualHost 127.0.0.1>
DocumentRoot "/path/to/project"
ServerName mysite.local
ServerAlias mysite.local
</VirtualHost>
Then, edit your hosts file. Open up the terminal, and run the following (use whatever editor you like, I'm choosing Vi):
$ sudo vi /private/etc/hosts
And add a host to point to our new site.
127.0.0.1 mysite.local
Lastly, restart the WAMP server and you should be able to visit mysite.local in your browser and it will point to your project.

Related

Setting up virtual host in lamp

I want to develop facebook app locally and was trying to follow instructions on
https://devcenter.heroku.com/articles/facebook#working-locally
I installed lamp on Linux Mint 13 and created /etc/apache2/conf/extra/httpd-vhosts.conf as below.
NameVirtualHost *:80
VirtualHost *:80>
DocumentRoot "/home/ashish"
ServerName localhost
/VirtualHost>
VirtualHost *:80>
DocumentRoot /home/ashish/savefromiad/blooming-stream-1211/
ServerName mycoolapp-dev.localhost
SetEnv FACEBOOK_APP_ID 461561000551920
SetEnv FACEBOOK_SECRET 00000000000000000000000
/VirtualHost>
In my browser localhost works good, but trying to access mycoolapp-dev.localhost in browser fails.
"Oops! Google Chrome could not find mycoolapp-dev.localhost"
Any ideas?
I also get this error when I restarts apache
NameVirtualHost *:80 has no VirtualHosts
PS: Before all "VirtualHost" there is a "less then" sign.
You also have to edit /etc/hosts file.
Add there something like
127.0.0.1 mycoolapp-dev.localhost
Also, double check your /etc/apache2/conf/extra/httpd-vhosts.conf i think you dont need two DocumentRoot and ServerName for one virtual host(as you pasted in your question)
I got this.
I needed a separate entry in /etc/hosts as below.
127.0.0.1 localhost
127.0.0.1 mycoolapp-dev.localhost
Thanks icrew for pointing to /etc/hosts.
Also I commented out "NameVirtualHost *:80" in "/etc/apache2/ports.conf" as it was already there in "/etc/apache2/conf/extra/httpd-vhosts.conf".

How to make public directory of my framework the default one in Vagrant?

I am using Vagrant to set up my local development environment. I managed to do port forwarding from port 80 on my Virtual Machine (lucid64) to my host port 8080. If I put an index.html file in my project folder and type 'localhost:8080' in my browser, I see the html page displayed. So far so good.
The thing is I work on a framework which has this directory structure:
app
**public**
vendor
tmp
where the public folder should be the 'root' folder.
So I edited the project.conf file located at /etc/apache2/sites-available in my Virtual Machine to:
<VirtualHost *:80>
DocumentRoot /vagrant/public
</VirtualHost>
(I simply added the '/public' part).
Now when I go to localhost:8080 in my browser, it downloads the index.php file in the public folder instead of displaying it. How can I fix that please?
Is PHP properly installed and enabled in you apache configuration? I don't think this is connected to vagrant.

How to create a propper working project with Zend Framework and Wamp 2.2

So i've been at this for 2 days now and i cannot get it to work together.
I have installed Wamp 2.2 in a standard manner at c:\wamp, nothing special.
I downloaded and extracted the Zend Frameworkm folder and placed the folder it in the C:\wamp\library folder.
So it looks like this :
C:\wamp
- www
- ht.acces
- index.php
- bin
- library
- ZendFramework
- bin
- library
- etc.
- logs
- tools
- etc.
Now as instructed i added both the php location and the Zend framework library to the system variable called PATH wich looks like this : ..;C:\wamp\library\ZendFramework\bin\;C:\wamp\bin\php\php5.3.10\;
Now i can open cmd and type zf create project quickstart, i directed it to create the folder in the www. directory of wamp like this :
C:\wamp
- www
- quickstart
- application
- data
- library
- etc
- ht.acces
- index.php
- bin
- library
- ZendFramework
- bin
- library
- etc.
- logs
- tools
- etc.
Now starts the fun part. All the guides around the internet tell me that i should include the location of the library folder inside the ZendFramework folder in the php.ini at the windows version of include_path: "C:\wamp\library\ZendFramework\library".
Now the fun part is that no one mentions exactly wich php.ini file! There are 2 of them as most of you know one in the php directory and one in the apache directory.
And so i come with my first part of my question, wich one do i need?
Wich is soon after followed by part 2, how to propperly set up the virtual host that is supposedly needed to correctly run the zend application in the folder C:\wamp\www\quickstart.
From what i could gather i need to change the file httpd.conf file in the folder C:\wamp\bin\Apache2.2.21\conf\
I need to add something along the lines of
<VirtualHost 127.0.0.1>
ServerName quickstart
DocumentRoot "c:\wamp\www\quickstart\public"
<Directory "c:\wamp\www\quickstart\public">
AllowOveride all
Order Allow,Deny
Allow from all
<\directory>
<\VirtualHost>
Then after doing so i need to change the host file in the directory c:\windows\system32\drivers\etc. However at that point i am completely lost.
My host file looks like this :
--- standard commented wall of text ---
127.0.0.1 localhost
And at this point the only thing i know that seems to get close to it is that i need to add the line :
127.0.0.1 localhost quickstart
Or something along those lines.
So is there anyone out there with experience regarding Zend Framework that could provide me with an answer? It would be much appriciated :)
Björn
-
First I'm pretty sure that the php.ini you need to change for web display is the one in the apache folder. (it's been awhile since I've used WAMP).
Next don't build your vhost in your apache config httpd.conf, do it instead in httpd-vhosts.conf. (you don't want to accidently break apache),
The way you stting your vhost at the moment you url will look like http:quickstart/
these two links will help:
Setup Apache vhost
Zend Server Vhosts
One of the key thing with using vhosts is to remember to redo localhost so it doesn't go away.
With you windows hosts file, remeber it must be edited in admin mode and you can have many hosts on the same number, here is an example:
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 iam.local
127.0.0.1 zfcms.local
127.0.0.1 home.local
127.0.0.1 places.local
127.0.0.1 RentAFlat.local
127.0.0.1 zf2-tutorial.local
127.0.0.1 mp3.local
127.0.0.1 quickstart
and an example from httpd-vhosts.conf, note: localhost is the first vhost...This is important.
<VirtualHost *:80>
DocumentRoot "C:\Zend\Apache2/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\www\iam\public"
ServerName iam.local
ErrorLog "C:\Zend\ZendServer\logs\iam.local.log"
<directory "C:\www\iam">
Options Indexes FollowSymlinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
I hope this helps..
Looks like You're missing (first of all)
<VirtualHost 127.0.0.1>
ServerName quickstart
(...)
<\VirtualHost>

Testing website on localhost server for iphone and ipad

What I'm looking to do is preview what I've built on a custom localhost server (set up with Mamp Pro) on my iphone or ipad. The localhost is under http://devsite:8888 and not http://localhost:8888.
I've tried the instructions for something similar found here. The result was being able to see the files but it was just the list of the files on the server and not picking up index.php—no previews enabled. I've triple checked to make sure I have a proper index in the root directory as well.
Added /etc/apache2/extra/httpd-vhosts.conf file
https://gist.github.com/07223bf788ef1e2e1411
Put this in your .htaccess or httpd.conf (usually /etc/apache2/httpd.conf on OSX):
DirectoryIndex index.php
If that is put in .htaccess be sure that somewhere in httpd.conf (or whatever customm config file for the web server) you have this (replace /var/www/html with the directory where your .htaccess file is):
## These lines can go anywhere in the main config file:
AccessFileName .htaccess
<Directory "/var/www/html">
AllowOverride All
</Directory>
Also, make sure your /etc/hosts file includes:
127.0.0.1 devsite
# Or whatever your local computers IP is:
# 192.164.2.164 devsite
so that the hostname will resolve properly.
Edit:
From the comments, it sounds like your virtual hosts may need additional configuration. Can you put the contents of the /etc/apache2/extra/httpd-vhosts.conf file in your question?

Zend .htaccess configuration not working in Ubuntu

Hi I am running Ubuntu 10.04 LTS - the Lucid Lynx
i create a project by
zf create project test
this command automatically generates a .htaccess file which didn't work
I configured my webserver (Apache2) by editing
/etc/apache2/sites-available/default file
setting
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
and i am getting the following error
Internal Server Error
/**************************************************************************************/
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.14 (Ubuntu) Server at localhost Port 80
/****************************************************************************************/
please help me
You haven't loaded mod_rewrite, so Apache doesn't know what the RewriteEngine line means.
On ubuntu you can probably do (as a super user):
a2enmod rewrite
apache2ctl restart
Otherwise you'll have to edit the apache config and add a line like this to load the module
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
The path on your system may be different.