Zend framework is new to me and I'm working from a book so I can get a rudimentary grasp of things (book is Zend Framework A Beginners Guide).
I have my project set up and have created it in a folder called "test"
I have also added a vhost, vhosts file contains:
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
ServerName .localtest
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "C:/Program Files/Zend/Apache2/htdocs/test/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I have called the vhosts file from within apaches conf file
I have also added a line to system32 hosts file:
127.0.0.1 test.localtest
My problem is that when I browse to http://test.localtest/ I get the zend server test page, when as from what I am reading I should be getting the Zend Framework projects Main Page splash, this I can reach by browsing to http://test.localtest/test/public/
Am I missing something?
Try changing
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
ServerName .localtest
to
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
ServerName test.localtest
EDIT
ok i have check on my system and it work perfectly, but i am using ubuntu hope this helps
edit this file
C:\Program Files\Zend\Apache2\conf (Zend Server on Windows machines)
and add this code
<VirtualHost *:80>
ServerName test.localtest
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/Program Files/Zend/Apache2/htdocs/test/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
then edit this file
C:\WINDOWS\system32\drivers\etc\hosts
and add this line
127.0.0.1 test.localtest
and then dont forget to restart you apache server (wamp or xampp or anything you are using)
and then open this link
http://test.localtest
try to write the url with http:// sometimes the browser does not work without http://
try it comment if it does not work
one thing most everyone misses is that Zf needs FollowSymlinks to work most of the time.
this is the directory definition I usually use in my vhosts
<directory "C:\www\project">
Options Indexes FollowSymlinks
AllowOverride all
Order Deny,Allow
Allow from all
</directory>
not sure how DirectoryIndex will affect this.
make sure mod_rewrite is enabled in Apache:
LoadModule rewrite_module modules/mod_rewrite.so //make sure this line is uncommented httpd.conf
make vhosts is enabled in apache:
Include conf/extra/httpd-vhosts.conf //make sure this line is uncommented httpd.conf
make sure this line is present in your vhosts file usually above the vhosts definitions:
NameVirtualHost *:80
Related
I am using EasyPHP (version 16.1.1) for Apache server (installed version 2.4.18 x86). I need to add a new VirtualHost, so now the whole VirtualHost section of httpd.conf looks like this:
# VIRTUAL HOSTS
## Virtualhost localweb
<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www"
ServerName 127.0.0.1
<Directory "C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www">
Options FollowSymLinks Indexes ExecCGI
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:8080>
UseCanonicalName Off
ServerAdmin marekbuchtela#gmail.com
ServerName posis
ServerAlias posis.tovarna
VirtualDocumentRoot "C:\Users\marek\is\tovarna\public"
</VirtualHost>
The first one is the default one made by EasyPHP, the second one is added by me. However in this setup, the Apache won't start. When I remove the second VirtualHost, everything works fine, but with it, it just won't start at all. I have checked the error log and there is no output at all.
Any ideas why is this happening/how to fix it?
Thanks
Switch VirtualDocumentRoot "C:\Users\marek\is\tovarna\public"for DocumentRoot "C:\Users\marek\is\tovarna\public"
If by any chance you keep getting the error, show error_log output
There is another instance other than the answer given by ezra-s as to why EasyPHP server won't start and the Apache error log is empty.
When declaring paths in the vhosts file, it is important that the directories referenced in those paths exist. If you provide the following VirtualHost information, for example:
<VirtualHost *:80>
DocumentRoot "D:/MyApp/public_html"
ServerName myapp.local
ErrorLog "D:/MyApp/logs/error.log"
CustomLog "D:/MyApp/logs/apache.log" common
</VirtualHost>
...but you don't have a D: drive, or the directories D:/MyApp/ and D:/MyApp/logs/ don't exist, then you'll get a "silent fail" in Apache when starting the HTTP server from the EasyPHP console.
Before marking this as answered, please read the entire thing because yes there is a good amount of these questions but NONE of the answers on them have worked at all.
For the last 6 months I've looked at around 50 different form posts here and around the web to try and get my XAMPP virtual hosts working.
Hosts File
127.0.0.1 localhost
127.0.0.1 vws.localhost
127.0.0.1 instancegaming.net
127.0.0.1 vws.instancegaming.net
http-vhosts File (Updated 7/26)
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
# NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\xampp\htdocs"
<Directory "C:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
I'm at a loss of what to do, I've tried putting all fields to localhost then to instancegaming.net but nothing seems to work. I've read the Apache log and there's only SSL errors floating around.
When I try going to [ http:// ] vws.localhost, vws.192.168.0.47, vws.instancegaming.net all of which give the same error in chrome:
ERR_NAME_NOT_RESOLVED
Then I tried emptying chromes host cache, but that didn't help either.
Sidenote: I reinstalled XAMPP 4 times trying to make this work.
Follow these steps if you are in windows environment (7 & 10 tested) with XAMPP:
Add in hosts file [C:\Windows\System32\drivers\etc]
127.0.0.1 vws.localhost
127.0.0.1 instancegaming.net
127.0.0.1 vws.instancegaming.net
Add this in httpd.conf [C:\__Server\apache\conf] . though some says there are security risks with this but couldn't find a way without this
<Directory />
AllowOverride none
Require all granted
</Directory>
Add these in httpd-vhosts.conf [C:\__Server\apache\conf\extra]
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\__Server\htdocs"
<Directory "C:\__Server\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName tools.com.at
DocumentRoot "E:\phpStorms\git\tools-class"
SetEnv APPLICATION_ENV "development"
<Directory "E:\phpStorms\git\tools-class">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName laravel.test.com.at
DocumentRoot "E:\laravel.test.com.at\public"
SetEnv APPLICATION_ENV "development"
<Directory "E:\laravel.test.com.at\public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
template of this
<VirtualHost *:80>
ServerName nameInHostsFile
DocumentRoot "pathOfTheWindowsFileLocationWhichWillBeDocumentRoot"
SetEnv APPLICATION_ENV "development"
<Directory "pathOfTheWindowsFileLocationWhichWillBeDocumentRoot">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Note 1: My xampp installed on C:\__Server location
Note 2 : My folder name is laravel.test.com.at and its in E: drive E:\laravel.test.com.at
Note 3: Always copy folder location from address bar in windows explorer, so there is no mistakes.
Note 4: You must restart XAMPP after editing httpd-vhosts.conf every time.
Note 5: Use uncommon part in url [i.e .com.at] so that it is unique and there is no issue resolving dns.
Update: troubleshoot#Jacob Jewett
After a fresh copy of XAMPP installation in C drive -
just add/append these line in httpd-vhosts.conf file
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\xampp\htdocs"
<Directory "C:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName vws.localhost
DocumentRoot "C:\xampp\vws"
SetEnv APPLICATION_ENV "development"
<Directory "C:\xampp\vws">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Add append this in httpd.conf file
<Directory />
AllowOverride none
Require all granted
</Directory>
ADD PATH variable for php [C:\xampp\php], and also check that there isn't another php path in the PATH variable.
restart xampp and browse localhost
Additionally make sure that the line
Include etc/extra/httpd-vhosts.conf
is not quoted out in httpd.conf
The answer I found that works is to to this in the hosts file.
192.168.0.47 localhost somthing.instancegaming.net
One thing I'd like to add here: For anyone who is sure everything is setup correctly, make sure you don't use any underscores in the alias string within your hosts file; for some reason it can't accept underscores.
I have similar issue, vhosts not working. But in my case I found there was the permission issue with host file. Hope this helps for some one. hosts file ignored, how to troubleshoot?
If pings are successful but a Virtual Host is not working with XAMPP 7.3.1 and Windows 10 Pro the problem may be interference with the World Wide Web Publishing Service.
On my system, Apache and MySQL start successfully but the virtual host cannot be browsed till I stop the WWWPS service (in Windows Services). The virtual host then becomes instantly available. It instantly stops working when the WWWPS is started again.
I fixed the problem by just restarting my computer after setting up the System32 file hosts and the apache vhosts.
On a Windows machine running XAMPP I have a folder in my web root called 'static'. It and everything in it return a 404 error even though the folder is there.
If I change the name of the folder, e.g. 'statics', all is well. I have other servers (Ubuntu) running Apache and I do not have this problem.
The site is a copy of one of the sites on one of our Linux servers. What can I do or change to allow the directory to work as named?
EDIT vhosts.conf
<VirtualHost *:8080>
ServerAdmin jablanchard#foo.com
DocumentRoot "C:/xampp/htdocs/home/app/gateway"
ServerName localhost
ServerAlias 127.0.0.*
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
<Directory C:/xampp/htdocs/home/app/gateway/>
# allow .htaccess overrides to work
AllowOverride All
DirectoryIndex login.html index.html index.php
</Directory>
# this matches a link to any project directory to the physical webui directory
AliasMatch ^/projects/([-\w]*)/(.*)$ /home/src/gateway/webui/$2
<Directory /home/src/gateway/webui>
DirectoryIndex home.html
Options All
AllowOverride All
Require all granted
</Directory>
I was getting ready to re-install XAMPP but made one last pass through the config files for Apache. I found the problem was this bit of code in the httpd.conf file -
Alias "/static" "C:/xampp/htdocs/static"
<Directory "C:/xampp/htdocs/static">
AllowOverride All
Require all granted
</Directory>
I am not sure if this is part of the XAMPP install as all of the edits I have made to this installation are in the vhosts file. Once commented out the static directory, as I have defined it, works properly now.
I think I've configured all files properly, but when I access the url: myapp.local, it points to the MAMP/htdocs/ directory instead of /MAMP/htdocs/ZendSkeletonApplication-master/public/ (going to this public directory displays correctly de zf2 example webpage), here is my configuration:
httpd-vhosts.conf
<VirtualHost *:8888>
ServerName myapp.local
DocumentRoot "/Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/"
<Directory "/Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
hosts
127.0.0.1 myapp.local
Can someone tell me what I'm doing wrong? I want my base url to point at the /Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/ directory, not at htdocs.
Similar question here, but I can't get the answer. Vhost Zend Framework configuration MAMP - redirected to the index page of the server
Thanks
Just try this in the httpd.conf file (where you must have enabled to include the httpd-vhosts.conf file) -
<VirtualHost myapp.local>
DocumentRoot "/Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/"
</VirtualHost>
There should be no need to enable the httpd-vhosts.conf file.
I am using zend server and I added one VirtualHost into the extra/httpd-vhosts.conf file and removed # from the httpd.conf file.
This is what I added into the extra/httpd-vhosts.conf file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName quickstart.local
DocumentRoot D:/quickstart/Code
<Directory D:/quickstart/Code>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
When I access quickstart.local it is working fine, but it also affects localhost (i.e when I try to load http://localhost/, I see the same site I do for http://quickstart.local/.
How do I resolve this issue? I want both localhost (I use this for another project) and quickstart.local to be separate.
I have the same problem. Try to add a host to zend.conf or
add
Include conf/extra/httpd-vhosts.conf
to htppd.conf
You can add a new vhost by adding the directives to a new file:
/path/to/zend/etc/sites.d/vhost_[my-site].conf
Replace [my-site] with whatever you want (no spaces).
Then, be sure you restart apache:
sudo /path/to/zend/bin/apachectl restart
I had similar issue when trying to add own sites. Solution for me was to comment both vhost examples in vhosts file and also uncomment or add the
127.0.0.1 localhost
into hosts file in %windir%/system32/drivers/etc folder
... ofcourse if you need to uncomment vhost_alias module and include for httpd-vhosts file..
[FILE PATH] \xampp\apache\conf\extra\httpd-vhosts.conf or, if you are
using Apache 2.4 or above:
<VirtualHost *:80>
ServerName dev.zendapp
DocumentRoot "G:/xampp/htdocs/io2018/zend2018/zendApps"
SetEnv APPLICATION_ENV "development"
<Directory "G:/xampp/htdocs/io2018/zend2018/zendApps">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
After change. C:\Windows\System32\drivers\etc\hosts
127.0.0.1 dev.zendapp
Restart Your xampp Server