11

PHP / Zend Framework Path Problem

 3 years ago
source link: https://www.codesd.com/item/php-zend-framework-path-problem.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PHP / Zend Framework Path Problem

advertisements

I've been trying to get to grips with zend framework and a bit of php and am having problems with (I think) some sort of path setting.

Basically I'm having some problems with getting a simple page to work.

I have a standard directory structure from the zend quickstart sample. It has the structure:

app
->public
->library

When I create the following "hello.php" file in the public directory, I get an error from "require-once"

Warning: require_once(/../application/Zend/Rest/Server.php) [function.require-once]: failed to open stream: No such file or directory in /home/bestpubi/public_html/svc/public/hello.php on line 2 Fatal error: require_once() [function.require]: Failed opening required '/../application/Zend/Rest/Server.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bestpubi/public_html/svc/public/hello.php on line 2

My hello.php file looks like this:

<?php
require_once '../application/Zend/Rest/Server.php';
/**
* Say Hello
*/
function sayHello()
{
return 'finally';
}
$server = new Zend_Rest_Server();
$server->addFunction('sayHello');
$server->handle();
?>

I could really do with some help as this is driving me a bit mad, and I'm sure it's something silly.


You are requesting the required library file as follows.

require_once '../application/Zend/Rest/Server.php';

The error message indicates that, there is no such file in the path specified.

Usuallay zend framework contains it 'Zend' library inside /library directory. If you have the Zend directory in your downloaded ZendFramework files, copy it to /library directory. So that the Zend directory structure would be as follows

/library/Zend

This is a simple way to get started. Once you are familiar with the environment, try to use include path in your setting.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK