Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP][Zend]Przeniesieni z windowsa na ubuntu.
Forum PHP.pl > Forum > Przedszkole
cykcykacz
Witam,
przeniosłem projekt stworzony w systemie operacyjnym Windows na Linuxa Ubuntu. Jednak mam problem z działaniem projektu.
Kod
Warning: include_once(Zend/Application/Module/AutoLoader.php): failed to open stream: No such file or directory in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146 Warning: include_once(): Failed opening 'Zend/Application/Module/AutoLoader.php' for inclusion (include_path='/var/www/testy/application/../library:/var/www/testy/library:/var/www/testy/application::/usr/share/php/libzend-framework-php') in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146 Fatal error: Class 'Zend_Application_Module_AutoLoader' not found in /var/www/testy/application/Bootstrap.php on line 9

Proszę o pomoc.
darko
W głównym pliku index.php przed końcową sekcją zawierającą:

  1. /** Zend_Application */
  2. require_once 'library/Zend/Application.php';
  3.  
  4. // Create application, bootstrap, and run
  5. $application = new Zend_Application(
  6. APPLICATION_ENV,
  7. APPLICATION_PATH . '/configs/.application.ini'
  8. );
  9. $application->bootstrap()->run();


dodaj:

  1. $path = dirname($_SERVER['SCRIPT_FILENAME']);
  2. ini_set('include_path', $path . "/library:". $path . "/application/configs");



Powinno pomóc.
cykcykacz
Dodałem jednak dostaję taki komunikat błędu:
Kod
Warning: include_once(Zend/Application/Module/AutoLoader.php): failed to open stream: No such file or directory in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146 Warning: include_once(): Failed opening 'Zend/Application/Module/AutoLoader.php' for inclusion (include_path='/var/www/testy/public/library:/var/www/testy/public/application/configs') in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146 Warning: require_once(Zend/Exception.php): failed to open stream: No such file or directory in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 98 Fatal error: require_once(): Failed opening required 'Zend/Exception.php' (include_path='/var/www/testy/public/library:/var/www/testy/public/application/configs') in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 98

Mój plik index.php
CODE

<?php

// 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(dirname(__FILE__) . '/../library'),
realpath(dirname(__FILE__) . '/../application'),
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'
);

$path = dirname($_SERVER['SCRIPT_FILENAME']);
ini_set('include_path', $path . "/library:". $path . "/application/configs");

$application->bootstrap()
->run();

Mój plik application.ini
CODE

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
autoloadernamespaces.0 = "Zend_"
autoloadernamespaces.1 = "forms_"
resources.layout.layoutpath = APPLICATION_PATH "/layouts"

resources.db.adapter = mysqli
resources.db.isDefaultAdapter = true
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password = 54ajmon5
resources.db.params.dbname = zftutorial
resources.db.params.charset = 'utf8'

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

Plik bootstarp.php
CODE

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
private $_acl;

protected function _initAutoLoad() {

$modelLoader = new Zend_Application_Module_AutoLoader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH,
'resourceTypes' => array (
'validator' => array(
'path' => 'views/validators',
'namespace' => 'Validator'
)
)


));
if(Zend_Auth::getInstance()->hasIdentity())
{
Zend_Registry::set('role',Zend_Auth::getInstance()->getStorage()->read()->role );
} else {
Zend_Registry::set('role', 'guest');
}

$this->_acl = new Model_LibraryAcl;
$this->_auth = Zend_Auth::getInstance();

$fc = Zend_Controller_Front::getInstance();
$fc->registerPlugin(new Plugin_AccessCheck($this->_acl));


return $modelLoader;
}
darko
1. nie zastosowałeś się do moich wskazówek, te dwie linie kodu mają być przed sekcją /** Zend_Application */ ...
2. która wersja ZF?
3. u mnie jest
  1. /** Zend_Application */
  2. require_once 'library/Zend/Application.php';
  3.  
  4. // Create application, bootstrap, and run
  5. $application = new Zend_Application(
  6. APPLICATION_ENV,
  7. APPLICATION_PATH . '/configs/application.ini'
  8. );


u Ciebie:

  1. /** Zend_Application */
  2. require_once 'Zend/Application.php';
  3.  
  4. // Create application, bootstrap, and run
  5. $application = new Zend_Application(
  6. APPLICATION_ENV,
  7. APPLICATION_PATH . '/configs/application.ini'
  8. );


4. ja mam u siebie w application.ini tę linię zakomentowaną:
;includePaths.library = APPLICATION_PATH "/../library"

5. spróbuj też wywalić z indexu to:
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(dirname(__FILE__) . '/../library'),
realpath(dirname(__FILE__) . '/../application'),
get_include_path(),
)));
cykcykacz
Do katalogu "library" mam dowiązanie, coś na wzór:
Kod
sudo ln -s /usr/share/php/libzend-framework-php/Zend /home/user/Zend/project/library/ , gdzie folder /home/user/Zend/project/ jest z twoim projektem;

Teraz skopiowałem katalog Zend do katalogu aplikacji "library" jednak nie pomogło.
Tutaj na skrinie widać strukturę moich katalogów http://yfrog.com/f/83zrzutekranuppap/

Po dodaniu zmian dostaję taki komunikat:
Kod
Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /var/www/testy/public/index.php on line 22 Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/var/www/testy/public/library:/var/www/testy/public/application/configs') in /var/www/testy/public/index.php on line 22

Mój plik index.php
Kod
<?php

// 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(dirname(__FILE__) . '/../library'),
    realpath(dirname(__FILE__) . '/../application'),
    get_include_path(),
)));

$path = dirname($_SERVER['SCRIPT_FILENAME']);
ini_set('include_path', $path . "/library:". $path . "/application/configs");

/** Zend_Application */
require_once 'Zend/Application.php';

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



$application->bootstrap()
            ->ru


W bootstrap.php zakomentowałem:
Kod
;includePaths.library = APPLICATION_PATH "/../library"


Coś musiałem namieszać z tymi PATH. smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.