PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
acidHL
Forum Commoner
Posts: 41 Joined: Wed Dec 07, 2005 7:38 am
Post
by acidHL » Fri Sep 01, 2006 7:05 am
Hi Guys, im trying test out Zend Framework on a Centos server /w XAMPP.
My file structure is as follows:
Code: Select all
/ = web root
/ZendFramework-0.1.5/ ... <-- Including library.
/controllers/IndexController.php
/index.php
/index_html.php
/.htaccess
My code is as follows:
/index.php:
Code: Select all
<?php
include 'Zend.php';
Zend::loadClass('Zend_Controller_Front');
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('controllers');
$controller->dispatch();
?>
/.htaccess:
Code: Select all
RewriteEngine on
#RewriteLog "/opt/lampp/htdocs/sites/ZendTest/rewrite.log"
RewriteRule !\.(js|ico|gif|jpg|png|css|php)$ /index.php
php_value include_path "/opt/lampp/htdocs/sites/ZendTest/ZendFramework-0.1.5/library"
Despite the fact that /controllers/IndexController.php exists I get this error:
Fatal error: Uncaught exception 'Zend_Exception' with message 'File "controllers/IndexController.php" was not found.' in /opt/lampp/htdocs/sites/ZendTest/ZendFramework-0.1.5/library/Zend.php:190 Stack trace: #0 /opt/lampp/htdocs/sites/ZendTest/ZendFramework-0.1.5/library/Zend.php(87): Zend::loadFile('IndexController...', 'controllers', true) #1 /opt/lampp/htdocs/sites/ZendTest/ZendFramework-0.1.5/library/Zend/Controller/Dispatcher.php(170): Zend::loadClass('IndexController', 'controllers') #2 /opt/lampp/htdocs/sites/ZendTest/ZendFramework-0.1.5/library/Zend/Controller/Dispatcher.php(136): Zend_Controller_Dispatcher->_dispatch(Object(Zend_Controller_Dispatcher_Token), true) #3 /opt/lampp/htdocs/sites/ZendTest/ZendFramework-0.1.5/library/Zend/Controller/Front.php(254): Zend_Controller_Dispatcher->dispatch(Object(Zend_Controller_Dispatcher_Token)) #4 /opt/lampp/htdocs/sites/ZendTest/index.php(10): Zend_Controller_Front->dispatch() #5 {main} thrown in /opt/lampp/htdocs/sites/ZendTest/ZendFramework-0.1.5/library/Zend.php on line 190
Does anybody have an ideas? Just FYI i'm following this tutorial:
http://www-128.ibm.com/developerworks/e ... zend2.html
Thanks in advance!
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Fri Sep 01, 2006 8:07 am
Use ZF in the docroot, not a subdir within the docroot.
acidHL
Forum Commoner
Posts: 41 Joined: Wed Dec 07, 2005 7:38 am
Post
by acidHL » Fri Sep 01, 2006 8:15 am
I just tried this, and updated .htaccess so that php_include was correct etc and I get an identical error
Did I break it?
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Fri Sep 01, 2006 8:29 am
Your include path is working fine, it's your path to the controllers dir that is not working.
however you'll also have problems when trying to use the get vars unless you also modify your .htaccess with:
Code: Select all
RewriteRule !\.(js|ico|gif|jpg|png|css|php)$ /sites/ZendTest/index.php
for the purposes of this tutorial, and for the sake of your own sanity and patience.. just use it in the dam document root.
acidHL
Forum Commoner
Posts: 41 Joined: Wed Dec 07, 2005 7:38 am
Post
by acidHL » Fri Sep 01, 2006 9:36 am
I can't use the main document root of the apache server as this is a test machine testing multiple sites.
I have a virtual host of zend-dev.domain.com pointing to /opt/lampp/htdocs/sites/ZendTest
The rewrite rule surely isnt a problem as no matter what url I go to it gets sent to index.php and index.php gives me the Zend error.
My sanity went out the door years ago