3

my index file is this

<?php
ini_set( "short_open_tag", 1 );
ini_set( "display_errors", 1 );
// Define path to application directory

defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);

// Let 'er rip
$application->bootstrap()->run();

when i run that

Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /var/www/Giftercity_backup/index.php on line 18 Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path=':.:/usr/share/php:/usr/share/pear') in /var/www/Giftercity_backup/index.php on line 18

user2605708
  • 51
  • 1
  • 2
  • 5

3 Answers3

6

For Ubuntu.
If you install ZendFramework package. i.e. sudo apt-get install zend-framework
It will put zend library files in /usr/share/php/libzend-framework-php/Zend/ folder
you have to just copy and paste that Zend/ folder into /user/share/php/
Run the following command in terminal.

cd /usr/share/php
sudo cp -R libzend-framework-php/Zend/ Zend
The Hungry Dictator
  • 3,444
  • 5
  • 37
  • 53
chanchal
  • 598
  • 6
  • 12
1

Put your index file in "public" directory.

Or if you want or cannot include files from parent directory you need to change this line:

set_include_path(implode(PATH_SEPARATOR, array(
  realpath(APPLICATION_PATH . '/../library'),
  get_include_path(),
)));

To

set_include_path(implode(PATH_SEPARATOR, array(
  realpath(APPLICATION_PATH . '/library'), // Here we have change
  get_include_path(),
)));

Of course I assume that you have already putted your Zend Files into library/Zend

You also need to remember to put .htaccess file with "deny from all" to your application, library, and any other directory you don't want users to get access to.

Btw. This method of including library is quite old and not recommended.

0

If your index.php file is located in /var/www/Giftercity_backup/index.php (according to the error output) then according to your code the library location should be in /var/www/library and application in /var/www/application which sounds wrong.

index.php should be in a public folder such as /var/www/Giftercity_backup/public, /var/www/Giftercity_backup/htdocs or similar and your VirtualHost DocumentRoot should point to that folder.

Additionally, your set_include_path didn't register library (include_path=':.:/usr/share/php:/usr/share/pear').

Mina
  • 1,508
  • 1
  • 10
  • 11