2

I tried to work on my security parameters on drupal... I went into the security page on drupal and chmod 664 the following folders: themes, modules, cache, site, profiles and include. Simultaneously, i also turned off messages display. And i configured my site address in the settings file.

When i tried to update everything to check out the settings, a fatal error prevented me to access my website. User_class was not accessible. So i went into my MYSQL database and turned to 1 the user module. Now, the message is:

Fatal error: Class 'PHPMailer' not found in /home/mysite/www/sites/all/modules/phpmailer/includes/phpmailer.class.inc on line 12

I updated my website, but doesn't work.

Here is what i get:

Call Stack

1   0.0005  236608  {main}( )   ../index.php:0
2   0.0186  654760  drupal_bootstrap( ) ../index.php:20
3   0.2480  6656728 _drupal_bootstrap_full( )   ../bootstrap.inc:2278
4   0.9109  25055992    module_invoke_all( )    ../common.inc:5193
5   0.9650  26510896    call_user_func_array ( )    ../module.inc:895
6   0.9651  26511064    mailsystem_init( )  ../module.inc:895
7   0.9651  26511104    mailsystem_get_classes( )   ../mailsystem.module:17
8   0.9854  26938376    class_exists ( )    ../mailsystem.module:306
9   0.9854  26938672    drupal_autoload_class( )    ../mailsystem.module:0
10  0.9854  26938720    _registry_check_code( ) ../bootstrap.inc:3103
11  0.9883  27012760    require_once( '/home/mysite/www/sites/all/modules/phpmailer/includes/phpmailer.class.inc' ) ../bootstrap.inc:3179

i explored the web, no real answer... I did a chmod - r 777 to all the files i chmod. Of course, phpmailer is well set up...

Update: i tried drush en -y menu and here is the answer:

root@ns333613:/home/mysite/www# drush en -y menu
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
array_keys() expects parameter 1 to be array, null given common.inc:7102                        [warning]
array_keys() expects parameter 1 to be array, null given common.inc:7102                        [warning]
PHP Fatal error:  Call to undefined function menu_get_menus() in /home/mysite/www/sites/all/modules/xmlsitemap/xmlsitemap_menu/xmlsitemap_menu.module on line 37
PHP Stack trace:
PHP   1. {main}() /usr/share/php/drush/drush.php:0
PHP   2. drush_main() /usr/share/php/drush/drush.php:16
PHP   3. _drush_bootstrap_and_dispatch() /usr/share/php/drush/drush.php:61
PHP   4. drush_bootstrap_to_phase() /usr/share/php/drush/drush.php:81
PHP   5. drush_bootstrap() /usr/share/php/drush/includes/bootstrap.inc:308
PHP   6. _drush_bootstrap_drupal_login() /usr/share/php/drush/includes/bootstrap.inc:185
PHP   7. drush_drupal_login() /usr/share/php/drush/includes/bootstrap.inc:979
PHP   8. user_load() /usr/share/php/drush/includes/drupal.inc:138
PHP   9. user_load_multiple() /home/mysite/www/modules/user/user.module:366
PHP  10. entity_load() /home/mysite/www/modules/user/user.module:291
PHP  11. entity_get_controller() /home/mysite/www/includes/common.inc:7849
PHP  12. entity_get_info() /home/mysite/www/includes/common.inc:7883
PHP  13. drupal_alter() /home/mysite/www/includes/common.inc:7719
PHP  14. xmlsitemap_menu_entity_info_alter() /home/mysite/www/includes/module.inc:1101

Fatal error: Call to undefined function menu_get_menus() in /home/mysite/www/sites/all/modules/xmlsitemap/xmlsitemap_menu/xmlsitemap_menu.module on line 37

Call Stack:
    0.0013     254960   1. {main}() /usr/share/php/drush/drush.php:0
    0.0767    2486840   2. drush_main() /usr/share/php/drush/drush.php:16
    0.6131    6590152   3. _drush_bootstrap_and_dispatch() /usr/share/php/drush/drush.php:61
    0.9727    6595496   4. drush_bootstrap_to_phase() /usr/share/php/drush/drush.php:81
    2.1957   37568016   5. drush_bootstrap() /usr/share/php/drush/includes/bootstrap.inc:308
    2.1991   37569712   6. _drush_bootstrap_drupal_login() /usr/share/php/drush/includes/bootstrap.inc:185
    2.1996   37569944   7. drush_drupal_login() /usr/share/php/drush/includes/bootstrap.inc:979
    2.1996   37570128   8. user_load() /usr/share/php/drush/includes/drupal.inc:138
    2.1996   37570648   9. user_load_multiple() /home/mysite/www/modules/user/user.module:366
    2.1996   37570728  10. entity_load() /home/mysite/www/modules/user/user.module:291
    2.1996   37570792  11. entity_get_controller() /home/mysite/www/includes/common.inc:7849
    2.1997   37571320  12. entity_get_info() /home/mysite/www/includes/common.inc:7883
    2.2434   37671552  13. drupal_alter() /home/mysite/www/includes/common.inc:7719
    2.2652   37680800  14. xmlsitemap_menu_entity_info_alter() /home/mysite/www/includes/module.inc:1101

Drush command terminated abnormally due to an unrecoverable error.                              [error]
Error: Call to undefined function menu_get_menus() in
/home/mysite/www/sites/all/modules/xmlsitemap/xmlsitemap_menu/xmlsitemap_menu.module, line 37
                                                                                                [error]
Drush was not able to start (bootstrap) Drupal.
Hint: This error can only occur once the database connection has already been successfully
initiated, therefore this error generally points to a site configuration issue, and not a
problem connecting to the database.

Drush was attempting to connect to: 
 Drupal version                  :  7.34                  
 Site URI                        :  http://default        
 Database driver                 :  mysql                 
 Database username               :  phpmyadmin            
 Database name                   :  mysite               
 Database                        :  Connected             
 Default theme                   :  open_framework        
 Administration theme            :  bartik                
 PHP executable                  :  /usr/bin/php          
 PHP configuration               :  /etc/php5/cli/php.ini 
 PHP OS                          :  Linux                 
 Drush version                   :  6.2.0                 
 Drush configuration             :                        
 Drush alias files               :                        
 Drupal root                     :  /home/mysite/www     
 Site path                       :  sites/default         
 File directory path             :  sites/default/files   
 Temporary file directory path   :  /tmp 

After lots of search, and no more clues, i decided to creat a new folder on my server and start again from zero. I re installed drupal, with a new database, like usual...Fine ! i changed my settings to connect my new site to my old database...And the same issue is back ! So i guess this might come from something wrong in my database. I turned to 0, the phpmailer in the system table: both bootstrap and module status...But still nothing works

closed as unclear what you're asking by kiamlaluno Apr 29 '17 at 16:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Could you check if the file phpmailer.class.inc exist on your filesystem? – Jaap Jansma Mar 10 '15 at 21:14
  • Hi, thanks for your answer. Yes, it exists in the appropriate path (the same as mentioned actually...that's why i'm a little bit confused...!) – Ryan Mar 10 '15 at 21:16
  • Do you have shell access? And are you familiar with Drush? If so you could try to clear caches with drush – Jaap Jansma Mar 10 '15 at 21:19
  • Hi, not really familiar with drush, but i found some posts about it. I did a "drush -y cc all". but doesn't work...it says : Drush command terminated abnormally due to an unrecoverable error. [error] Error: Class 'PHPMailer' not found in /home/mysite/www/sites/all/modules/phpmailer/includes/phpmailer.class.inc, line 12 – Ryan Mar 10 '15 at 21:26
  • And is the file phpmailer.class.inc readable by the webserver user? – Jaap Jansma Mar 10 '15 at 21:34
1

This might be an issue with a cached phpmailer path that will error out before you can run a drush cc all, so give this a go:

Open your includes/bootstrap.inc file.

Add these two lines at the top, replacing "path-to-your-site" with your site's path:

set_include_path(get_include_path() . PATH_SEPARATOR . '/path-to-your-site/sites/all/libraries/phpmailer');
require_once('class.phpmailer.php');`

Run drush cc all - it should work without errors now.

Finally, remove those lines from includes/bootstrap.inc - and your site should load.

  • seems that i did something really bad...with the lines added here is the message i get after i {drush cc all} {array_keys() expects parameter 1 to be array, null given common.inc:7102 } – Ryan Mar 10 '15 at 22:19
  • {Drush command terminated abnormally due to an unrecoverable error. Error: Call to undefined function menu_get_menus() in /home/mysite/www/sites/all/modules/xmlsitemap/xmlsitemap_menu/xmlsitemap_menu.module, line 37 Drush was not able to start (bootstrap) Drupal. Hint: This error can only occur once the database connection has already been successfully initiated, therefore this error generally points to a site configuration issue, and not a problem connecting to the database } – Ryan Mar 10 '15 at 22:19
  • Hm - can you try running drush en -y menu to make sure Drupal's core menu module is enabled? (And don't worry - those two lines won't do any permanent damage - just make sure to delete them when you're done with them.) – AHeath Mar 10 '15 at 22:27
  • thanks a lot for your help. I updated the first question with all the answer i get after runnning {drush en -y menu} – Ryan Mar 10 '15 at 22:31
  • 1
    @Ryan you're starting at the wrong end of this problem - all these undefined function errors are due to incorrect permissions on your folders. It's a lost cause chasing down these individual undefined function errors - it will be endless. Start by ensuring ALL your folders are 755 ie.. from your top drupal folder run find . -type d -exec chmod 755 {} + – Patrick Ryan Mar 10 '15 at 23:17
0

By setting all those folders to 664, you've removed the ability for the server to use the files.

The folders you listed should be 755.

  • Hi, thanks for your help. I just chmod 755 all the files i previously chmod 664, but still the same error...:( – Ryan Mar 10 '15 at 21:47
  • In your post, you mentioned chmodding the folders, did you mean that you chmodded all the files inside those folders? The folder should be 755, not the files. – Patrick Ryan Mar 10 '15 at 21:49
  • I'm not very familiar yet with chmod. i chmod -R 755 and chmod 755 all the files i mentioned...Not very selective nor elegant... – Ryan Mar 10 '15 at 21:53
  • 2
    Reading your other comments, it sounds like you've made a lot of changes in a lot of places - it's hard to give specific details without knowing the current status of all your permissions, but generally the folders should be 755 and the files inside the folders should be 644 with the exception of settings.php which should be 444. I'd suggest getting all your permissions straightened out before debugging the missing class stuff - lots of info regarding permissions here – Patrick Ryan Mar 10 '15 at 22:02
0

I, too, ran into the "PHPMailer Class not found" issue. The immediate symptom was a WSOD, and when I tried to run "drush cc all" I got the "PHPMailer class not found error" described by Ryan. AHeath's suggestion above [to modify my bootstrap.inc file to force inclusion of 'class.phpmailer.php'] allowed me to run drush cc all, and then leaving in the additional bootstrap statements to bring my site up. Subsequently, I took out the two additional php statements and everything seems normal now.

My contribution to this discussion is that just before I got the WSOD I had disabled the PHPMailer and smtp authentication modules. The sequence was (1) disable the two modules, and then, (2) get a WSOD and the inability to run drush.

It is not strictly germane to the issue here, but the reason I had disabled the modules was that I wanted to see if the new virtual server I am using would be able to send drupal e-mail without those two modules.

I still have no idea why disabling those 2 modules would give me all the trouble that it did, but I did do a little extra investigating and found that the PHPMailer class is defined in at least two places: in the smtp.phpmailer.inc file in the smtp module, and in the class.phpmailer.php file in the phpmailer library. I also noticed that the class.phpmailer.php file is commented out in the PHPMailer module's .info file. I wonder if when I disabled the smtp module, I also removed the only place that the PHPMailer class was defined, and that that caused all of my subsequent difficulties.

0

It seems your problem is because of file permission, The Drupal files folder should be writable by the web server. The safest way to do that is to change the group and make it group writable, like this:

chgrp www-data sites/default/files
chmod g+w sites/default/files

The file upload folder aside, the safest is chmod 644 for all files, 755 for directories.

This could be accomplished like this (when run in the Drupal-site folder, the . is for current path):

find . -type f | xargs chmod 644
find . -type d | xargs chmod 755

Remember that you will need to set chmod g+w again after running the above command, since those will reset the chmod on all files and folders.

Not the answer you're looking for? Browse other questions tagged or ask your own question.