Magento var directory - php

Hi i am facing this error on my magento
Unable to find writable var_dir
#0 /home/glasses/html/includes/src/Mage_Core_Model_Config_Options.php(66): Mage_Core_Model_Config_Options->getVarDir()
#1 /home/glasses/html/includes/src/Varien_Object.php(112): Mage_Core_Model_Config_Options->_construct()
#2 /home/glasses/html/includes/src/Mage_Core_Model_Config.php(200): Varien_Object->__construct(Array)
#3 /home/glasses/html/app/Mage.php(739): Mage_Core_Model_Config->__construct(Array)
#4 /home/glasses/html/app/Mage.php(678): Mage::_setConfigModel(Array)
#5 /home/glasses/html/index.php(71): Mage::run('', 'store')
#6 {main}
currently i have httpd web server, and also i issue chmod -R 777 var/ directory but the problems is still there. Other pages can be access except the front page.Thanks

Currently on you site I can see the error - cache_dir must be a directory
To fix this issue - make a tmp dir in the root of the magento installation hope this will solve your problem.

Magento checks tmp dir next way:
$dir = $this->getSysTmpDir().DS.'magento'.DS.'var';
if (!$this->createDirIfNotExists($dir)) {
throw new Mage_Core_Exception('Unable to find writable var_dir');
}
As you can see, the piece of code is trying to create temporary directory in the system tmp directory. And if the creation process is failed - it throws an error. So, first of all, you should check the "tmp" dir exists in the system's root directory (/tmp) and php has enough rights to create/write into magento tmp dir there.

Related

php fopen() permissions issue

I looked everywhere on the web and just couldn't find a solution.
I am getting this error:
Warning: fopen(/var/www/html/includes/../log/404/log_2018-04-07.txt): failed to open stream: Permission denied in /var/www/html/vendor/katzgrau/klogger/src/Logger.php on line 167
Fatal error: Uncaught exception 'RuntimeException' with message 'The file could not be opened. Check permissions.' in /var/www/html/vendor/katzgrau/klogger/src/Logger.php:134 Stack trace:
#0 /var/www/html/includes/db_class.php(7204): Katzgrau\KLogger\Logger->__construct('/var/www/html/i...')
#1 /var/www/html/includes/db_class.php(7217): db_class->getLogger('404')
#2 /var/www/html/includes/furl_router.php(55): db_class->logger('404')
#3 /var/www/html/includes/furl_router.php(229): goTo404('no page-data / ...')
#4 /var/www/html/index.php(17): require_once('/var/www/html/i...')
#5 {main} thrown in /var/www/html/vendor/katzgrau/klogger/src/Logger.php on line 134
From what I read here it's a permission issue but I can't figure it out. I granted all permissions from root folder, I have no idea what am I doing wrong.
Check folder write permissions. Maybe the user trying to write the log has no permissions. sudo chmod -R 666 logs gives read and write permissions to all users.
For anyone using Katzgrau\KLogger\Logger and using relative paths to locate the log file, use an absolute path, e.g.:
$logger = new Logger(__DIR__ . '/../../logs');
After reading a bit about another issue I had but with a MySQL function, after exploring, I figured out I should use MySQL version 5.6 while I used version 5.7.
I uninstalled MySQL 5.7 and install 5.6 instead. It solved both the MySQL issue and the issue mentioned above.

Fail to restore magento on a new domain

I used Ubuntu Desktop to be my server hosting Magento. I have restored the Magento in following way:
Import Magento database to MySQL server
Copy and paste all the files to /var/www/html
Remarks:
Permission: 755
Magento Version: 1.9.2
PHP version: 7.0
Unfortunately, I have got an error related to the code generated by Magento.
Fatal error:
Uncaught Error: Call to a member function extend() on boolean in /var/www/html/lib/Varien/Simplexml/Config.php:600
Stack trace:
#0 /var/www/html/app/code/core/Mage/Core/Model/Config.php(278): Varien_Simplexml_Config->extend(Object(Mage_Core_Model_Config_Base))
#1 /var/www/html/app/code/core/Mage/Core/Model/App.php(391): Mage_Core_Model_Config->loadBase()
#2 /var/www/html/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Model_App->_initBaseConfig()
#3 /var/www/html/app/code/core/Mage/Core/Model/App.php(348): Mage_Core_Model_App->baseInit(Array)
#4 /var/www/html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#5 /var/www/html/index.php(83): Mage::run('', 'store')
#6 {main} thrown in /var/www/html/lib/Varien/Simplexml/Config.php on line 600
How can I solve this error in order to restore Magento on a new domain?
I have tried to lower the permission to 644 but it failed. Moreover, I have tested that PHP7.0 can also open the installation page of a new Magento.
Although you have tried to set permissions of folders and files but still it seems to be a problem with folder and file permission.
Please try resetting permission using magento-cleanup.php
file.
Please put this file in document root of your magento and run this file from browser.
Please let me know whether it solves your problem or not.
This will help:
Try clearing cache, and check file permissions are correctly set,
Directories : 755
Files : 644
If this still doesn't work then may be your files are corrupt.

CakePhp with xampp

I am trying to execute my first application in cakephp, but it's giving an error
Fatal error: Uncaught exception 'CacheException' with message 'Cache
engine _cake_core_ is not properly configured.' in
/opt/lampp/htdocs/CakeTooDoo/lib/Cake/Cache/Cache.php:166 Stack trace:
#0 /opt/lampp/htdocs/CakeTooDoo/lib/Cake/Cache/Cache.php(136): Cache::_buildEngine('_cake_core_') #1
/opt/lampp/htdocs/CakeTooDoo/app/Config/core.php(336):
Cache::config('_cake_core_', Array) #2
/opt/lampp/htdocs/CakeTooDoo/lib/Cake/Core/Configure.php(78):
include('/opt/lampp/htdo...') #3
/opt/lampp/htdocs/CakeTooDoo/lib/Cake/bootstrap.php(171):
Configure::bootstrap(true) #4
/opt/lampp/htdocs/CakeTooDoo/app/webroot/index.php(92):
include('/opt/lampp/htdo...') #5 {main} thrown in
/opt/lampp/htdocs/CakeTooDoo/lib/Cake/Cache/Cache.php on line 166
and two warnings
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to
File cache in /opt/lampp/htdocs/CakeTooDoo/lib/Cake/Cache/Cache.php on
line 310
Warning: /opt/lampp/htdocs/CakeTooDoo/app/tmp/cache/persistent/ is not
writable in
/opt/lampp/htdocs/CakeTooDoo/lib/Cake/Cache/Engine/FileEngine.php on
line 337
Pleas give me any solution to do my first application with cakephp.
you can use a permissive ownership:
chmod -R 777 app/tmp
A better method is to change group ownership of tmp and everthing below it to www-data ( or whatever group your apache server runs in ) with 'chgrp -R www-data tmp' followed by 'chmod -R 774 tmp' This makes tmp read/write for you and the www-data group but readonly for everyone else
let me know if i can help you more.
The cache folder is not writable according to warning.
open terminal, run sudo chmod 777 /opt/lampp/htdocs/CakeTooDoo -R
Plus, you should reconfigure file permissions, like 775, in real productions.

CakePHP: Could not load configuration file

I'm trying to get a cakephp project up and running from a svn checkout on my mountain lion computer.
I changed all the cache write permissions find but now I have one last fatal error that's not letting the app run.
Fatal error: Uncaught exception 'ConfigureException' with message 'Could not load configuration file: /Users/mike/cake2cribs/cake2cribs/app/Config/core-production.php' in /Users/mike/cake2cribs/cake2cribs/lib/Cake/Configure/PhpReader.php:77
Stack trace: #0
/Users/mike/cake2cribs/cake2cribs/lib/Cake/Core/Configure.php(267):
PhpReader->read('core-production') #1
/Users/mike/cake2cribs/cake2cribs/app/Config/core.php(287):
Configure::load('core-production') #2
/Users/mike/cake2cribs/cake2cribs/lib/Cake/Core/Configure.php(76):
include('/Users/mike/cak...') #3
/Users/mike/cake2cribs/cake2cribs/lib/Cake/bootstrap.php(146):
Configure::bootstrap(true) #4
/Users/mike/cake2cribs/cake2cribs/app/webroot/index.php(81):
include('/Users/mike/cak...') #5 {main} thrown in
/Users/mike/cake2cribs/cake2cribs/lib/Cake/Configure/PhpReader.php on
line 77
it fails on this line inside index.php inside webroot
if (!include ('Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
Any ideas as to what could be the cause?
I've never done an Ubuntu install, I've always just downloaded the source and put it in my webroot. Anyway, cake always expects to have a file called core.php which holds all the config info. Maybe the Ubuntu install just expects core-production.php, so you might just need to copy the core.php file in app/Config and rename it to core-production.php.

Zend_Session / Zend_Auth randomly throws Error Message ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13)

I'm currently working on a new Application using (among other things) Zend_Auth but, for whatever reason, this Error Message is showing up at any location totally randomly (or so it seams)
Zend_Session::start() - /home/hannes/workspace/develop/library/Zend/Session.php(Line:480): Error #8 session_start() [function.session-start]: ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) Array
#0 /home/hannes/workspace/develop/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#1 /home/hannes/workspace/develop/library/Zend/Auth/Storage/Session.php(87): Zend_Session_Namespace->__construct('Zend_Auth')
#2 /home/hannes/workspace/develop/library/Zend/Auth.php(91): Zend_Auth_Storage_Session->__construct()
#3 /home/hannes/workspace/develop/library/Zend/Auth.php(141): Zend_Auth->getStorage()
#4 /home/hannes/workspace/develop/xxxxxxx/application/controllers/AdminController.php(10): Zend_Auth->hasIdentity()
#5 /home/hannes/workspace/develop/library/Zend/Controller/Action.php(133): AdminController->init()
#6 /home/hannes/workspace/develop/library/Zend/Controller/Dispatcher/Standard.php(262): Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http), Array)
#7 /home/hannes/workspace/develop/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#8 /home/hannes/workspace/develop/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#9 /home/hannes/workspace/develop/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#10 /home/hannes/workspace/develop/xxxxxxx/public/index.php(26): Zend_Application->run()
#11 {main}
Apparently this issue is affecting mostly (only?) debian/ubuntu based systems and has to do with automatic session garbage collection.
The variable session.gc_probability was set to 1 in the php.ini which means there is a 1% probability for the garbage collector to run and clean up the directory /var/lib/php5 where the php sessions are stored.
Apparently this folder is not writable by www-data resulting in the mentioned error and throwing the Zend exception. Setting session.gc_probability to 0 solved the problem. The session folder is cleaned up by a cron job anyway, so no need for the php garbage collector to even run.
From http://somethingemporium.com/2007/06/obscure-error-with-php5-on-debian-ubuntu-session-phpini-garbage
A solution is to set the session.save_path in the php.ini file to a writable directory.
for example: session.save_path = "/tmp".
Switching the session garbage collection off in the first example is not a good idea. The second example does not work on Ubuntu 10.04
Actually changing the directory of the session.save_path turns garbage collection off. That is why it now works for you. If you want garbage collection you can change the original directory owner to the php user "www-data"
chown www-data /var/lib/php5
In the alternative you can write a garbage collection script for the new directory.
I had this problem with the Symfony framework also, the problem is php does not have permission to the session storage directory. Just change the session save directory to somewhere writable. In Zend Framework Bootstrap config ini:
resources.session.save_path = APPLICATION_PATH "/../data/session"
If you are using PHP 7 on Ubuntu, ensure the PHP sessions directory is owned by the web server:
sudo chown www-data:www-data /var/lib/php/sessions
I've had this issue on OS X 10.8.4 with MAMP, using the first Zend Framework. The directory set for session.save_path in php.ini by default is /Applications/MAMP/tmp/php. I was able to solve it only by deleting everything in that directory.

Categories