php.de

Zurück   php.de > Webentwicklung > Server, Hosting und Workstations

Server, Hosting und Workstations Server-Konfigurationsdateien (.htaccess/httpd.conf) und Arbeiten auf Serverebene

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 12.04.2010, 21:59  
Benutzer
 
Registriert seit: 03.04.2008
Beiträge: 64
Exituz23 befindet sich auf einem aufstrebenden Ast
Standard Zend Rewrite

Hallöchen.

Ich versuche Zend zum rewrtien zu bewegen.

Also habe ich versucht mir eine vhost.conf im Virtualhost Ordner anzulegen. (Ist eine Plesk Kiste)
Inhalt: vhost.conf
Zitat:
irtualHost vs242057.vserver.de:80>
ServerName vs242057.vserver.de
ServerRoot /var/www/vhosts/vs242057.vserver.de/httpdocs/
DocumentRoot /var/www/vhosts/vs242057.vserver.de/httpdocs/roc/roc

RewriteEngine off

<Location />
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php
</Location>

<Directory /var/www/vhosts/vs242057.vserver.de/httpdocs/roc/roc>
Allow from all
Order allow,deny
AllowOverride All
</Directory>

</VirtualHost>
Gehe ich dann auf http://vs242057.vserver.de/roc/roc erscheint dort die index Seite vom ZF.

Das macht es aber auch ohne die vhost.conf.

Aber gehe ich z.B. http://vs242057.vserver.de/roc/roc/foo/bar
erscheint bei mir nur die Meldung, dass es den Ordner nicht gibt. Zu erwarten wäre hier eine Zend Exception bzw. eine Seite, wenn es den Controller gäbe.

Also habe ich noch Methode 2 versucht und eine .htaccess angelegt.
Allerdings erreiche ich die Seite anschließend nur noch über
http://vs242057.vserver.de/roc/roc/index.php sonst gar nicht.

Inhalt .htaccess:

Zitat:
RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

Mit Dank im Voraus.
Exituz23 ist offline   Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 12.04.2010, 23:31  
Erfahrener Benutzer
 
Registriert seit: 28.05.2008
Beiträge: 2.094
PHP-Kenntnisse:
Fortgeschritten
rudygotya ist einfach richtig nettrudygotya ist einfach richtig nettrudygotya ist einfach richtig nettrudygotya ist einfach richtig nettrudygotya ist einfach richtig nett
Standard

Ist mod_rewrite denn aktiviert? Welches Betriebssystem läuft denn da drauf? Eine .htaccess könnte z.b. so aussehen (von meinem lokalen Apachen, environment kannst du ja setzen, wie du möchtest):

Code:
SetEnv APPLICATION_ENVIRONMENT development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Zitat:
Zu erwarten wäre hier eine Zend Exception bzw. eine Seite, wenn es den Controller gäbe.
Abhängig von deinen settings siehst du da nicht unbedingt etwas. Ich poste dir mal eine index.php:

PHP-Code:
<?php

ob_start
();
define('APPLICATION_PATH'realpath(dirname(__FILE__) . '/../application/'));
require_once (
APPLICATION_PATH"/../library/ExtZend/Debug.php");
$debug Debug::getInstance();
$debug->trace('start');
defined('APPLICATION_PATH')
    || 
define('APPLICATION_PATH'realpath(dirname(__FILE__) . '/../application'));

defined('APPLICATION_ENVIRONMENT')
    or 
define('APPLICATION_ENVIRONMENT''development');
define('HTMLPURIFIER_PREFIX'APPLICATION_PATH.'/../library');
set_include_path(
    
realpath(APPLICATION_PATH '/../library')
    . 
PATH_SEPARATOR APPLICATION_PATH '/models'
    
PATH_SEPARATOR get_include_path()
);

try {
    require_once 
"Zend/Loader/Autoloader.php";
    require_once 
"Zend/Loader.php";
    
$loader Zend_Loader_Autoloader::getInstance();
    
$loader->registerNamespace(
        array(
            
'Xyz_'
            
,'ExtZend_'
        
)
    );
    
$loader->pushAutoloader(array("ExtZend_Autoloader""autoload"));
    require_once 
APPLICATION_PATH '/Bootstrap.php';
    require_once 
'Zend/Application.php';
    
$application = new Zend_Application(
        
APPLICATION_ENVIRONMENT,
        
APPLICATION_PATH '/config/general.ini'
    
);
    
$application->bootstrap()->run();
} catch (
Exception $exception) {
    echo 
'Leider ist ein Fehler aufgetreten!';
    if (
defined('APPLICATION_ENVIRONMENT')
        && 
APPLICATION_ENVIRONMENT != 'production'
    
) {
        echo 
'<br /><br />' $exception->getMessage() . '<br />'
           
'<div align="left">Stack Trace:'
           
'<pre>' $exception->getTraceAsString() . '</pre></div>';
    }
}
ob_end_flush();
#$debug->toFile("",true);
Eine settings.ini kann z.b. so aussehen:

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"
    phpSettings.date.timezone   = "Europe/Berlin"
    database.adapter            = pdo_mysql
    database.params.host        = localhost
    database.params.username    = ***
    database.params.password    = ***
    database.params.dbname      = ***
    database.params.driver_options.1002        = "SET NAMES utf8"
    resources.layout.layoutpath = APPLICATION_PATH "/layouts"
    autoloadernamespaces.extzend = "ExtZend_"
    autoloadernamespaces.xyz = "Xyz_"
    resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
    resources.modules[] = ""

[staging : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    phpSettings.error_reporting = E_ALL ^ E_NOTICE

[testing : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    phpSettings.error_reporting = E_ALL ^ E_NOTICE

[development : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    phpSettings.error_reporting = E_ALL | STRICT
Und hier noch ein ein verkürztes bootstrapping:

PHP-Code:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
    protected 
$_config;

    protected function 
_initConfig()
    {
        
$this->_config =
            new 
Zend_Config_Ini(
                
APPLICATION_PATH '/config/general.ini'
                
APPLICATION_ENVIRONMENT
        
);
        
Zend_Registry::set('config'$this->_config);
        
Zend_Registry::set('env'APPLICATION_ENVIRONMENT);
        return 
$this->_config;
    }

    protected function 
_initAutoload()
    {
        
$moduleLoader = new Zend_Application_Module_Autoloader(array(
            
'namespace' => '',
            
'basePath'  => APPLICATION_PATH));
        return 
$moduleLoader;
    }

    protected function 
_initFrontController()
    {
        
$this->bootstrap("config");
        
$frontController Zend_Controller_Front::getInstance(
            
$this->_config->resources->frontController->toArray()
        );
        
$frontController->setControllerDirectory(
            array(
                
'booking' => APPLICATION_PATH '/modules/booking/controllers',
                
'admin' => APPLICATION_PATH '/modules/admin/controllers',
            )
        );
        
$frontController->setParam('env'APPLICATION_ENVIRONMENT);
        
$frontController->setDefaultModule("booking");
        
Zend_Controller_Action_HelperBroker::addPath(
            
'Xyz/Controller/Action/Helper',
            
'Helper'
        
);
        return 
$frontController;
    }

    protected function 
_initPlugins() {
        
$this->bootstrap("FrontController");
        
$frontController $this->getResource('FrontController');
        
$frontController->registerPlugin(new Xyz_Plugin_SetLayout());
        
$frontController->registerPlugin(new Xyz_Plugin_Ajax());
    }
    protected function 
_initRequest()
    {
        
$this->bootstrap('FrontController');
        
$frontController $this->getResource('FrontController');
        
$request = new Zend_Controller_Request_Http();
        
$frontController->setRequest($request);
        return 
$request;
    }
    protected function 
_initDatabase()
    {
        
$this->bootstrap("config");
        
$adapter $this->_config->database->adapter;
        
$params  $this->_config->database->params->toArray();
        
$dbA Zend_Db::factory($adapter$params);
        
$dbA->setFetchMode(Zend_Db::FETCH_OBJ);
        
Zend_Registry::set('Zend_Db'$dbA);
        
Zend_Db_Table_Abstract::setDefaultAdapter($dbA);
        if(
"production" !== APPLICATION_ENVIRONMENT) {
            
$dbA->getProfiler()->setEnabled(true);
        }
        return 
$dbA;
    }
    protected function 
_initView()
    {
        
$layout Zend_Layout::startMvc();
        
Zend_Registry::set('Layout'$layout);
        
$doctypeHelper = new Zend_View_Helper_Doctype();
        
$doctypeHelper->doctype(Zend_View_Helper_Doctype::XHTML1_TRANSITIONAL);
        return 
$layout->getView();
    }

    public function 
run ()
    {
        
$frontController $this->getResource('FrontController');
        
$frontController->dispatch();
    }
}
Eine vhost conf noch:

Code:
<VirtualHost *:80>
    DocumentRoot /home/basti/pages/
    ServerName pages
    ServerAlias 127.0.0.1   
    DirectoryIndex index.html index.php 
    <Directory "/home/basti/pages">
        Options +Indexes
        Order allow,deny
        Allow from all
        AllowOverride All
    </Directory>
</VirtualHost>
Das ist in etwa mein lokales setup. Damit solltest du das ZF zum laufen kriegen

viel Erfolg


Basti
__________________
++++ Wieder einer ins Netz gegangen: Phishers Fritz zufrieden ++++
Blog
rudygotya ist offline   Mit Zitat antworten
Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Zend Webinare robo47 Off-Topic Diskussionen 0 16.03.2010 10:02
Zend Zertifizierung krackmoe PHP Tipps 2009 6 09.03.2010 12:55
Helfer Gesucht: Zend remote debugging ravarious Off-Topic Diskussionen 14 27.01.2010 10:27
Zend Studio (Javascript Unterstützung)? customer-tk Off-Topic Diskussionen 6 12.11.2009 22:42
[S] Zend Framework Coder ThisRockZ Beitragsarchiv 0 14.10.2009 13:14
Problem bei der ID Reihenfolge zum blättern mit Zend Smokeler PHP Tipps 2009 2 29.05.2009 02:19
Zend Optimizer tito-toti Server, Hosting und Workstations 2 27.03.2009 15:16
Zend Studio for Eclipse und Zend Framework KeKs0r PHP-Fortgeschrittene 5 15.12.2008 15:10
Google calendar API - ZEND? cyberholic PHP-Fortgeschrittene 5 17.04.2008 15:28
Zend Framework Melchior PHP-Fortgeschrittene 29 13.03.2008 21:12
Zend Optimizer - Zerstörte datei brian johnson Off-Topic Diskussionen 3 28.11.2007 15:07
Eclipse & Zend Debugger? freq.9 PHP Tipps 2006 5 11.10.2006 00:11
[Erledigt] Zend Optimizer auf SUSE 9.3 server installieren Server, Hosting und Workstations 35 14.02.2006 16:55
Alternativen zu Zend SafeGuard (Zend Optimizer) PHP Tipps 2004-2 2 15.11.2004 14:07

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
zend rewrite, zend server mod_rewrite aktivieren, zend mod_rewrite, phpsettings.error_reporting, zend rewrite document root, phpsettings.date.timezone = \europe/berlin\, application_environment, zend error_reporting, zend server mod_rewrite, phpsettings.display_errors e_all, zend server rewrite, vhost.conf timezone, zend server rewriteengine, zend phpsettings.error_reporting, mod_rewrite aktivieren zend, zend framework _initdatabase(), zend phpsettings error_reporting, rewrite zend, ´require_once \'zend/application.php\';, mod_rewrite zend

Alle Zeitangaben in WEZ +2. Es ist jetzt 22:52 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum