Zend Framework für Projekt verwenden

.zfproject.xml:
HTML:
<?xml version="1.0"?>
<projectProfile>
  <projectDirectory>
    <projectProfileFile/>
    <applicationDirectory>
      <apisDirectory enabled="false"/>
      <configsDirectory>
        <applicationConfigFile type="ini"/>
      </configsDirectory>
      <controllersDirectory>
        <controllerFile controllerName="index">
          <actionMethod actionName="index"/>
        </controllerFile>
        <controllerFile controllerName="error"/>
      </controllersDirectory>
      <layoutsDirectory enabled="false"/>
      <modelsDirectory/>
      <modulesDirectory enabled="false"/>
      <viewsDirectory>
        <viewScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="index">
            <viewScriptFile forActionName="index"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="error">
            <viewScriptFile forActionName="error"/>
          </viewControllerScriptsDirectory>
        </viewScriptsDirectory>
        <viewHelpersDirectory/>
        <viewFiltersDirectory enabled="false"/>
      </viewsDirectory>
      <bootstrapFile/>
    </applicationDirectory>
    <dataDirectory enabled="false">
      <cacheDirectory enabled="false"/>
      <searchIndexesDirectory enabled="false"/>
      <localesDirectory enabled="false"/>
      <logsDirectory enabled="false"/>
      <sessionsDirectory enabled="false"/>
      <uploadsDirectory enabled="false"/>
    </dataDirectory>
    <libraryDirectory>
      <zfStandardLibraryDirectory enabled="false"/>
    </libraryDirectory>
    <publicDirectory>
      <publicStylesheetsDirectory enabled="false"/>
      <publicScriptsDirectory enabled="false"/>
      <publicImagesDirectory enabled="false"/>
      <publicIndexFile/>
      <htaccessFile/>
    </publicDirectory>
    <projectProvidersDirectory enabled="false"/>
    <temporaryDirectory enabled="false"/>
    <testsDirectory>
      <testPHPUnitConfigFile/>
      <testApplicationDirectory>
        <testApplicationBootstrapFile/>
      </testApplicationDirectory>
      <testLibraryDirectory>
        <testLibraryBootstrapFile/>
      </testLibraryDirectory>
    </testsDirectory>
  </projectDirectory>
</projectProfile>
Das muss was anderes sein.
jedenfalls dürfte die jetzt nicht mehr aktuell sein nachdem ich meine pfade geändert habe.
Übrigens es geht endlich! Danke soweit!

Aber zur ini config ne frage:
da werden ja php settings etc verwendet. Übernimmt der die dann auch automatisch? Gibt es dazu eine gute referenz welche variablen möglich sind ODER wie er die eingaben in der ini verarbeitet.
 
Automatisch nicht du mußt schon den pfad der ini in der Bootstrap angeben dann läuft auch automatisch.

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

$application->bootstrap();

Die Variablen beschreibung findest du im Zend Handbuch.

Mfg Splasch
 
Das is schon logisch.
Ich meinte ja die Variablen in der ini.
Zum Beispiel scheint zend ja den Eintrag :
Code:
phpSettings.display_errors = 0
automatisch der php konfiguration zuordnen (natürlich wegen der referenz phpSettings) und auch anwenden. Und da ist jetzt die Frage gibt es da eine Referenz welche module und einstellungsmöglichkeiten man anpassen kann oder muss ich mir das anhand des manuals erarbeiten oder ergiebt sich das weitere im laufe des programmierens?

EDIT: btw: meine htaccess sollte so passen oder? localhost kann ja zugriff haben. Bzw: Brauche ich zum testen vielleicht sogar Browserzugriff auf den Ordner Test? Oder wird ausschliesslich die php.exe per console aufgerufen für die unit tests?
Code:
Order allow,deny
Deny from all
Allow from localhost


EDIT2: Ähm der generierte Ordner library ist ja leer? Ich vermute mal ich muss manuell den Ordner reinkopieren?
 
Zuletzt bearbeitet:
:mad::mad::mad:
Code:
Warning: include(D:\htdocs\Zend_Projekt\library\Zend\Application\Bootstrap\Bootstrap.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\php\PEAR\Zend\Loader.php on line 83

Warning: include() [function.include]: Failed opening 'Zend\Application\Bootstrap\Bootstrap.php' for inclusion (include_path='D:\htdocs\Zend_Projekt\application/../library;;.;C:\xampp\php\PEAR') in C:\xampp\php\PEAR\Zend\Loader.php on line 83

Fatal error: Class 'Zend_Application_Bootstrap_Bootstrap' not found in D:\htdocs\Zend_Projekt\application\Bootstrap.php on line 4
Nachdem ich den Ordner library mit Zend gefüllt habe....
Nach dem entfernen ging es trotzdem nicht mehr weg!
Genau das ist der Scheiss was macht es da?

Der Pfad: \Zend_Projekt\library\Zend\Application\Bootstrap\Bootstrap.php
ist schonmal falsch wo kommt der her? den hab ich so nicht festgelegt!
Was hat die Zend library hier zu suchen: C:\xampp\php\PEAR\Zend\Loader.php?
Warum kopiert er hier offenbar teile in ein verzeichnis wo er garnicht ran soll? (aus meiner sicht)!

gosh das ist genau das was mich so nervt!
ich geh ins bett....

anbei meine index.php:
PHP:
<?php
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));
define('APPLICATION_ENV', 'development');

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

require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/config.ini');
$application->bootstrap();
$application->run();
?>
config.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"

[staging : production]

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

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

include_path='D:\htdocs\Zend_Projekt\application/../library;;.;C:\xampp\php\PEAR'

Das ist dein include_path wie er 1. aus der php.ini kommt (vermutlich .;C:\xampp\php\PEAR) sowie ihn die Zend Framework ihn noch mit Hilfe von set_include_path fest legt (D:\htdocs\Zend_Projekt\application/../library). Diesen Eintrag siehst du auch in der Konfigurations-Datei:

includePaths.library = APPLICATION_PATH "/../library"

Da ZF mit autoloading arbeitet, werden - um die Bootstrap-Klasse zu finden - alle Include-Pfade durch gegangen, um 'Zend/Application/Bootstrap/Bootstrap.php' zu finden. Diese ist Teil der ZF-Library und muss über include-Pfad erreichbar sein. Wo hast du ZF hin entpackt? Dann kannst du das über 2 Wege beseitigen:

1. Du veränderst die php.ini und fügst an den Include-Pfad noch ZF an:

include_path = "[an_vorhandenen_kram_anhängen];C:\wo\ist\zend_framework\entpackt\library"

2. Du fügst einen weiteren Include-Pfad in die config.ini ein:

Code:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
includePaths.zf = "C:\wo\ist\zend_framework\entpackt\library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

EDIT:

EDIT2: Ähm der generierte Ordner library ist ja leer? Ich vermute mal ich muss manuell den Ordner reinkopieren?

Der Ordner library innerhalb des Projektes ist für eigene Erweiterungen gedacht. Hier kannst du beispielsweise deine eigene Basis-Controller-Action-Klasse oder View_Helper hinterlegen. Rein theoretisch kannst du da auch die Zend Framework Basis-Klassen rein legen. Das würde ich aber nicht tun, da das Deployment dann sehr umfangreich ist. Wenn du es dennoch tun willst, kommt es darauf an, wie der Rest des Projektes aufgebaut ist. Liegt deine index.php nun in dem Ordner, der die Unterordner "application" und "library" hat?
 
Zuletzt bearbeitet:
Also was mich in erster Linie mal mehr verwirrt ist dieser Pfad:
D:\htdocs\Zend_Projekt\library\Zend\Application\Bootstrap\Bootstrap.php
den der existiert 1. so nicht und den habe ich 2. nicht festgelegt.

Meine Ordnerstruktur:
Code:
D:\htdocs\Zend_Projekt>tree /F
?   .htaccess
?   .zfproject.xml
?   index.php
?
????application
?   ?   Bootstrap.php
?   ?   config.ini
?   ?
?   ????controllers
?   ?       ErrorController.php
?   ?       IndexController.php
?   ?
?   ????models
?   ????views
?       ????helpers
?       ????scripts
?           ????error
?           ?       error.phtml
?           ?
?           ????index
?                   index.phtml
?
????library
????tests
    ?   phpunit.xml
    ?
    ????application
    ?       bootstrap.php
    ?
    ????library
            bootstrap.php
in library soll zf mit rein. (hat den hintergrund ich entwickle hier auf meinem lokalen system für mehrere projekte. Und jeweils ein Ordner soll auf einen server am ende.)

EDIT:
brauche ich denn jetzt eigentlich den set_include_path in der index.php noch wenn ich das doch anscheinend in der config.ini festlegen kann?

EDIT2:
ich kapiers einfach nicht... ich hab nur mal testweise die library geleert und es wird trotzdem die zend startpage angezeigt..... also wo zum geier zieht der jetzt zend ran
config ini:
Code:
...
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
includePaths.zf = APPLICATION_PATH "/../library/Zend"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
...
 
Zuletzt bearbeitet:
So ich hab folgendes nun rausbekommen:
Er hat offenbar die library hier reinkopiert:
C:\xampp\php\PEAR\Zend
Die Frage die sich mir stellt: Warum macht das so einen scheiss?
Ich denke ich lösche mal den Ordner weil ich vermute das der da nicht hingehört!
 
So wunderbar es funktioniert....
Nachdem ich Zend im Pear Ordner gelöscht habe und statt dessen in die library eingefügt hab ich noch die pfade etwas schöner angepasst:

index.php
PHP:
<?php
define('ROOT_PATH', realpath(dirname(__FILE__)));
define('APPLICATION_PATH', realpath(ROOT_PATH . '/application'));
define('LIBRARY_PATH', realpath(ROOT_PATH . '/library'));
define('APPLICATION_ENV', 'development');

set_include_path(implode(PATH_SEPARATOR, array(LIBRARY_PATH , get_include_path())));


require_once 'Zend/Application.php';


$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/config.ini');
$application->bootstrap();
$application->run();
?>

config.ini
Code:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = LIBRARY_PATH
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

[staging : production]

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

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

Danke für eure Hilfe!
 

Neue Beiträge

Zurück