Search Results

Search found 156 results on 7 pages for 'phtml'.

Page 7/7 | < Previous Page | 3 4 5 6 7 

  • Server error 500: Undefinable problem with my Zend Framework based site

    - by sanders
    Hello everyone, Lately I had to reinstall my development site on my ubuntu machine since my system crashed after an os update. 4 days later my site is still not running as it should. Whenever i do an action which has in it an action on a database, it stops working. For example when Registring a new user, i get the following error: [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/user/register [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/css/main.css My Bootstrap class looks like this: <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{ /** * * @var unknown_type */ public $frontcontroller; /** * * @var unknown_type */ protected $_logger; /** * * @var unknown_type */ protected $_acl; /** * * @var unknown_type */ protected $_auth; /** * Setup the logging */ protected function _initLogging() { $this->bootstrap('frontController'); $logger = new Zend_Log(); $writer = 'production' == $this->getEnvironment() ? new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/logs/app.log') : new Zend_Log_Writer_Firebug(); $logger->addWriter($writer); if ('production' == $this->getEnvironment()) { $filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT); $logger->addFilter($filter); } $this->_logger = $logger; Zend_Registry::set('log', $logger); } protected function _initDefaultModuleAutoloader(){ $this->_logger->info('Bootstrap '. __METHOD__); $this->_resourceLoader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'EventManager', 'basePath' => APPLICATION_PATH . '/modules/eventManager', )); $this->_resourceLoader->addResourceTypes(array( 'modelResource' => array( 'path' => 'models/resources', 'namespace' => 'Resource', ), 'service' => array( 'path' => 'services', 'namespace' => 'Service' ), )); } // @todo develop this function protected function _initDbProfiler(){ $this->_logger->info('Bootstrap ' . __METHOD__); if ('production' !== $this->getEnvironment()) { $this->bootstrap('db'); $profiler = new Zend_Db_Profiler_Firebug('All DB Queries'); $profiler->setEnabled(true); $this->getPluginResource('db')->getDbAdapter()->setProfiler($profiler); } } /** * Add Controller Action Helpers */ protected function _initActionHelpers() { $this->_logger->info('Bootstrap ' . __METHOD__); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Acl()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_RedirectCommon()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Service()); } /** * * @return unknown_type */ protected function _initRoutes(){ $this->_logger->info('Initialize Routes '. __METHOD__); $this->bootstrap('frontController'); $router = $this->frontController->getRouter(); $route = new Zend_Controller_Router_route( 'register', array( 'controller' => 'user', 'action' => 'register' ) ); $router->addRoute('register',$route); $route = new Zend_Controller_Router_route( 'login', array( 'controller' => 'user', 'action' => 'login' ) ); $router->addRoute('login',$route); $route = new Zend_Controller_Router_route( 'logout', array( 'controller' => 'user', 'action' => 'logout' ) ); $router->addRoute('logout',$route); } /** * * @return void */ protected function _initLocale(){ $this->_logger->info('Bootstrap '.__METHOD__); $locale = new Zend_Locale('nl_NL'); Zend_Registry::set('Zend_Locale', $locale); } protected function _initAcl(){ $this->_acl = new EventManager_Service_Acl(); } /** * * @return void */ protected function _initViewSettings(){ $this->_logger->info('Bootstrap '.__METHOD__); $this->bootstrap('view'); $this->bootstrap('Acl'); $this->_view = $this->getResource('view'); //set encoding and doctype $this->_view->setEncoding('UTF-8'); $this->_view->doctype('XHTML1_STRICT'); $this->_view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8'); $this->_view->headMeta()->appendHttpEquiv('Content-Language', 'en-US'); //@todo op een later moment moeten hier nog de stylesheets worden toegevoegd $this->_view->headLink()->appendStylesheet('/css/main.css'); //$this->_view->headTitle('Event Manager'); /* Set the head style. $this->_view->headTitle->headStyle(); */ $this->_view->headTitle()->setSeparator(' - '); $this->_auth = Zend_Auth::getInstance(); $navigation = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml','nav'); $navContainer = new Zend_Navigation($navigation); $this->_view->navigation($navContainer)->setAcl($this->_acl)->setRole($this->_auth->getStorage()->read()->usr_role); //THIS IS LINE 169!!!!!!!!! } /** * Add graceful error handling to the dispatch, this will handle * errors during Front Controller dispatch. */ public function run() { $errorHandling = $this->getOption('errorhandling'); try { parent::run(); } catch(Exception $e) { if (true == (bool) $errorHandling['graceful']) { $this->__handleErrors($e, $errorHandling['email']); } else { throw $e; } } } /** * Handle errors gracefully, this will work as long as the views, * and the Zend classes are available * * @param Exception $e * @param string $email */ protected function __handleErrors(Exception $e, $email) { header('HTTP/1.1 500 Internal Server Error'); $view = new Zend_View(); $view->addScriptPath(dirname(__FILE__) . '/../views/scripts'); echo $view->render('fatalError.phtml'); if ('' != $email) { $mail = new Zend_Mail(); $mail->setSubject('Fatal error in application Storefront'); $mail->addTo($email); $mail->setBodyText( $e->getFile() . "\n" . $e->getMessage() . "\n" . $e->getTraceAsString() . "\n" ); @$mail->send(); } } } I have tried to debug my code, but everyting goes well until I do somethign with the db. But I don't know what goes wrong with the db. I don't get any clear error messages. Can someone help me? Some more possible interesting data: [bootstrap] resources.db.adapter = "PDO_MYSQL" resources.db.isdefaulttableadapter = true resources.db.params.dbname = "ladosa" resources.db.params.username = "root" resources.db.params.password = "root" resources.db.params.hostname = "localhost" resources.db.params.charset = "UTF8" resources.db.params.profiler.enabled = true resources.db.params.profiler.class = Zend_Db_Profiler_Firebug Autoloadernamespaces[] = "Zend_" Autoloadernamespaces[] = "SF_" phpsettings.display_errors = 0 phpsettings.error_reporting = 8191 phpSettings.date.timezone = "Europe/Amsterdam" bootstrap.path = APPLICATION_PATH"/bootstrap/Bootstrap.php" pluginPaths.resource_ = APPLICATION_PATH"/resources" resources.frontcontroller.moduledirectory = APPLICATION_PATH"/modules" resources.frontcontroller.defaultmodule = "eventManager" resources.frontcontroller.params.prefixDefaultModule = true resources.frontcontroller.exceptions = false resources.view[] = "" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.view.encoding = "UTF-8" resources.view.title = Rode kruis Vrijwilligers applicatie ;resources.view.helperPath.Default_View_Helper = APPLICATION_PATH "/modules/eventManager/views/helpers" resources.layout.layout = "main" [production:bootstrap] [development:bootstrap] ;resources.frontController.throwExceptions = 1 ;phpSettings.display_startup_errors=1 ;phpSettings.display_errors = 1 ;resources.frontcontroller.throwerrors = [test:production] btw. I CAN login to my database command line with the given username and password. Update: today i decided to investigate on my http request and i came to an error 500. My apache logs don't give any related information, I think. I posted the logs above. Any idea's?

    Read the article

  • Server error 500: Undefinable problem with my Zend Framework based site

    - by sanders
    Lately I had to reinstall my development site on my ubuntu machine since my system crashed after an os update. 4 days later my site is still not running as it should. Whenever i do an action which has in it an action on a database, it stops working. For example when Registring a new user, i get the following error: [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/user/register [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/css/main.css My Bootstrap class looks like this: <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{ /** * * @var unknown_type */ public $frontcontroller; /** * * @var unknown_type */ protected $_logger; /** * * @var unknown_type */ protected $_acl; /** * * @var unknown_type */ protected $_auth; /** * Setup the logging */ protected function _initLogging() { $this->bootstrap('frontController'); $logger = new Zend_Log(); $writer = 'production' == $this->getEnvironment() ? new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/logs/app.log') : new Zend_Log_Writer_Firebug(); $logger->addWriter($writer); if ('production' == $this->getEnvironment()) { $filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT); $logger->addFilter($filter); } $this->_logger = $logger; Zend_Registry::set('log', $logger); } protected function _initDefaultModuleAutoloader(){ $this->_logger->info('Bootstrap '. __METHOD__); $this->_resourceLoader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'EventManager', 'basePath' => APPLICATION_PATH . '/modules/eventManager', )); $this->_resourceLoader->addResourceTypes(array( 'modelResource' => array( 'path' => 'models/resources', 'namespace' => 'Resource', ), 'service' => array( 'path' => 'services', 'namespace' => 'Service' ), )); } // @todo develop this function protected function _initDbProfiler(){ $this->_logger->info('Bootstrap ' . __METHOD__); if ('production' !== $this->getEnvironment()) { $this->bootstrap('db'); $profiler = new Zend_Db_Profiler_Firebug('All DB Queries'); $profiler->setEnabled(true); $this->getPluginResource('db')->getDbAdapter()->setProfiler($profiler); } } /** * Add Controller Action Helpers */ protected function _initActionHelpers() { $this->_logger->info('Bootstrap ' . __METHOD__); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Acl()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_RedirectCommon()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Service()); } /** * * @return unknown_type */ protected function _initRoutes(){ $this->_logger->info('Initialize Routes '. __METHOD__); $this->bootstrap('frontController'); $router = $this->frontController->getRouter(); $route = new Zend_Controller_Router_route( 'register', array( 'controller' => 'user', 'action' => 'register' ) ); $router->addRoute('register',$route); $route = new Zend_Controller_Router_route( 'login', array( 'controller' => 'user', 'action' => 'login' ) ); $router->addRoute('login',$route); $route = new Zend_Controller_Router_route( 'logout', array( 'controller' => 'user', 'action' => 'logout' ) ); $router->addRoute('logout',$route); } /** * * @return void */ protected function _initLocale(){ $this->_logger->info('Bootstrap '.__METHOD__); $locale = new Zend_Locale('nl_NL'); Zend_Registry::set('Zend_Locale', $locale); } protected function _initAcl(){ $this->_acl = new EventManager_Service_Acl(); } /** * * @return void */ protected function _initViewSettings(){ $this->_logger->info('Bootstrap '.__METHOD__); $this->bootstrap('view'); $this->bootstrap('Acl'); $this->_view = $this->getResource('view'); //set encoding and doctype $this->_view->setEncoding('UTF-8'); $this->_view->doctype('XHTML1_STRICT'); $this->_view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8'); $this->_view->headMeta()->appendHttpEquiv('Content-Language', 'en-US'); //@todo op een later moment moeten hier nog de stylesheets worden toegevoegd $this->_view->headLink()->appendStylesheet('/css/main.css'); //$this->_view->headTitle('Event Manager'); /* Set the head style. $this->_view->headTitle->headStyle(); */ $this->_view->headTitle()->setSeparator(' - '); $this->_auth = Zend_Auth::getInstance(); $navigation = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml','nav'); $navContainer = new Zend_Navigation($navigation); $this->_view->navigation($navContainer)->setAcl($this->_acl)->setRole($this->_auth->getStorage()->read()->usr_role); //THIS IS LINE 169!!!!!!!!! } /** * Add graceful error handling to the dispatch, this will handle * errors during Front Controller dispatch. */ public function run() { $errorHandling = $this->getOption('errorhandling'); try { parent::run(); } catch(Exception $e) { if (true == (bool) $errorHandling['graceful']) { $this->__handleErrors($e, $errorHandling['email']); } else { throw $e; } } } /** * Handle errors gracefully, this will work as long as the views, * and the Zend classes are available * * @param Exception $e * @param string $email */ protected function __handleErrors(Exception $e, $email) { header('HTTP/1.1 500 Internal Server Error'); $view = new Zend_View(); $view->addScriptPath(dirname(__FILE__) . '/../views/scripts'); echo $view->render('fatalError.phtml'); if ('' != $email) { $mail = new Zend_Mail(); $mail->setSubject('Fatal error in application Storefront'); $mail->addTo($email); $mail->setBodyText( $e->getFile() . "\n" . $e->getMessage() . "\n" . $e->getTraceAsString() . "\n" ); @$mail->send(); } } } I have tried to debug my code, but everyting goes well until I do somethign with the db. But I don't know what goes wrong with the db. I don't get any clear error messages. Can someone help me? Some more possible interesting data: [bootstrap] resources.db.adapter = "PDO_MYSQL" resources.db.isdefaulttableadapter = true resources.db.params.dbname = "ladosa" resources.db.params.username = "root" resources.db.params.password = "root" resources.db.params.hostname = "localhost" resources.db.params.charset = "UTF8" resources.db.params.profiler.enabled = true resources.db.params.profiler.class = Zend_Db_Profiler_Firebug Autoloadernamespaces[] = "Zend_" Autoloadernamespaces[] = "SF_" phpsettings.display_errors = 0 phpsettings.error_reporting = 8191 phpSettings.date.timezone = "Europe/Amsterdam" bootstrap.path = APPLICATION_PATH"/bootstrap/Bootstrap.php" pluginPaths.resource_ = APPLICATION_PATH"/resources" resources.frontcontroller.moduledirectory = APPLICATION_PATH"/modules" resources.frontcontroller.defaultmodule = "eventManager" resources.frontcontroller.params.prefixDefaultModule = true resources.frontcontroller.exceptions = false resources.view[] = "" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.view.encoding = "UTF-8" resources.view.title = Rode kruis Vrijwilligers applicatie ;resources.view.helperPath.Default_View_Helper = APPLICATION_PATH "/modules/eventManager/views/helpers" resources.layout.layout = "main" [production:bootstrap] [development:bootstrap] ;resources.frontController.throwExceptions = 1 ;phpSettings.display_startup_errors=1 ;phpSettings.display_errors = 1 ;resources.frontcontroller.throwerrors = [test:production] btw. I CAN login to my database command line with the given username and password. Update: today i decided to investigate on my http request and i came to an error 500. My apache logs don't give any related information, I think. I posted the logs above. Any idea's?

    Read the article

  • Customer Attribute, not sorting select options

    - by Bosworth99
    Made a module that creates some customer EAV attributes. One of these attributes is a Select, and I'm dropping a bunch of options into their respective tables. Everything lines up and is accessible on both the front end and the back. Last thing before calling this part of things finished is the sort order of the options. They come out all scrambled, instead of the obvious default or alphabetical (seemingly at random... very wierd). I'm on Mage v1.11 (Pro/Enterprise). config.xml <config> <modules> <WACI_CustomerAttr> <version>0.1.0</version> </WACI_CustomerAttr> </modules> <global> <resources> <customerattr_setup> <setup> <module>WACI_CustomerAttr</module> <class>Mage_Customer_Model_Entity_Setup</class> </setup> <connection> <use>core_setup</use> </connection> </customerattr_setup> </resources> <models> <WACI_CustomerAttr> <class>WACI_CustomerAttr_Model</class> </WACI_CustomerAttr> </models> <fieldsets> <customer_account> <agency><create>1</create><update>1</update></agency> <title><create>1</create><update>1</update></title> <phone><create>1</create><update>1</update></phone> <mailing_address><create>1</create><update>1</update></mailing_address> <city><create>1</create><update>1</update></city> <state><create>1</create><update>1</update></state> <zip><create>1</create><update>1</update></zip> <fed_id><create>1</create><update>1</update></fed_id> <ubi><create>1</create><update>1</update></ubi> </customer_account> </fieldsets> </global> </config> mysql4-install-0.1.0.php <?php Mage::log('Installing WACI_CustomerAttr'); echo 'Running Upgrade: '.get_class($this)."\n <br /> \n"; //die ( 'its running' ); $installer = $this; /* @var $installer Mage_Customer_Model_Entity_Setup */ $installer->startSetup(); // bunch of attributes // State $installer->addAttribute('customer','state', array( 'type' => 'varchar', 'group' => 'Default', 'label' => 'State', 'input' => 'select', 'default' => 'Washington', 'source' => 'WACI_CustomerAttr/customer_attribute_data_select', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'required' => true, 'visible' => true, 'user_defined' => 1, 'position' => 67 ) ); $attrS = Mage::getSingleton('eav/config')->getAttribute('customer', 'state'); $attrS->addData(array('sort_order'=>67)); $attrS->setData('used_in_forms', array('adminhtml_customer','customer_account_edit','customer_account_create'))->save(); $state_list = array('Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia', 'Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan', 'Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York', 'North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota', 'Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming'); $aOption = array(); $aOption['attribute_id'] = $installer->getAttributeId('customer', 'state'); for($iCount=0;$iCount<sizeof($state_list);$iCount++){ $aOption['value']['option'.$iCount][0] = $state_list[$iCount]; } $installer->addAttributeOption($aOption); // a few more $installer->endSetup(); app/code/local/WACI/CustomerAttr/Model/Customer/Attribute/Data/Select.php <?php class WACI_CustomerAttr_Model_Customer_Attribute_Data_Select extends Mage_Eav_Model_Entity_Attribute_Source_Abstract{ function getAllOptions(){ if (is_null($this->_options)) { $this->_options = Mage::getResourceModel('eav/entity_attribute_option_collection') ->setAttributeFilter($this->getAttribute()->getId()) ->setStoreFilter($this->getAttribute()->getStoreId()) ->setPositionOrder('asc') ->load() ->toOptionArray(); } $options = $this->_options; return $options; } } theme/variation/template/persistent/customer/form/register.phtml <li> <?php $attribute = Mage::getModel('eav/config')->getAttribute('customer','state'); ?> <label for="state" class="<?php if($attribute->getIsRequired() == true){?>required<?php } ?>"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__('State') ?></label> <div class="input-box"> <select name="state" id="state" class="<?php if($attribute->getIsRequired() == true){?>required-entry<?php } ?>"> <?php $options = $attribute->getSource()->getAllOptions(); foreach($options as $option){ ?> <option value='<?php echo $option['value']?>' <?php if($this->getFormData()->getState() == $option['value']){ echo 'selected="selected"';}?>><?php echo $this->__($option['label'])?></option> <?php } ?> </select> </div> </li> All options are getting loaded into table eav_attribute_option just fine (albeit without a sort_order defined), as well as table eav_attribute_option_value. In the adminhtml / customer-manage customers-account information this select is showing up fine (but its delivered automatically by the system). Seems I should be able to set the sort-order on creation of the attributeOptions, or, certainly, define the sort order in the data/select class. But nothing I've tried works. I'd rather not do a front-end hack either... Oh, and how do I set the default value of this select? (Different question, I know, but related). Setting the attributes 'default' = 'washington' seems to do nothing. There seem to be a lot of ways to set up attribute select options like this. Is there a better way that the one I've outlined here? Perhaps I'm messing something up. Cheers

    Read the article

  • Debugging PHP Mail() and/or PHPMailer

    - by Agos
    Hi, I'm quite stuck with a problem sending mail from a PHP script. Some data: Shared hosting, no SSH access, only hosting provider panel PHP version 5.2.5 Last year I built a site which had no problems sending mail with the same hosting Let's say the domain is “domain.com” and my private address is “[email protected]” for anonimity's sake in the following code. Here's the code: <?php error_reporting(E_ALL); ini_set("display_errors", 1); $to = "[email protected]"; $subject = "Hi"; $body = "Test 1\nTest 2\nTest 3"; $headers = 'From: [email protected]' . "\r\n" . 'errors-to: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $body, $headers)) { echo("Message successfully sent"); } else { echo("Message sending failed"); } require('class.phpmailer.php'); $message = "Hello world"; $mail = new PHPMailer(); $mail->CharSet = "UTF-8"; $mail->AddAddress("[email protected]", "Agos"); $mail->SetFrom("[email protected]","My Site"); $mail->Subject = "Test Message"; $mail->Body = $message; $mail->Send(); ?> And here is what I get: Message sending failed 'ai' = 'application/postscript', 'eps' = 'application/postscript', 'ps' = 'application/postscript', 'smi' = 'application/smil', 'smil' = 'application/smil', 'mif' = 'application/vnd.mif', 'xls' = 'application/vnd.ms-excel', 'ppt' = 'application/vnd.ms-powerpoint', 'wbxml' = 'application/vnd.wap.wbxml', 'wmlc' = 'application/vnd.wap.wmlc', 'dcr' = 'application/x-director', 'dir' = 'application/x-director', 'dxr' = 'application/x-director', 'dvi' = 'application/x-dvi', 'gtar' = 'application/x-gtar', 'php' = 'application/x-httpd-php', 'php4' = 'application/x-httpd-php', 'php3' = 'application/x-httpd-php', 'phtml' = 'application/x-httpd-php', 'phps' = 'application/x-httpd-php-source', 'js' = 'application/x-javascript', 'swf' = 'application/x-shockwave-flash', 'sit' = 'application/x-stuffit', 'tar' = 'application/x-tar', 'tgz' = 'application/x-tar', 'xhtml' = 'application/xhtml+xml', 'xht' = 'application/xhtml+xml', 'zip' = 'application/zip', 'mid' = 'audio/midi', 'midi' = 'audio/midi', 'mpga' = 'audio/mpeg', 'mp2' = 'audio/mpeg', 'mp3' = 'audio/mpeg', 'aif' = 'audio/x-aiff', 'aiff' = 'audio/x-aiff', 'aifc' = 'audio/x-aiff', 'ram' = 'audio/x-pn-realaudio', 'rm' = 'audio/x-pn-realaudio', 'rpm' = 'audio/x-pn-realaudio-plugin', 'ra' = 'audio/x-realaudio', 'rv' = 'video/vnd.rn-realvideo', 'wav' = 'audio/x-wav', 'bmp' = 'image/bmp', 'gif' = 'image/gif', 'jpeg' = 'image/jpeg', 'jpg' = 'image/jpeg', 'jpe' = 'image/jpeg', 'png' = 'image/png', 'tiff' = 'image/tiff', 'tif' = 'image/tiff', 'css' = 'text/css', 'html' = 'text/html', 'htm' = 'text/html', 'shtml' = 'text/html', 'txt' = 'text/plain', 'text' = 'text/plain', 'log' = 'text/plain', 'rtx' = 'text/richtext', 'rtf' = 'text/rtf', 'xml' = 'text/xml', 'xsl' = 'text/xml', 'mpeg' = 'video/mpeg', 'mpg' = 'video/mpeg', 'mpe' = 'video/mpeg', 'qt' = 'video/quicktime', 'mov' = 'video/quicktime', 'avi' = 'video/x-msvideo', 'movie' = 'video/x-sgi-movie', 'doc' = 'application/msword', 'word' = 'application/msword', 'xl' = 'application/excel', 'eml' = 'message/rfc822' ); return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; } /** * Set (or reset) Class Objects (variables) * * Usage Example: * $page-set('X-Priority', '3'); * * @access public * @param string $name Parameter Name * @param mixed $value Parameter Value * NOTE: will not work with arrays, there are no arrays to set/reset * @todo Should this not be using __set() magic function? */ public function set($name, $value = '') { try { if (isset($this-$name) ) { $this-$name = $value; } else { throw new phpmailerException($this-Lang('variable_set') . $name, self::STOP_CRITICAL); } } catch (Exception $e) { $this-SetError($e-getMessage()); if ($e-getCode() == self::STOP_CRITICAL) { return false; } } return true; } /** * Strips newlines to prevent header injection. * @access public * @param string $str String * @return string */ public function SecureHeader($str) { $str = str_replace("\r", '', $str); $str = str_replace("\n", '', $str); return trim($str); } /** * Set the private key file and password to sign the message. * * @access public * @param string $key_filename Parameter File Name * @param string $key_pass Password for private key */ public function Sign($cert_filename, $key_filename, $key_pass) { $this-sign_cert_file = $cert_filename; $this-sign_key_file = $key_filename; $this-sign_key_pass = $key_pass; } /** * Set the private key file and password to sign the message. * * @access public * @param string $key_filename Parameter File Name * @param string $key_pass Password for private key */ public function DKIM_QP($txt) { $tmp=""; $line=""; for ($i=0;$i<= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) { $line.=$txt[$i]; } else { $line.="=".sprintf("%02X",$ord); } } return $line; } /** * Generate DKIM signature * * @access public * @param string $s Header */ public function DKIM_Sign($s) { $privKeyStr = file_get_contents($this-DKIM_private); if ($this-DKIM_passphrase!='') { $privKey = openssl_pkey_get_private($privKeyStr,$this-DKIM_passphrase); } else { $privKey = $privKeyStr; } if (openssl_sign($s, $signature, $privKey)) { return base64_encode($signature); } } /** * Generate DKIM Canonicalization Header * * @access public * @param string $s Header */ public function DKIM_HeaderC($s) { $s=preg_replace("/\r\n\s+/"," ",$s); $lines=explode("\r\n",$s); foreach ($lines as $key=$line) { list($heading,$value)=explode(":",$line,2); $heading=strtolower($heading); $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value } $s=implode("\r\n",$lines); return $s; } /** * Generate DKIM Canonicalization Body * * @access public * @param string $body Message Body */ public function DKIM_BodyC($body) { if ($body == '') return "\r\n"; // stabilize line endings $body=str_replace("\r\n","\n",$body); $body=str_replace("\n","\r\n",$body); // END stabilize line endings while (substr($body,strlen($body)-4,4) == "\r\n\r\n") { $body=substr($body,0,strlen($body)-2); } return $body; } /** * Create the DKIM header, body, as new header * * @access public * @param string $headers_line Header lines * @param string $subject Subject * @param string $body Body */ public function DKIM_Add($headers_line,$subject,$body) { $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body $DKIMquery = 'dns/txt'; // Query method $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) $subject_header = "Subject: $subject"; $headers = explode("\r\n",$headers_line); foreach($headers as $header) { if (strpos($header,'From:') === 0) { $from_header=$header; } elseif (strpos($header,'To:') === 0) { $to_header=$header; } } $from = str_replace('|','=7C',$this-DKIM_QP($from_header)); $to = str_replace('|','=7C',$this-DKIM_QP($to_header)); $subject = str_replace('|','=7C',$this-DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable $body = $this-DKIM_BodyC($body); $DKIMlen = strlen($body) ; // Length of body $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body $ident = ($this-DKIM_identity == '')? '' : " i=" . $this-DKIM_identity . ";"; $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this-DKIM_selector . ";\r\n". "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n". "\th=From:To:Subject;\r\n". "\td=" . $this-DKIM_domain . ";" . $ident . "\r\n". "\tz=$from\r\n". "\t|$to\r\n". "\t|$subject;\r\n". "\tbh=" . $DKIMb64 . ";\r\n". "\tb="; $toSign = $this-DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs); $signed = $this-DKIM_Sign($toSign); return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n"; } protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) { if (!empty($this-action_function) && function_exists($this-action_function)) { $params = array($isSent,$to,$cc,$bcc,$subject,$body); call_user_func_array($this-action_function,$params); } } } class phpmailerException extends Exception { public function errorMessage() { $errorMsg = '' . $this-getMessage() . " \n"; return $errorMsg; } } ? Fatal error: Class 'PHPMailer' not found in /mailtest.php on line 20 Which is baffling to say the least. Is there anything I can do to get at least some more meaningful errors? Why is code from the class showing up in my file?

    Read the article

  • Turning PHP page calling Zend functions procedurally into Zend Framework MVC-help!

    - by Joel
    Hi guys, I posted much of this question, but if didn't include all the Zend stuff because I thought it'd be overkill, but now I'm thinking it's not easy to figure out an OO way of doing this without that code... So with that said, please forgive the verbose code. I'm learning how to use MVC and OO in general, and I have a website that is all in PHP but most of the pages are basic static pages. I have already converted them all to views in Zend Framework, and have the Controller and layout set. All is good there. The one remaining page I have is the main reason I did this...it in fact uses Zend library (for gData connection and pulling info from a Google Calendar and displaying it on the page. I don't know enough about this to know where to begin to refactor the code to fit in the Zend Framework MVC model. Any help would be greatly appreciated!! .phtml view page: <div id="dhtmltooltip" align="left"></div> <script src="../js/tooltip.js" type="text/javascript"> </script> <div id="container"> <div id="conten"> <a name="C4"></a> <?php function get_desc_second_part(&$value) { list(,$val_b) = explode('==',$value); $value = trim($val_b); } function filterEventDetails($contentText) { $data = array(); foreach($contentText as $row) { if(strstr($row, 'When: ')) { ##cleaning "when" string to get date in the format "May 28, 2009"## $data['duration'] = str_replace('When: ','',$row); list($when, ) = explode(' to ',$data['duration']); $data['when'] = substr($when,4); if(strlen($data['when'])>13) $data['when'] = trim(str_replace(strrchr($data['when'], ' '),'',$data['when'])); $data['duration'] = substr($data['duration'], 0, strlen($data['duration'])-4); //trimming time zone identifier (UTC etc.) } if(strstr($row, 'Where: ')) { $data['where'] = str_replace('Where: ','',$row); //pr($row); //$where = strstr($row, 'Where: '); //pr($where); } if(strstr($row, 'Event Description: ')) { $event_desc = str_replace('Event Description: ','',$row); //$event_desc = strstr($row, 'Event Description: '); ## Filtering event description and extracting venue, ticket urls etc from it. //$event_desc = str_replace('Event Description: ','',$contentText[3]); $event_desc_array = explode('|',$event_desc); array_walk($event_desc_array,'get_desc_second_part'); //pr($event_desc_array); $data['venue_url'] = $event_desc_array[0]; $data['details'] = $event_desc_array[1]; $data['tickets_url'] = $event_desc_array[2]; $data['tickets_button'] = $event_desc_array[3]; $data['facebook_url'] = $event_desc_array[4]; $data['facebook_icon'] = $event_desc_array[5]; } } return $data; } // load library require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Calendar'); Zend_Loader::loadClass('Zend_Http_Client'); // create authenticated HTTP client for Calendar service $gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $user = "[email protected]"; $pass = "xxxxxxxx"; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal); $gcal = new Zend_Gdata_Calendar($client); $query = $gcal->newEventQuery(); $query->setUser('[email protected]'); $secondary=true; $query->setVisibility('private'); $query->setProjection('basic'); $query->setOrderby('starttime'); $query->setSortOrder('ascending'); //$query->setFutureevents('true'); $startDate=date('Y-m-d h:i:s'); $endDate="2015-12-31"; $query->setStartMin($startDate); $query->setStartMax($endDate); $query->setMaxResults(30); try { $feed = $gcal->getCalendarEventFeed($query); } catch (Zend_Gdata_App_Exception $e) { echo "Error: " . $e->getResponse(); } ?> <h1><?php echo $feed->title; ?></h1> <?php echo $feed->totalResults; ?> event(s) found. <table width="90%" border="3" align="center"> <tr> <td width="20%" align="center" valign="middle"><b>;DATE</b></td> <td width="25%" align="center" valign="middle"><b>VENUE</b></td> <td width="20%" align="center" valign="middle"><b>CITY</b></td> <td width="20%" align="center" valign="middle"><b>DETAILS</b></td> <td width="15%" align="center" valign="middle"><b>LINKS</b></td> </tr> <?php if((int)$feed->totalResults>0) { //checking if at least one event is there in this date range foreach ($feed as $event) { //iterating through all events //pr($event);die; $contentText = stripslashes($event->content->text); //striping any escape character $contentText = preg_replace('/\<br \/\>[\n\t\s]{1,}\<br \/\>/','<br />',stripslashes($event->content->text)); //replacing multiple breaks with a single break //die(); $contentText = explode('<br />',$contentText); //splitting data by break tag $eventData = filterEventDetails($contentText); $when = $eventData['when']; $where = $eventData['where']; $duration = $eventData['duration']; $venue_url = $eventData['venue_url']; $details = $eventData['details']; $tickets_url = $eventData['tickets_url']; $tickets_button = $eventData['tickets_button']; $facebook_url = $eventData['facebook_url']; $facebook_icon = $eventData['facebook_icon']; $title = stripslashes($event->title); echo '<tr>'; echo '<td width="20%" align="center" valign="middle" nowrap="nowrap">'; echo $when; echo '</td>'; echo '<td width="20%" align="center" valign="middle">'; if($venue_url!='') { echo '<a href="'.$venue_url.'" target="_blank">'.$title.'</a>'; } else { echo $title; } echo '</td>'; echo '<td width="20%" align="center" valign="middle">'; echo $where; echo '</td>'; echo '<td width="20%" align="center" valign="middle">'; $details = str_replace("\n","<br>",htmlentities($details)); $duration = str_replace("\n","<br>",$duration); $detailed_description = "<b>When</b>: <br>".$duration."<br><br>"; $detailed_description .= "<b>Description</b>: <br>".$details; echo '<a href="javascript:void(0);" onmouseover="ddrivetip(\''.$detailed_description.'\')" onmouseout="hideddrivetip()" onclick="return false">View Details</a>'; echo '</td>'; echo '<td width="20%" valign="middle">'; if(trim($tickets_url) !='' && trim($tickets_button)!='') { echo '<a href="'.$tickets_url.'" target="_blank"><img src="'.$tickets_button.'" border="0" ></a>'; } if(trim($facebook_url) !='' && trim($facebook_icon)!='') { echo '<a href="'.$facebook_url.'" target="_blank"><img src="'.$facebook_icon.'" border="0" ></a>'; } else { echo '......'; } echo '</td>'; echo '</tr>'; } } else { //else show 'no event found' message echo '<tr>'; echo '<td width="100%" align="center" valign="middle" colspan="5">'; echo "No event found"; echo '</td>'; } ?> </table> <h3><a href="#pastevents">Scroll down for a list of past shows.</a></h3> <br /> <a name="pastevents"></a> <ul class="pastShows"> <?php $startDate='2005-01-01'; $endDate=date('Y-m-d'); /*$gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $user = "[email protected]"; $pass = "silverroof10"; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal); $gcal = new Zend_Gdata_Calendar($client); $query = $gcal->newEventQuery(); $query->setUser('[email protected]'); $query->setVisibility('private'); $query->setProjection('basic');*/ $query->setOrderby('starttime'); $query->setSortOrder('descending'); $query->setFutureevents('false'); $query->setStartMin($startDate); $query->setStartMax($endDate); $query->setMaxResults(1000); try { $feed = $gcal->getCalendarEventFeed($query); } catch (Zend_Gdata_App_Exception $e) { echo "Error: " . $e->getResponse(); } if((int)$feed->totalResults>0) { //checking if at least one event is there in this date range foreach ($feed as $event) { //iterating through all events $contentText = stripslashes($event->content->text); //striping any escape character $contentText = preg_replace('/\<br \/\>[\n\t\s]{1,}\<br \/\>/','<br />',stripslashes($event->content->text)); //replacing multiple breaks with a single break $contentText = explode('<br />',$contentText); //splitting data by break tag $eventData = filterEventDetails($contentText); $when = $eventData['when']; $where = $eventData['where']; $duration = $eventData['duration']; $title = stripslashes($event->title); echo '<li class="pastShows">' . $when . " - " . $title . ", " . $where . '</li>'; } } ?> </div> </div>

    Read the article

  • Disable .htaccess from apache allowoverride none, still reads .htaccess files

    - by John Magnolia
    I have moved all of our .htaccess config into <Directory> blocks and set AllowOverride None in the default and default-ssl. Although after restarting apache it is still reading the .htaccess files. How can I completely turn off reading these files? Update of all files with "AllowOverride" /etc/apache2/mods-available/userdir.conf <IfModule mod_userdir.c> UserDir public_html UserDir disabled root <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> </IfModule> /etc/apache2/mods-available/alias.conf <IfModule alias_module> # # Aliases: Add here as many aliases as you need (with no limit). The format is # Alias fakename realname # # Note that if you include a trailing / on fakename then the server will # require it to be present in the URL. So "/icons" isn't aliased in this # example, only "/icons/". If the fakename is slash-terminated, then the # realname must also be slash terminated, and if the fakename omits the # trailing slash, the realname must also omit it. # # We include the /icons/ alias for FancyIndexed directory listings. If # you do not use FancyIndexing, you may comment this out. # Alias /icons/ "/usr/share/apache2/icons/" <Directory "/usr/share/apache2/icons"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> </IfModule> /etc/apache2/httpd.conf # # Directives to allow use of AWStats as a CGI # Alias /awstatsclasses "/usr/share/doc/awstats/examples/wwwroot/classes/" Alias /awstatscss "/usr/share/doc/awstats/examples/wwwroot/css/" Alias /awstatsicons "/usr/share/doc/awstats/examples/wwwroot/icon/" ScriptAlias /awstats/ "/usr/share/doc/awstats/examples/wwwroot/cgi-bin/" # # This is to permit URL access to scripts/files in AWStats directory. # <Directory "/usr/share/doc/awstats/examples/wwwroot"> Options None AllowOverride None Order allow,deny Allow from all </Directory> Alias /awstats-icon/ /usr/share/awstats/icon/ <Directory /usr/share/awstats/icon> Options None AllowOverride None Order allow,deny Allow from all </Directory> /etc/apache2/sites-available/default-ssl <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2.2-common/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # Access Control: # With SSLRequire you can do per-directory access control based # on arbitrary complex boolean expressions containing server # variable checks and other lookup directives. The syntax is a # mixture between C and Perl. See the mod_ssl documentation # for more details. #<Location /> #SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \ # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \ # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ #</Location> # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o StrictRequire: # This denies access when "SSLRequireSSL" or "SSLRequire" applied even # under a "Satisfy any" situation, i.e. when it applies access is denied # and no other module can change it. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost> </IfModule> /etc/apache2/sites-available/default <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options -Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> Alias /delboy /usr/share/phpmyadmin <Directory /usr/share/phpmyadmin> # Restrict phpmyadmin access Order Deny,Allow Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> /etc/apache2/conf.d/security # # Disable access to the entire file system except for the directories that # are explicitly allowed later. # # This currently breaks the configurations that come with some web application # Debian packages. # #<Directory /> # AllowOverride None # Order Deny,Allow # Deny from all #</Directory> # Changing the following options will not really affect the security of the # server, but might make attacks slightly more difficult in some cases. # # ServerTokens # This directive configures what you return as the Server HTTP response # Header. The default is 'Full' which sends information about the OS-Type # and compiled in modules. # Set to one of: Full | OS | Minimal | Minor | Major | Prod # where Full conveys the most information, and Prod the least. # #ServerTokens Minimal ServerTokens OS #ServerTokens Full # # Optionally add a line containing the server version and virtual host # name to server-generated pages (internal error documents, FTP directory # listings, mod_status and mod_info output etc., but not CGI generated # documents or custom error documents). # Set to "EMail" to also include a mailto: link to the ServerAdmin. # Set to one of: On | Off | EMail # #ServerSignature Off ServerSignature On # # Allow TRACE method # # Set to "extended" to also reflect the request body (only for testing and # diagnostic purposes). # # Set to one of: On | Off | extended # TraceEnable Off #TraceEnable On /etc/apache2/apache2.conf # # Based upon the NCSA server configuration files originally by Rob McCool. # # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See http://httpd.apache.org/docs/2.2/ for detailed information about # the directives. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # The configuration directives are grouped into three basic sections: # 1. Directives that control the operation of the Apache server process as a # whole (the 'global environment'). # 2. Directives that define the parameters of the 'main' or 'default' server, # which responds to requests that aren't handled by a virtual host. # These directives also provide default values for the settings # of all virtual hosts. # 3. Settings for virtual hosts, which allow Web requests to be sent to # different IP addresses or hostnames and have them handled by the # same Apache server process. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path. If the filenames do *not* begin # with "/", the value of ServerRoot is prepended -- so "foo.log" # with ServerRoot set to "/etc/apache2" will be interpreted by the # server as "/etc/apache2/foo.log". # ### Section 1: Global Environment # # The directives in this section affect the overall operation of Apache, # such as the number of concurrent requests it can handle or where it # can find its configuration files. # # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # NOTE! If you intend to place this on an NFS (or otherwise network) # mounted filesystem then please read the LockFile documentation (available # at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>); # you will save yourself a lot of trouble. # # Do NOT add a slash at the end of the directory path. # #ServerRoot "/etc/apache2" # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # LockFile ${APACHE_LOCK_DIR}/accept.lock # # PidFile: The file in which the server should record its process # identification number when it starts. # This needs to be set in /etc/apache2/envvars # PidFile ${APACHE_PID_FILE} # # Timeout: The number of seconds before receives and sends time out. # Timeout 300 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive On # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 4 ## ## Server-Pool Size Regulation (MPM specific) ## # prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 500 </IfModule> # worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a # graceful restart. ThreadLimit can only be changed by stopping # and starting Apache. # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule mpm_worker_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 150 MaxRequestsPerChild 0 </IfModule> # event MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule mpm_event_module> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule> # These need to be set in /etc/apache2/envvars User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} # # AccessFileName: The name of the file to look for in each directory # for additional configuration directives. See also the AllowOverride # directive. # AccessFileName .htaccess # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ~ "^\.ht"> Order allow,deny Deny from all Satisfy all </Files> # # DefaultType is the default MIME type the server will use for a document # if it cannot otherwise determine one, such as from filename extensions. # If your server contains mostly text or HTML documents, "text/plain" is # a good value. If most of your content is binary, such as applications # or images, you may want to use "application/octet-stream" instead to # keep browsers from trying to display binary files as though they are # text. # DefaultType text/plain # # HostnameLookups: Log the names of clients or just their IP addresses # e.g., www.apache.org (on) or 204.62.129.132 (off). # The default is off because it'd be overall better for the net if people # had to knowingly turn this feature on, since enabling it means that # each client request will result in AT LEAST one lookup request to the # nameserver. # HostnameLookups Off # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here. If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here. # ErrorLog ${APACHE_LOG_DIR}/error.log # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn # Include module configuration: Include mods-enabled/*.load Include mods-enabled/*.conf # Include all the user configurations: Include httpd.conf # Include ports listing Include ports.conf # # The following directives define some format nicknames for use with # a CustomLog directive (see below). # If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i # LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent # Include of directories ignores editors' and dpkg's backup files, # see README.Debian for details. # Include generic snippets of statements Include conf.d/ # Include the virtual host configurations: Include sites-enabled/

    Read the article

< Previous Page | 3 4 5 6 7