fatal Error when using pear pager ! - php

i used PEAR Pager in my Projects . it's works fine in my local server but when i upload it to hosing server it's gaves me fatal error :
Fatal error: Cannot redeclare class PEAR_Common in /usr/lib/php/PEAR/Common.php on line 1123
i don't know what's the problem , how can i solve that ?!

The error message says it all. It seems like the class PEAR_Common is loaded twice. Check your code for includes/requires of this class.
If you are using other pear packages that might load (include) this class before you include your Pear_Pager class then this might be the problem.
Regards,

Related

PHP Fatal error: Class 'WP_UnitTestCase' not found - phpunit

I know that it already has answer in PHP Fatal error: Class 'WP_UnitTestCase' not found when trying to run test-sample But it doesn't fixed my issue. I am trying to initialize php unit testing with my wordpress plugin using phpunit. I found this tutorial and it was easy to follow. Here's the link
https://www.smashingmagazine.com/2017/12/automated-testing-wordpress-plugins-phpunit/
Everything was working great until the below step.
When I came to this Step in tutorial where the command I tried to run
phpunit tests/test-sample.php
and I get:
PHP Fatal error: Class 'WP_UnitTestCase' not found in PHP Fatal error: Class 'WP_UnitTestCase' not found in /var/www/html/testwordpress/wp-content/plugins/wp-ultimate-csv-importer/tests/test-sample.php on line 11
I don't Know how to solve this issue. I found the same question in Stackoverflow. Here's the Link:
PHP Fatal error: Class 'WP_UnitTestCase' not found when trying to run test-sample
But it was in windows. Somehow he managed to fix it. I checked his solution and it says that issue in MySQL.
But in my case, MySQL works fine and I am in linux with the flavor of Ubuntu. Help me with some solutions to fix this problem in Linux

PHP Fatal error: Class 'Sightengine\\SightengineClient' not found in

after trying different ways of using the API from sightengine I can' get it to work, I followed the instructions on their site , installing via composer, but when I try to use it, I get the Class not found error in apache:
PHP Fatal error: Uncaught Error: Class 'Sightengine\\SightengineClient' not found in /var/www/html/photobooth/app.php
PHP file:
<?php
use Sightengine\SightengineClient;
$client = new SightengineClient('xxxxxxx', 'xxxxxxxxx');
Missed to include the file.
When installing using composer, we have to include the file in our code
require_once 'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
This will help you to include the file in code, so you can start using the class/objects

PHP Fatal error: Class 'Swift_Validate' not found

I am trying to use Swift_Validate::email($email) and I get a php error: PHP Fatal error: Class 'Swift_Validate' not found.
I have the latest version of swiftmailer. Is there some preference settings I need to do?
I have tried including the Validate.php file, but then I get the error: PHP Fatal error: Class 'Swift_DependencyContainer' not found.
I include DependencyContainer.php and I get the error PHP Fatal error: Class 'Swift_DependencyException' not found.
I include DependencyException.php and I get the error: Class 'Swift_SwiftException' not found.
I include SwiftException.php and I still get the same error.
I think I must not have the preferences set up correctly. I am calling:
"require_once($dir.'/swift/swift_required.php');"
The code I am using for the validation is:
if (!Swift_Validate::email($email))
{ $error = true; }
Any help would be greatly appreciated. Using latest Apache and PHP.
Try require_once dirname( __FILE__) . '/lib/swift_required.php'; to use the built-in autoloader, where lib is subfolder of folder where is the current file ( for default directory structure of the library )

I get a fatal error after attempting to install wp-ecommerce plugin, can not find any other support with same error

I attempted to install a wp-ecommerce plugin, it gave me this fatal error and now it only shows the fatal error message when I try to access my wp-admin.
Fatal error: Cannot redeclare class wpsc_gateways in /home4/stickdog/public_html/wp-content/plugins/wp-e-commerce/wpsc-components/merchant-core-v2/classes/wpsc-gateways.php on line 6
If I can access my file manager and I just delete the plugin will it solve my problem? I would rather use the plugin but if it won't work its ok. Thanks for your help.
From a programming perspective it seems like the PHP class wpsc_gateways is being redeclared in the coding. But since this is a pre-packaged plug-in that seems odd. Perhaps sloppy coding on the part of the original author. If you delete the plugin the problem will be solved. But maybe the plug-in was installed twice by accident? Look at the contents if your /home4/stickdog/public_html/wp-content/plugins/ to see if that might have happened.

Fatal error: class not found using pear in xampp

I'm trying to send an email using form data. I'm adapting the method described at http://www.html-form-guide.com/email-form/php-email-form-attachment.html which uses the PEAR library. I'm testing my site locally via XAMPP.
Here's the code from the top of my page:
<?php
// Pear library includes
include_once('Mail/mail.php');
include_once('Mail/mime.php');
Testing the page produces the following:
Fatal error: Class 'Mail' not found in C:\xampp\php\PEAR\Mail\mail.php on line 51
Here's line 51 from mail.php (I haven't altered the file from the default XAMPP installation):
class Mail_mail extends Mail {
Any help would be much appreciated.
try changing
include_once('Mail/mail.php');
to
include_once('Mail.php');

Categories