Title: PHP Fatal error: Cannot redeclare class
Last modified: January 27, 2017

---

# PHP Fatal error: Cannot redeclare class

 *  [JP3](https://wordpress.org/support/users/jp3/)
 * (@jp3)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/php-fatal-error-cannot-redeclare-class/)
 * Just wanted to give a heads up about some errors that cripple a site immediately
   upon plugin activation.
 * I was able to resolve it by wrapping every class in every file with a check wrapper
   like this:
 *     ```
       if (!class_exists('CLASSNAME')) {
            // original class code for CLASSNAME
       }
       ```
   
 * I eventually just put each class in that check wrapper because when I fixed the
   first redeclare error, another popped up, fixed that one, another popped up, 
   and then I just wrapped them all. Problem solved.
 * **PLUGIN USERS:**
    You will have to edit the path in rename_me_to_.htaccess file
   to suit your ABSPATH to the .htpassword_geneated file.
 * **[@andreacomo](https://wordpress.org/support/users/andreacomo/) (PLUGIN AUTHOR):**
   
   I have a modified util.php file that generates the .htacess file with the proper
   ABSPATH instead of using the seeder file. I can send it your way if you want 
   to release it with a future update.
    -  This topic was modified 9 years, 4 months ago by [JP3](https://wordpress.org/support/users/jp3/).

The topic ‘PHP Fatal error: Cannot redeclare class’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-htpasswd-generator.svg)
 * [WordPress .htpasswd Generator](https://wordpress.org/plugins/wp-htpasswd-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-htpasswd-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-htpasswd-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-htpasswd-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-htpasswd-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-htpasswd-generator/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [JP3](https://wordpress.org/support/users/jp3/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/php-fatal-error-cannot-redeclare-class/)
 * Status: not resolved