1 / 49

Bad Drupal, Bad!

Bad Drupal, Bad!. Presented by Sarah Snow sarah.snow@austin.utexas.edu. Basic Troubleshooting, General Safeguards and Tips Including: Installation Server Permissions PHP Caching Community. Safety First (a leash and a good solid fence). BACK UP! BACK UP! BACK UP!.

Download Presentation

Bad Drupal, Bad!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Bad Drupal, Bad! Presented by Sarah Snow sarah.snow@austin.utexas.edu

  2. Basic Troubleshooting, General Safeguards and Tips Including: • Installation • Server • Permissions • PHP • Caching • Community

  3. Safety First(a leash and a good solid fence)

  4. BACK UP! BACK UP! BACK UP!

  5. Local, Test and Production • Multiple copies of your site. • Break your local site and fix it. • Try it again on test to make sure you have it right and then • Do it right on the production site

  6. Version Control • Make sure the problem isn’t a file conflict in your version control or some other external issue.

  7. Installation(bringing Drupal home to meet the cat)

  8. Read the INSTALL.txt file CONTENTS --------------------- * Requirements * Optional requirements * Installation * Drupal administration * Customizing your theme(s) * Multisite Configuration

  9. Other Important Things to Read • Read the README.txt file • The module help pages • admin/help/module_name • When upgrading read the Release Notes. • Installation or upgrade instructions • Whether it’s necessary to run update.php • Lists dependencies and required libraries

  10. Did you forget to runupdate.php?Just make sure that you have made a back up of your database first

  11. drupal.org • http://drupal.org/handbook • Understanding, Installation, Administration, Structure, Site Building, Multilingual, and Themeing, Developer info, an API reference, examples, Git documentation, a glossary, code snippets, tutorials, recipes and an FAQ. • This is not a session on security but… http://drupal.org/security • Or accessibility, but…http://drupal.org/about/accessibility

  12. http://drupal.org/documentation/install/troubleshoot • Fatal error: Allowed memory size of n bytes exhausted • Failed to connect to your MySQL database server • Cannot create directories 'files' or 'private’ • Cannot write to configuration files settings.php • Blank page (White Screen of Death) • "Your PHP configuration only supports the SQLite database type" on the database configuration page during install • Host-specific error messages • What permissions does Drupal need? • Why is this uploading stuff so difficult • Got a packet bigger than 'max-allowed-packet’ • Translation issues • Clean URLs how-to

  13. Indicators(learning what Drupal’s trying to say)

  14. Status Report

  15. Error Logs

  16. Error Reporting Settings • The default setting is that error logs are written to the log and to the screen. • On a production site you will need to change the setting to only write to the log so your visitors never see the ugly red messages on the screen.

  17. The error log won’t load • In your database browse the “watchdog” table. • Drush commands: • drush status • drush watchdog-show

  18. Seriously, Drupal is Being Really Bad! • Temporarily add this php snippet to the index.php file in the Drupal root directly under the opening php tag: error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); • Remember when you’re done to remove this code

  19. White Screen of DeathWSOD http://drupal.org/node/158043 Did you try clearing the cache?drush cc You can try this module: (test or local only) http://drupal.org/project/dtools

  20. Server Issues(learning to like the kennel)

  21. .htaccess • Protect files and directories from prying eyes • 404 error handling • favicon.ico • Override PHP settings • PHP Caching • Rewrite rules • If your site can be accessed both with and without the 'www.' prefix, you can redirect users to your preferred URL. • Modify the RewriteBase if you are using Drupal in a subdirectory or in a VirtualDocumentRoot and the rewrite rules are not working properly.

  22. .htaccess • On Web Central and some other hosts it’s necessary to comment out this setting: # Options +FollowSymLinks In your site’s root and in the “files” directory

  23. Fatal error: Allowed memory size of X bytes exhausted • Add to your .htaccess file PHP Override settings which are inside the <IfModule> tags for whichever version of PHP you’re using. Web Central is 5 php_value memory_limit 64M # PHP 5, Apache 1 and 2. <IfModule mod_php5.c> php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 php_value mbstring.http_input pass php_value mbstring.http_output pass php_value mbstring.encoding_translation 0 php_value memory_limit 64M </IfModule> Please, don’t be a piggie

  24. Other PHP Overrides http://www.php.net/manual/en/ini.core.php#ini.sect.file-uploads if php_value upload_max_filesize 10M The sum of the sizes of all the files that you are uploading then php_value post_max_size 20M The post_max_size sets the upper limit on the amount of data that can be accepted and includes the upload_max_filesize plus other data. This value should be larger than the value that you set for upload_max_filesize. php_value max_execution_time 120 The maximum life time of the script in seconds and the time that the script should spend in accepting input.

  25. Autocomplete and SSL • Autocomplete doesn’t work with pages under SSL, like content creation forms. - You must write a RewriteRule to turn https off for these pages. # SSL Certificates RewriteCond %{HTTPS} !=on RewriteRule (user|admin) https://%{SERVER_NAME}%{REQUEST_URI} [L,R] RewriteCond %{HTTPS} !=off RewriteRule ^(node/.*/edit|node/add/.*) http://%{SERVER_NAME}%{REQUEST_...

  26. The .htaccess files is overridden each time you update core!

  27. Read about Webhosting issues: http://drupal.org/server-permissions • If you’re on Web Central you can contact: webcentral-maint@utlists.utexas.edu • On your local version you should be able to review your php_error.log, mysql_error_log

  28. settings.php(chmod 440) • Your site specific configuration file contains: • Database settings • Base URL • PHP settings • Including to solve the issue of Drupal’s output filter not having sufficient memory. • Variable overrides • String Overrides • allows you to change some of your site's default interface strings

  29. Permissions(leave it)

  30. Why does it work when I’m logged in with my #1 user account but my client can’t do it? • White list access to everything • Nodes • All CCK fields • All imagecache presets (Cascade your user roles permissions & don’t over due the permissions and roles)

  31. Other Modules & Input Filters • Add complexity to who sees what, when. • Taxonomy Access, Workflow, Revisioning, etc. • Example: WYSIWYG Filter

  32. Server File Permissions • Web Central runs in Safe Mode. • Directories created by Drupal from actions of the databasewill not be writeable. • Examples: • Aggregated CSS & Javascriptdirectories created when you optimize the Performance page settings. • Boost needs to create & write to directories on the server. • Adding an imagecachepreset

  33. Initial directory ownership and permissions: drwxrwxr-x 2 www www 4096 May 7 16:41 test_preset To change ownership: rmdir test_preset mkdir test_preset drwxr-xr-x 2 fa www 4096 May 7 16:52 test_preset To fix permissions: Add write for the group. Remove execute and read from other.chmod 770 test_presetdrwxrwx--- 2 fa www 4096 May 7 16:52 test_preset http://drupal.org/security/secure-configuration Warning: do not flush or edit the preset.

  34. Code(mixed signals)

  35. Code Overrides • Code in your templates and functions can also make things appear differently depending on who is logged in. if ((($user->uid) == 138) || (in_array(”Press", $user->roles))): • PHP filters in a template can override your Drupal settings in the browser. <?php print check_plain($node->field_related_header[0][‘view’]); ?>

  36. Drupal Coding Standards http://drupal.org/node/318 • Ensure you have proper PHP Configuration and no PHP syntax errors. Example • Errors occur when there is additional whitespace at the end of a PHP file. To avoid this issue, it is a Drupal coding standard to not include the closing ?> on a PHP file. • When you start developing modules you will want to check out SimpleTest • It runs, functional, unit and upgrade tests on your code. http://drupal.org/simpletest

  37. Cache(stay, Drupal, stay)

  38. Drupal Cache • To speed up your production site you will • Enable caching of your site and • Aggregation of your CSS and Javascript. • Your Theme Registry will also be cached • You may choose to install other caching modules like Boost • Views, Blocks, and other modules are also cached.

  39. To Clear the Cache • On your local or test version disable all of the cachingand aggregation and enable rebuild of the theme registry for every page. • Cache Clearing made easy with • Devel Module • Administration Menu • drush cc

  40. Create a File in Your Local and Test Root Called clear.php <?php include_once './includes/bootstrap.inc'; drupal_bootstrap (DRUPAL_BOOTSTRAP_FULL); drupal_flush_all_caches(); drupal_rebuild_theme_registry(); ?>

  41. Browser Cache • All browsers have an easy way to clear the cache. Do it often. • Firefox Web Developer Add-on you can disable caching for all your browsing.

  42. Community(play at the park)

  43. http://drupal.org/community • http://drupal.org/user/register • Following issues • Security Advisories http://drupal.org/security • Creating issues • Add to documentation and forums • Contribute modules or themes • Provide translations • Mentoring

  44. Bad Documentation

  45. UT Drupal Community • Wikihttps://wikis.utexas.edu/display/drupal/ • Mailing list https://utlists.utexas.edu/sympa/info/drupal • Users group that meets monthly https://wikis.utexas.edu/display/drupal/UT+Drupal+Users+Group

  46. Drupal Troubleshooting Check List • Have a back up, repository & multiple working copies of your site • Read the .txt files & release notes • Check the Status page and Error Logs • When things get really bad (WSOD) – • Add to the index.php file in the Drupal root directly under the opening php tag:error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); • http://drupal.org/project/dtools • Clear all Drupal cache - aggregated files, theme registry, etc. • Clear your browser cache • Check the site Permissions, and other modules that require you to whitelist access • Check the directory Permissions on the server • rmdir – mkdir – chmod 770 • Run update.php • Check the templates for code overrides, like check_plain PHP filters • Fix server issues (memory, RewriteRules, etc. in .htaccess file) • Check for module dependencies, like other modules and libraries

  47. (don’t forget the treats) Thank you! Sarah Snow sarah.snow@austin.utexas.edu

More Related