Laravel encrypt error - laravel

I'm moving a Laravel App to another server, and did this:
Copied everything to the new server.
Updated the database.php file.
Changed all occurrences of yield to _yield.
But now I'm stuck with a "Server Error: 500 (Internal Server Error)".
After a long weekend fighting with Laravel, I found where to turn on the logs and display errors. And this is what it shows:
Unhandled Exception
Message:
mcrypt_encrypt(): Key of size 22 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported Location:
/home3/l7o1c5g8/public_html/laravel/crypter.php on line 40 Stack Trace:
#0 /home3/l7o1c5g8/public_html/laravel/laravel.php(40): Laravel\Error::native(2, 'mcrypt_encrypt(...', '/home3/l7o1c5g8...', 40)
#1 [internal function]: Laravel{closure}(2, 'mcrypt_encrypt(...', '/home3/l7o1c5g8...', 40, Array)
#2 /home3/l7o1c5g8/public_html/laravel/crypter.php(40): mcrypt_encrypt('rijndael-256', 'YourSecretKeyGo...', 'a:3:{s:2:"id";s...', 'cbc', '5E\x9B ]\xBE\x97Yb\x98J\xD7|\xCA\x90...')
#3 /home3/l7o1c5g8/public_html/laravel/session/drivers/cookie.php(40): Laravel\Crypter::encrypt('a:3:{s:2:"id";s...')
#4 /home3/l7o1c5g8/public_html/laravel/session/payload.php(293): Laravel\Session\Drivers\Cookie->save(Array, Array, false)
#5 [internal function]: Laravel\Session\Payload->save()
#6 /home3/l7o1c5g8/public_html/laravel/session.php(150): call_user_func_array(Array, Array)
#7 /home3/l7o1c5g8/public_html/laravel/laravel.php(193): Laravel\Session::__callStatic('save', Array)
#8 /home3/l7o1c5g8/public_html/laravel/laravel.php(193): Laravel\Session::save()
#9 /home3/l7o1c5g8/public_html/public/index.php(34): require('/home3/l7o1c5g8...')
#10 {main}
Any clue? Should I need to regenerate an encryption code? How?
No idea what to do now.
Using Laravel 3 in a shared hosting.

SOLVED: I changed the default key on /public_html/application/config/application.php
from: 'key' => 'YourSecretKeyGoesHere!',
to: 'key' => '32 characters!',
you must replace the default key with a 16,24 or 32 characters word.
Thank you for your help.

Related

laravel local.ERROR: Undefined index: HTTP_HOST in AppServiceProvider.php

i use laravel and have multiple domain like example.com , example.co , example.org
also i use api and laravel task scaduleing to update post view in day , week , month
using below code to make dl sever domain according user domain entered
AppServiceProvider.php
public function boot()
{
Schema::defaultStringLength(191);
$dl_server = 'http://dl.' . str_replace('www.', '',$_SERVER['HTTP_HOST']) . '/';
View::share('dl_server' , $dl_server);
}
but in laravel log file i got many error
[2020-10-12 00:00:01] local.ERROR: Undefined index: HTTP_HOST {"exception":"[object] (ErrorException(code: 0): Undefined index: HTTP_HOST at /home2/exampleco/domains/example.com/example/app/Providers/AppServiceProvider.php:30)
[stacktrace]
#0 /home2/exampleco/domains/example.com/example/app/Providers/AppServiceProvider.php(30): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Undefined index...', '/home2/exampleco...', 30, Array)
#1 [internal function]: App\\Providers\\AppServiceProvider->boot()
#2 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#3 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Support/helpers.php(522): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#4 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): value(Object(Closure))
#5 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#6 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Container/Container.php(591): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#7 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(828): Illuminate\\Container\\Container->call(Array)
#8 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(811): Illuminate\\Foundation\\Application->bootProvider(Object(App\\Providers\\AppServiceProvider))
#9 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}(Object(App\\Providers\\AppServiceProvider), 23)
#10 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(812): array_walk(Array, Object(Closure))
#11 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#12 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(211): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#13 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(320): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#14 /home2/exampleco/domains/example.com/example/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#15 /home2/exampleco/domains/example.com/example/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#16 {main}
"}
and this error repeat every minute [2020-10-12 00:00:01] , [2020-10-12 00:01:01] , ...
whats the problem ?
$_SERVER['HTTP_HOST'] only available if app called from HTTP Request, the error log say it's called from console (eg: task scheduling) so the variable is not exists.
Simply put variable checking using empty() or isset(), or check if not running in console with this sample code:
if (!\App::runningInConsole()) {
Log::debug("AppServiceProvider::boot ".$_SERVER['HTTP_HOST']);
}

exception 'Mage_Core_Exception' with message 'Message recipients data must be set.' in app/Mage.php:595

Suddenly I receiving this error with my cron which sends all mails from the webshop:
Cron error while executing core_email_queue_send_all:
exception 'Mage_Core_Exception' with message 'Message recipients data must be set.' in /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/Mage.php:595
Stack trace:
#0 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/core/Mage/Core/Model/Email/Queue.php(98): Mage::throwException('Message recipie...')
#1 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/core/Mage/Core/Model/Abstract.php(316): Mage_Core_Model_Email_Queue->_beforeSave()
#2 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/core/Mage/Core/Model/Email/Queue.php(248): Mage_Core_Model_Abstract->save()
#3 [internal function]: Mage_Core_Model_Email_Queue->send(Object(Aoe_Scheduler_Model_Schedule))
#4 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/community/Aoe/Scheduler/Model/Schedule.php(196): call_user_func_array(Array, Array)
#5 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/community/Aoe/Scheduler/Model/Schedule.php(582): Aoe_Scheduler_Model_Schedule->runNow(true)
#6 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/community/Aoe/Scheduler/Model/Observer.php(39): Aoe_Scheduler_Model_Schedule->process()
#7 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/core/Mage/Core/Model/App.php(1339): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#8 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/code/core/Mage/Core/Model/App.php(1318): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#9 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#10 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/shell/scheduler.php(377): Mage::dispatchEvent('default', Array)
#11 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/shell/scheduler.php(37): Aoe_Scheduler_Shell_Scheduler->cronAction()
#12 /srv/www/htdocs/virtual/webs/DOMAIN/srv/www/htdocs/virtual/webs/DOMAIN/htdocs/shell/scheduler.php(403): Aoe_Scheduler_Shell_Scheduler->run()
#13 {main}
Does anybody know something about this issue?
Magento 1.9.1
Somewhere in your website, a transactional email has been allowed to be queued without a recipient specified. I suggest you take a tour in your database and find the core_email_queue_recipients table, and check for a row with an empty recipient_email value. You'll then keep the message_id found on the faulty row, and delete the corresponding entry in the core_email_queue table.

Magento front end only printing "local.xml"

I went to do a test customer registration and right after I submitted form, the page only loads what you see below. I deleted cookies and loaded the main page, and it has what you see below as well. My coworker was messing with permissions as well, but we think we have all the permissions correct now. There are no errors in magento logs. The only error on server that may be applicable "client denied by server configuration: /var/www/Staging/public_html/app/etc/local.xml" but I know this is a common error and it's been there. Any ideas about what the issue is?
Update: We added developer mode and now we get the following stack trace:
Warning: simplexml_load_string(): Entity: line 29: parser error : Premature end of data in tag layout line 29 in /var/www/Staging/public_html/app/code/core/Mage/Core/Model/Layout/Update.php on line 444
#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/var/www/Stagin...', 444, Array)
#1 /var/www/Staging/public_html/app/code/core/Mage/Core/Model/Layout/Update.php(444): simplexml_load_string('getFileLayoutUpdatesXml('frontend', 'default', 'f001', '1')
#3 /var/www/Staging/public_html/app/code/core/Mage/Core/Model/Layout/Update.php(347): Mage_Core_Model_Layout_Update->fetchFileLayoutUpdates()
#4 /var/www/Staging/public_html/app/code/core/Mage/Core/Model/Layout/Update.php(246): Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates('default')
#5 /var/www/Staging/public_html/app/code/core/Mage/Core/Model/Layout/Update.php(224): Mage_Core_Model_Layout_Update->merge('default')
#6 /var/www/Staging/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(306): Mage_Core_Model_Layout_Update->load()
#7 /var/www/Staging/public_html/app/code/core/Mage/Cms/Helper/Page.php(109): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#8 /var/www/Staging/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#9 /var/www/Staging/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#10 /var/www/Staging/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_IndexController->indexAction()
#11 /var/www/Staging/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 /var/www/Staging/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /var/www/Staging/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 /var/www/Staging/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#15 /var/www/Staging/public_html/index.php(87): Mage::run('', 'store')
#16 {main}
1)simplexml_load_string(): Entity is an common error if some xml section is not properly written
2)client denied by server : this error may come because of several reasons
i).htaccess missing
ii)File: /app/code/core/Mage/Adminhtml/Block/Notification/Security.php cooment
private function _isFileAccessible()
//$http->write(Zend_Http_Client::POST, $defaultUnsecureBaseURL . $this->_filePath);
iii)chmod 600 app/etc/local.xml
iv)http://www.yireo.com/tutorials/magento/magento-administration/1322-client-denied-by-server-configuration-appetclocalxml

Everything falls when I try a new magento theme

I bought a magento theme (support 1.6.1 / 1.6.2). I have installed a new fresh magento with sample data and uploaded all theme files. When I create the configuration, everything falls.
Here is the error:
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 105: parser error : Opening and ending tag mismatch: reference line 102 and block in /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 431
#0 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Model/Layout/Update.php(431): mageCoreErrorHandler(2, 'simplexml_load_...', '/home/template/...', 431, Array)
#1 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Model/Layout/Update.php(273): Mage_Core_Model_Layout_Update->getFileLayoutUpdatesXml('fetchFileLayoutUpdates('frontend', 'default', 'e-shopping', '1')
#3 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Model/Layout/Update.php(246): Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates()
#4 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Model/Layout/Update.php(224): Mage_Core_Model_Layout_Update->merge('default')
#5 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(307): Mage_Core_Model_Layout_Update->load('default')
#6 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Cms/Helper/Page.php(109): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#7 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage()
#8 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#9 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Cms_IndexController->indexAction(Object(Mage_Cms_IndexController), 'home')
#10 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch()
#11 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match('index')
#12 /home/template/public_html/dev/gammadesign/magento/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch(Object(Mage_Core_Controller_Request_Http))
#13 /home/template/public_html/dev/gammadesign/magento/app/Mage.php(640): Mage_Core_Model_App->run()
#14 /home/template/public_html/dev/gammadesign/magento/index.php(80): Mage::run(Array)
#15 {main}
And this is the link: http://dev.template-tuners.com/gammadesign/magento/
How can I fix that?
Thanks
One of your new layouts file is invalid.
Check it one by one in your IDE, you should see a invalid tag closing.

Catalog URL Rewrites index stuck

My catalog URL Rewrites in Magento are stuck on processing. When I run the shell/indexer.php script I get the following error
Catalog URL Rewrites index process unknown error: exception
'PDOException' with message 'SQLSTATE[23000]: Integrity constraint
violation: 1062 Duplicate entry 'sugar-tablets.html-1' for key 2' in
/home/healthra/public_html/lib/Zend/Db/Statement/Pdo.php:228 Stack
trace: #0
/home/healthra/public_html/lib/Zend/Db/Statement/Pdo.php(228):
PDOStatement->
execute(Array) #1
/home/healthra/public_html/lib/Zend/Db/Statement.php(300):
Zend_Db_Statement_
Pdo->_execute(Array) #2
/home/healthra/public_html/lib/Zend/Db/Adapter/Abstract.php(479):
Zend_Db_Sta
tement->execute(Array) #3
/home/healthra/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238):
Zend_Db
_Adapter_Abstract->query('UPDATE mg_core...', Array) \#4
/home/healthra/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(337):
Zend_Db_
Adapter_Pdo_Abstract->query('UPDATEmg_core...', Array) #5
/home/healthra/public_html/lib/Zend/Db/Adapter/Abstract.php(632):
Varien_Db_A
dapter_Pdo_Mysql->query('UPDATE `mg_core...', Array) #6
/home/healthra/public_html/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysq
l4/Url.php(257):
Zend_Db_Adapter_Abstract->update('mg_core_url_rew...', Array, '
url_rewrite_id=...') #7
/home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(363):
Mag
e_Catalog_Model_Resource_Eav_Mysql4_Url->saveRewrite(Array,
Object(Varien_Object
)) #8
/home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(559):
Mag
e_Catalog_Model_Url->_refreshProductRewrite(Object(Varien_Object),
Object(Varien
_Object)) #9
/home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(253):
Mag
e_Catalog_Model_Url->refreshProductRewrites('1') #10
/home/healthra/public_html/app/code/core/Mage/Catalog/Model/Url.php(246):
Ma
ge_Catalog_Model_Url->refreshRewrites('1') #11
/home/healthra/public_html/app/code/core/Mage/Catalog/Model/Indexer/Url.php(
249): Mage_Catalog_Model_Url->refreshRewrites() #12
/home/healthra/public_html/app/code/core/Mage/Index/Model/Process.php(139):
Mage_Catalog_Model_Indexer_Url->reindexAll() #13
/home/healthra/public_html/app/code/core/Mage/Index/Model/Process.php(167):
Mage_Index_Model_Process->reindexAll() #14
/home/healthra/public_html/shell/indexer.php(158):
Mage_Index_Model_Process-
reindexEverything()
#15
/home/healthra/public_html/shell/indexer.php(198):
Mage_Shell_Compiler->run(
) #16 {main}
Does anyone have any suggestions on how to debug this problem?
Have a look here: Magento Puts -1 in My URLs Can I Remove Programatically? and also here: http://www.magentocommerce.com/boards/viewthread/9342/.
I found that removing all lock files in /path/to/mage/var/locks/index_process*.lock, truncating core_url_rewrite and then reindexing cleared the issue.

Resources