2levelsabove Posted March 17, 2010 Share Posted March 17, 2010 I have a working copy of Zend Server CE and am trying to set up some virtual hosts and it does not seem to be working. $_SERVER['DOCUMENT_ROOT'] is not pointing correctly and that is making my live server scripts break. I have the following in my vhosts file: <VirtualHost 127.0.0.1:80> DocumentRoot D:/zend_server_ce/Apache2/htdocs/ ServerName localhost </VirtualHost> <VirtualHost http://localhost/domain.com> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.com" ServerName http://localhost/domain.com CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.com\logs\access.log" combined ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.com\logs\error.log" <Directory "D:\zend_server_ce\Apache2\htdocs\domain.com"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/ Share on other sites More sharing options...
premiso Posted March 17, 2010 Share Posted March 17, 2010 A bit more information would help, such as where is your DOCUMENT_ROOT pointing to? As far as I know the <Directory> directive requires a tailing slash: <Directory "D:\zend_server_ce\Apache2\htdocs\domain.com\"> But I have never really quite seen a vhost file setup like what you have pasted, but I have never used Zend Server CE either. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027657 Share on other sites More sharing options...
2levelsabove Posted March 17, 2010 Author Share Posted March 17, 2010 Thanks for the reply. The Vhost set up should be very standard and I am just using examples I saw on the web. The document root that you is an actual one and instead of domain.com I have the websitename.com. As far as I understand, the vhost setup does not need to be any different from lets say xamp. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027661 Share on other sites More sharing options...
premiso Posted March 17, 2010 Share Posted March 17, 2010 Did you try adding the trailing slash as I suggested? Did that not work? If the DOCUMENT_ROOT is pointing to "D:\zend_server_ce\Apache2\htdocs\domain.com\" what is the problem? IE how is it not pointing correctly? Since it is not "pointing correctly" perhaps it is your code that is flawed and not your vhosts declaration? There are too many variables here, given that you said it breaks on the live server. That says that you are probably working on different PHP Versions with different php.ini files and or the code does some compensation for the localhost server and they do not jive. The first thing first, how does the live server break? What are the symptoms of it? Are you sure it is not just how the code is programmed? Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027664 Share on other sites More sharing options...
2levelsabove Posted March 17, 2010 Author Share Posted March 17, 2010 $_SERVER['DOCUMENT_ROOT'] is pointing to D:/zend_server_ce/Apache2/htdocs/ where as I want it to point to D:/zend_server_ce/Apache2/htdocs/domainname.com/ Yes I did add the trailing slashes. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027667 Share on other sites More sharing options...
premiso Posted March 17, 2010 Share Posted March 17, 2010 Ah. The issue is that you are using "localhost" whose documentroot is what you just posted above. To fix it, why not access your content via domain.dev here is an example vhost directory: <VirtualHost *:80> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.com" ServerName domain.dev www.domain.dev *.domain.dev CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log" <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> Then you will need to modify your hosts file. For windows it is located: C:\Windows\system32\drivers\etc\hosts Add this to it: 127.0.0.1 domain.dev Reload apache, perhaps do a Start->Run-> gpupdate /force Then open up your browser type in domain.dev and it should work just fine, with the correct document_root. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027671 Share on other sites More sharing options...
2levelsabove Posted March 17, 2010 Author Share Posted March 17, 2010 [17-Mar-2010 10:56:44] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'D:/zend_server_ce/Apache2/htdocs/includes/_process/pagesecurity.php' (include_path='.:\zend_server_ce\ZendServer\share\ZendFramework\library') in D:\zend_server_ce\Apache2\htdocs\domain.com\dashboard.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027676 Share on other sites More sharing options...
2levelsabove Posted March 17, 2010 Author Share Posted March 17, 2010 Actually I had a mistake and now I put in your code properly: <VirtualHost *:80> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev" ServerName domain.dev www.domain.dev *.domain.dev CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log" <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> Now when I go to domain.dev, the site does not pull up Do I need to make any changes to my windows host file? Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027693 Share on other sites More sharing options...
premiso Posted March 17, 2010 Share Posted March 17, 2010 Do I need to make any changes to my windows host file? Then you will need to modify your hosts file. For windows it is located: C:\Windows\system32\drivers\etc\hosts Add this to it: Code: [select] 127.0.0.1 domain.dev Reload apache, perhaps do a Start->Run-> gpupdate /force Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027699 Share on other sites More sharing options...
2levelsabove Posted March 17, 2010 Author Share Posted March 17, 2010 When I do that, "domain.dev" takes me to the Zend Server test page "Welcome to Zend Server" bah!!!!!!!!! :S Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027706 Share on other sites More sharing options...
premiso Posted March 17, 2010 Share Posted March 17, 2010 Sorry, I may have mis-done the vhosts file. Modify it like so: <VirtualHost *:80> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev" ServerName domain.dev ServerAlias www.domain.dev *.domain.dev domain.dev Remember to do an apache reload after that has been done. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027709 Share on other sites More sharing options...
2levelsabove Posted March 17, 2010 Author Share Posted March 17, 2010 I know i need to buy you lunch and a beer on St Patricks. I still cannot pull up domain.dev OK here are the contents of my vhosts file: # # Virtual Hosts # # 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.2/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> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "d:\zend_server_ce\Apache2/docs/dummy-host.example.com" ServerName dummy-host.example.com ServerAlias www.dummy-host.example.com ErrorLog "logs/dummy-host.example.com-error.log" CustomLog "logs/dummy-host.example.com-access.log" common </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "d:\zend_server_ce\Apache2/docs/dummy-host2.example.com" ServerName dummy-host2.example.com ErrorLog "logs/dummy-host2.example.com-error.log" CustomLog "logs/dummy-host2.example.com-access.log" common </VirtualHost> <VirtualHost *:80> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev" ServerName domain.dev ServerAlias www.domain.dev *.domain.dev domain.dev CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log" <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> I have the following in my windows hosts file: # Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost 127.0.0.1 domain.dev ::1 localhost I still cannot get domain.dev as it says Zend Server Test Page Zend Server is now up and running on this server. Once content is added this message will no longer be displayed. If you are this server's administrator: You can now add content to your Web server's document root. You can configure and control your Zend Server installation through the Zend Server Administration Interface. Please refer to the documentation or to your installation's README file for more information. If you need help getting started with Zend Server, please visit the on-line resources page. For more information about Zend Server you are welcome to visit us at www.zend.com. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027720 Share on other sites More sharing options...
premiso Posted March 17, 2010 Share Posted March 17, 2010 Ok, just to make sure settings took place, try and reboot the computer. This should ensure that apache gets the new settings as well as the gpupdate. Also make sure that in the httpd.conf the vhosts include is uncommented out. I would comment out or remove the dummy vhosts from the vhosts file as well. Give those a try and see what comes of it. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027723 Share on other sites More sharing options...
2levelsabove Posted March 18, 2010 Author Share Posted March 18, 2010 Sorry for the late reply. Got stuck at work. Any how in httpd.conf the vhosts was commented so I uncommented it. Thanks so much for the tip. Now the Apache server wont even start. The contents of my vhosts file are: # # Virtual Hosts # # 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.2/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> DocumentRoot "D:\zend_server_ce\Apache2\htdocs\domain.dev" ServerName domain.dev ServerAlias www.domain.dev *.domain.dev domain.dev CustomLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log" combined ErrorLog "D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log" <Directory "D:\zend_server_ce\Apache2\htdocs\domain.dev\"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> something in there is causing Apache to not start Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027894 Share on other sites More sharing options...
premiso Posted March 18, 2010 Share Posted March 18, 2010 Not sure if this is it, but try removing the "s around the Document Root, you should also try and use the apachectl tool which you can run via command line with the -f path/to/vhosts/file to determine where the syntax error is. You may also try removing domain.dev from the server alias, it should not matter, but may. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027899 Share on other sites More sharing options...
2levelsabove Posted March 18, 2010 Author Share Posted March 18, 2010 OK so made some progress. This works however when I hover over links, they still show http://localhost/domain.dev <VirtualHost *:80> DocumentRoot D:\zend_server_ce\Apache2\htdocs\domain.dev ServerName domain.dev ServerAlias www.domain.dev *.domain.dev domain.dev #CustomLog D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\access.log # ErrorLog D:\zend_server_ce\Apache2\htdocs\domain.dev\logs\error.log <Directory D:\zend_server_ce\Apache2\htdocs\domain.dev> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> I know I am close but not quite there. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1027933 Share on other sites More sharing options...
premiso Posted March 18, 2010 Share Posted March 18, 2010 Is this declaration <VirtualHost http://localhost/domain.com> Still in your httpd.conf file at all? If so remove it. Other then that check your file and make sure that your links are not setup to that location. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1028125 Share on other sites More sharing options...
2levelsabove Posted March 22, 2010 Author Share Posted March 22, 2010 Thank you. You have been very helpful. I really do appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/195569-zend-server-ce-virtual-hosts-help-gurus/#findComment-1029996 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.