Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-19-2008, 08:51 AM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Post Change DocumentRoot

Hi everybody,

I need to run a website that is build on the Zend Framework on a webserver that already hosts a few sites. The problem is i can not change the DocumentRoot in the httpd.conf file of this server and i can't get the site to work correctly if the DocumentRoot is not set to the public folder of the website. I removed all the .htaccess files but this does not seem to solve my problem. Is there a way to change the DocumentRoot and still use the Zend Framework. I just want to manually navigate to the public folder via the browser, but this results in a partially rendered website. How can i solve this problem ?

Thanks in advance for any help you can give me!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 02:25 PM
Senior Member
 
Join Date: Jan 2008
Location: chicago
Posts: 101
Default

Are you able to upload files 1 level above the DocumentRoot?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 08:38 AM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default

No that is disabled for the server. I just need the site to work a few levels down from the DocumentRoot.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 05:54 PM
Senior Member
 
Join Date: Jan 2008
Location: chicago
Posts: 101
Default

If you are able to, I would switch hosting plans to something that offers more flexibility, but if you aren't interested in that, you are still in luck. The application and library folders can both be in your public folder. They just don't recommend it for security purposes.

This is all handled in your bootstrap file. Please look at this tutorial for more guidance:
Akra’s DevNotes Tutorial: Getting Started with the Zend Framework

Download the PDF tutorial and read through it a bunch of times until it starts to make sense. The Zend Framework application made in this tutorial is contained within the "zf-tutorial" folder, so all of the files needed exist in the public folder.

Here is the boostarp file Akra uses in the tutorial. Notice how he defines the path to the Controller:
PHP Code:
$frontController->setControllerDirectory('./application/controllers'); 
Also he puts the library folder (which stores the classes that make up the framework) inside the 'include_path':


PHP Code:
set_include_path('.' PATH_SEPARATOR './library'
PATH_SEPARATOR './application/models/'
PATH_SEPARATOR get_include_path()); 

PHP Code:
<?php
error_reporting
(E_ALL|E_STRICT);
date_default_timezone_set('Europe/London');

set_include_path('.' PATH_SEPARATOR './library'
PATH_SEPARATOR './application/models/'
PATH_SEPARATOR get_include_path());
include 
"Zend/Loader.php";

Zend_Loader::loadClass('Zend_Controller_Front');
// setup controller
$frontController Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->setControllerDirectory('./application/controllers');[/b]

// run!
$frontController->dispatch();
Hope this helps!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2008, 07:43 AM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default

Thanks for the great help! i will look into this and post if it has worked.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-10-2008, 01:07 PM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default

Maybe a bit late, but the tutorial you refer to is actually the one i used. Those options are not strange to me, but it still does not work. This website i am doing is an internal web application so i can change just about anything i want in the webserver. I also thought it could have something to do with the htaccess files. Do you, or somebody else, have another idea how to solve this problem.

EDIT: I found out it has something to do with the including of the css, img, js, etc files. I still cannot figure out how to get around this though. I use getcwd() to determine the current directory i am in and this seems to work fine for the css files but the javascript files give me nothing but headaches. What could cause this behaviour ?

Last edited by TB191 : 03-10-2008 at 02:41 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-14-2008, 09:19 AM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default

Solved the problem! It had everything to do with the baseURL. Everything would load correctly except for every included css, javascript etc file. Everthing is sorted out now, thanks for you help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-17-2008, 06:23 AM
kmg kmg is offline
Junior Member
 
Join Date: Mar 2008
Posts: 9
Default

So you had a basic html problem. You're going to want the <base> tag.

HTML BASE TAG
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:16 AM.