Magento: Fatal error: Class? - php

I install this module to magento:
http://www.magentocommerce.com/magento-connect/addshoppers-viral-product-sharing-2577.html
and have problem with my website now:
Fatal error: Class 'Clearcode_Addshoppers_Model_Mysql4_Setup' not found in /data/web/virtuals/49508/virtual/www/includes/src/Mage_Core_Model_Resource_Setup.php on line 234
could you please help me?
Very Very thank you!

Does app/code/<local or community>/Clearcode/Addshoppers/Model/Mysql4/Setup.php exist at all? if it doesn't, you're missing that file. If it does not then try taking a look inside that file and see if the class name is Clearcode_Addshoppers_Model_Mysql4_Setup and not something else.

Path
includes/src
indicated that magento is looking for class in compiled files directory.
Try to run
php shell/compiler.php compile
and try again.

It seems like you have the compiler enabled but it cannot find the (flattened) file.
So either disable the compiler:
php shell/compiler.php disable
Or run a compilation so that it will generate the file for you:
php shell/compiler.php compile

Related

Magento error when running Cron.php

I am getting this error when I run the cron.php for Magento.
[24-Jan-2015 02:40:03 UTC] PHP Fatal error: Class 'Mage__Helper_Data' not found in /home/nli/catalog/app/Mage.php on line 516
I found a few other pages where someone else had this problem but I am unable to fix this. The two underscores must be the issue but I cannot find anywhere in my Magento directories with grep where there is any mention of Mage__Helper_Data or anything calling that class.
Please let me know if you have any ideas on what I could check. This has been happening for at least a couple months so I have no idea what happened or which plugins were installed at the exact time.
Thank you!
-Justin
This should be in one of the config.xml files in your system; it seems like one word is missing between Mage_ and _Helper; btw what is the grep command you are using? try with: grep "Mage__Helper" . -rin , from the top folder. I'm sure you'll find something.
A magento developer was able to take a look at our system and found the issue was within a 3rd party magento plugin that had a corrupt row in the database table that was causing the Mage__Helper_Data error.

Codeigniter Command line error - PHP Fatal error: Class 'CI_Controller' not found

After following the user guide instructions found here: http://ellislab.com/codeigniter/user-guide/general/cli.html I'm unable to run the test script via command line.
My controller located at /var/www/mysite/application/controllers/
class Tools extends CI_Controller {
public function message($to = 'World')
{
echo "Hello {$to}!".PHP_EOL;
}
}
In my browser I can access
http://mysite/tools/message/ben
And the function correctly outputs "Hello ben"
From terminal I should be able to run:
$ php index.php tools message "Ben"
My terminal should print: "Hello Ben"
However I get the following error:
PHP Fatal error: Class 'CI_Controller' not found in /var/www/mysite/system/core/CodeIgniter.php on line 233
My server is pretty standard; ubuntu LAMP. Codeigniter is pretty standard too and I have no problem running non CI scripts via command line
My PHP binary is only located in /usr/bin/php <-- This post suggests an issue running CI directly from usr/bin/php, however I'm not operating a shared PHP service, and I don't see why this would make a difference to how PHP executes a CI script.
Any help or just an indication on how to debug this would be greatly appreciated.
Thanks in advance.
Solved! (partly) the issue was CodeIgniters error logging.
In application/config/config.php, I modified the following config property:
$config['log_threshold'] = 0;
This disables logging, and allows $ php index.php to execute.
If anyone can explain why CI only shows this error on CLI PHP - might help anyone else who has this issue and needs it resolved with error logging on.
To solve error "Class 'CI_Controller' not found" try going to Application -> Config -> database.php then check the database details like hostname, username, password and database.
To Mijahn:
I had this same problem, and after about two hours of tracing through code to figure out the problem, it seems that there is some sort of conflict with loading the CI_Controller when utilizing the native PHP load_class function.
I worked around this issue by making the following changes to the Common.php file (hack, I know).
//$_log =& load_class('Log');
require_once('system/libraries/Log.php');
$_log = new CI_Log();
My logs then where created exactly like I wanted. Hope this hack helps.
This site says to run codeigniter from the command line, one must set the $_SERVER['PATH_INFO'] variable.
$_SERVER['PATH_INFO'] is usually supplied by php when a web request is made. However, since we are calling this script from the command line, we need to emulate this small part of the environment as a web request.
The answer provided in this Stack Overflow post worked for me.
Within system/core/CodeIgniter.php, on around line 75, change:
set_error_handler('_exception_handler');
to...
set_exception_handler('_exception_handler');
Other users have reported that this gave them a better backtrace with which to debug the underlying issue, but for me, this actually removed the problem altogether.

XMLdiff for php installation

I am trying to install xml diff ; https://github.com/mmacia/XMLdiff and i have not managed yet to make it work.Whenever i run any test example,i get
Fatal error: Interface 'PHPUnit_Framework_Test' not found in
C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php on line 85
Has anyone managed to install and use the library.I am using xampp on windows.
I believe your problem has to do with PHPUnit's Autoloader.php not being included. This file sets the php spl_autoloadspl_register function which is responsible for loading in interfaces and classes like PHPUnit_Framework_Test.
According to this SO question, you have to include the autoloader file manually. Without knowing more about your set-up and how that particular library works, I would say do something like this in the appropriate file(s):
// define phpunit path
if ( ! defined('PHPUNIT_PATH')) {
// define an absolute path to your PHPUnit dir
// CHECK THIS, i'm not good with php on windows:
define('PHPUNIT_PATH','C:\xampp\php\PEAR\PHPUnit');
}
// Then include the autoloader like this:
include PHPUNIT_PATH.'Autoloader.php';
I hope this helps you or anyone else out.
Check execution flags for C:\xampp\php\PEAR\PHPUnit\Framework\Framework\Test.php
The file needs to be executable by the user who is launching tests (probably you).

Can't require mage.php from an interactive shell

I would like to try some code snippets (about to make a script) which uses Magento's models and classes.
The problem is that I get the following error:
fdr#fderose-gtrade:/var/www/globaltrade$
fdr#fderose-gtrade:/var/www/globaltrade$ php -a
Interactive shell
php > require './app/Mage.php';
Fatal error: Class 'Mage' not found in /var/www/globaltrade/app/Mage.php on line 31
Line 31 of Mage.php is the following:
Mage::register('original_include_path', get_include_path());
Does anybody have an idea about what could be the cause? Thank you!
According to php.net
Autoloading is not available if using
PHP in CLI interactive mode.
see http://php.net/manual/en/features.commandline.interactive.php for more info (its a note towards the bottom of the description)
At first glance it seems that your issue stems from autoload. When you include your Mage.php file it appears that it then tries to run a php autoload and use the Mage class, but is failing in doing so. It's possible that the way that their autoload is functioning, the paths may not be correct when run from an interactive shell.

IMagic object creation shows error?

I just try to integrate ImageMagick into my PHP project. I installed and just execute the sample files that they provided with the imagick-3.0.0RC1 zip file. But it shows
Fatal error: Class 'Imagick' not found in C:\wamp\www\imagick-3.0.0RC1\imagick-3.0.0RC1\examples\watermark.php on line 9
this kind of an error how can I avoid that. I cant see any class including section on that page. How to include the class files.
You need to install the ImageMagick PHP extension. According to the manual there is no prebuilt extension for Windows so you'll probably have to configure and compile it yourself.

Categories