Drupal DTPDeployment Troubles and Problems6.x	@landike (Andrii Lundiak)
Deployment steps
Steps level
What we have today to discussHosting environment worriesFirst install stepsMagic php.iniThis very helpful .htaccess fileWe all like settings.phpStrange unbelievable error messagesor Let find more Troubles and more Problems and Ways how to fix them.
Useful MySQL stuffmysqlimport --password=mypass --user=myuserdbname dbname.sql;
mysql -h DBSERVER -p -u username dbname < dbname.sql
mysqldump-u username -p dbname > dbname.sql
mysql -h DBSERVER -p -u username dbname > dbname.sql Usemysql.cnffile to run easier#---------------[client]user = myuserpassword = mypasshost = DBSERVER[mysql]database = dbname#-------------mysql< dbname.sql
Log FilesIt's good to know what we have on hosting server and especially where Log files are. To access the files directly on the server, on some Unix shells, you can type the following command:tail -f /var/log/apache2/error.logTo check that you are looking at the right file, you may wish to type the following commands to find where the log files are.grep 'ErrorLog' /etc/apache2/*grep 'ErrorLog' /etc/apache2/*/*
Error ReportingIf error reporting is turned off, you could be getting a fatal error but not seeing it. On a production site, it is common to have error reporting turned off.Take care to have in index.php:error_reporting(E_ALL);ini_set('display_errors', TRUE);ini_set('display_startup_errors', TRUE);this will help in debug/test mode
Install and GoCreate Database … and enjoy easy installationIf some php settings are not in properly state, install process will tell you (about register_globals, mbstring.http_output, safe_mode, etc.)
php.ini magicianHow to override php settings:value of a configuration option in php.ini.htaccess directivesusing ini_set() in settings.phpor use control panel on your hosting serveror call to admin personor change hosting server 
Another way to overrideIf you have access to php.ini it’s AWESOME, and It’s great if you have your own php.ini near by wwwOn some hosting servers such kind of option is used to enable using local php.ini file:ssuPHP_ConfigPath /hsphere/local/home/sitelocationThis setting must be located in .htaccess fileAnd php.ini file must exists in /hsphere/local/home/sitelocation/php.ini
Allowed memory size …Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)...Increase PHP's memory limit, up to 16MB or 24M or 32MB or especially 96MB for a site with built-in image processing using ImageAPI GDmemory_limit = 16M in your php.ini file. orphp_valuememory_limit 16Min your .htaccessfileorini_set('memory_limit', '16M'); in your settings.php file???
Execution time of 30s exceeded“Fatal error: Maximum execution time of 30 seconds exceeded in ….\includes\database.mysql.inc on line XXX”The default PHP timeout defined in php.ini is 30 seconds. This is too short for some activities like listing/enabling modules.max_execution_time 120; (php.ini)php_valuemax_execution_time 120 (.htaccess)ini_set(‘max_execution_time’, ‘120’) (settings.php)Set “max_execution_time “ = 3000 and Enjoy  (is very useful in testing stage)
Dear friend - .htaccess.htaccess was not uploaded (Access Denied message, Disabled Clean urls)RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]“PHP: Error parsing …” - () was in .htaccess commentshttp://example.com -> http://www.example.com# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] http://www.example.com -> http://example.com# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]Lovely settings.php $cookie_domain = 'example.com';Drupal automatically generates a unique session cookie name for each site, based on full domain name
This option is used in CKFinder configuring
Do not miss it, going from dev-server to production-serverTake care about file permission and $db_url and $update_free_accessDon’t forget, if you have $db_prefix, you should use {table} in SQL query build
WSOD (White Screen Of Death)"Invisible" Errors or Blank Pages, how to fix:SELECT * FROM watchdog LIMIT 20;Easy manual quick-fixing rename couple of modules step-by-stepDtoolsbench_chart.module, wsod_emergency.php, wsod.moduleIncrease CPU limit on hosting serverWith low level (3-5%) some heavy pages will be “blank”Another silly mistakesWhitespace at the Begin and End of a PHP FileSee more about <? and <?php in short_open_tag “php configuration option” information
God, bless IDEs, which remove trailing whitespace. Or you should take care with your coding “You are not authorized to access this page”browser multi tab access

Drupal Deployment Troubles and Problems

  • 1.
    Drupal DTPDeployment Troublesand Problems6.x @landike (Andrii Lundiak)
  • 2.
  • 3.
  • 4.
    What we havetoday to discussHosting environment worriesFirst install stepsMagic php.iniThis very helpful .htaccess fileWe all like settings.phpStrange unbelievable error messagesor Let find more Troubles and more Problems and Ways how to fix them.
  • 5.
    Useful MySQL stuffmysqlimport--password=mypass --user=myuserdbname dbname.sql;
  • 6.
    mysql -h DBSERVER-p -u username dbname < dbname.sql
  • 7.
    mysqldump-u username -pdbname > dbname.sql
  • 8.
    mysql -h DBSERVER-p -u username dbname > dbname.sql Usemysql.cnffile to run easier#---------------[client]user = myuserpassword = mypasshost = DBSERVER[mysql]database = dbname#-------------mysql< dbname.sql
  • 9.
    Log FilesIt's goodto know what we have on hosting server and especially where Log files are. To access the files directly on the server, on some Unix shells, you can type the following command:tail -f /var/log/apache2/error.logTo check that you are looking at the right file, you may wish to type the following commands to find where the log files are.grep 'ErrorLog' /etc/apache2/*grep 'ErrorLog' /etc/apache2/*/*
  • 10.
    Error ReportingIf errorreporting is turned off, you could be getting a fatal error but not seeing it. On a production site, it is common to have error reporting turned off.Take care to have in index.php:error_reporting(E_ALL);ini_set('display_errors', TRUE);ini_set('display_startup_errors', TRUE);this will help in debug/test mode
  • 11.
    Install and GoCreateDatabase … and enjoy easy installationIf some php settings are not in properly state, install process will tell you (about register_globals, mbstring.http_output, safe_mode, etc.)
  • 12.
    php.ini magicianHow tooverride php settings:value of a configuration option in php.ini.htaccess directivesusing ini_set() in settings.phpor use control panel on your hosting serveror call to admin personor change hosting server 
  • 13.
    Another way tooverrideIf you have access to php.ini it’s AWESOME, and It’s great if you have your own php.ini near by wwwOn some hosting servers such kind of option is used to enable using local php.ini file:ssuPHP_ConfigPath /hsphere/local/home/sitelocationThis setting must be located in .htaccess fileAnd php.ini file must exists in /hsphere/local/home/sitelocation/php.ini
  • 14.
    Allowed memory size…Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)...Increase PHP's memory limit, up to 16MB or 24M or 32MB or especially 96MB for a site with built-in image processing using ImageAPI GDmemory_limit = 16M in your php.ini file. orphp_valuememory_limit 16Min your .htaccessfileorini_set('memory_limit', '16M'); in your settings.php file???
  • 15.
    Execution time of30s exceeded“Fatal error: Maximum execution time of 30 seconds exceeded in ….\includes\database.mysql.inc on line XXX”The default PHP timeout defined in php.ini is 30 seconds. This is too short for some activities like listing/enabling modules.max_execution_time 120; (php.ini)php_valuemax_execution_time 120 (.htaccess)ini_set(‘max_execution_time’, ‘120’) (settings.php)Set “max_execution_time “ = 3000 and Enjoy  (is very useful in testing stage)
  • 16.
    Dear friend -.htaccess.htaccess was not uploaded (Access Denied message, Disabled Clean urls)RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]“PHP: Error parsing …” - () was in .htaccess commentshttp://example.com -> http://www.example.com# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  • 17.
    # RewriteRule ^(.*)$http://www.example.com/$1 [L,R=301] http://www.example.com -> http://example.com# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  • 18.
    # RewriteRule ^(.*)$http://example.com/$1 [L,R=301]Lovely settings.php $cookie_domain = 'example.com';Drupal automatically generates a unique session cookie name for each site, based on full domain name
  • 19.
    This option isused in CKFinder configuring
  • 20.
    Do not missit, going from dev-server to production-serverTake care about file permission and $db_url and $update_free_accessDon’t forget, if you have $db_prefix, you should use {table} in SQL query build
  • 21.
    WSOD (White ScreenOf Death)"Invisible" Errors or Blank Pages, how to fix:SELECT * FROM watchdog LIMIT 20;Easy manual quick-fixing rename couple of modules step-by-stepDtoolsbench_chart.module, wsod_emergency.php, wsod.moduleIncrease CPU limit on hosting serverWith low level (3-5%) some heavy pages will be “blank”Another silly mistakesWhitespace at the Begin and End of a PHP FileSee more about <? and <?php in short_open_tag “php configuration option” information
  • 22.
    God, bless IDEs,which remove trailing whitespace. Or you should take care with your coding “You are not authorized to access this page”browser multi tab access
  • 23.
  • 24.
    admin/build/themes onslow hostingTo fix this issue: call drupal_flush_all_caches(); anywhere
  • 25.
    Disabling ModulesVia theModule Administration Page in the UIAdminister > Site Building > Modules … Uncheck and SaveVia the DatabaseIf your WSOD is caused by a specific module and you cannot access the module admin page, go to system table, set status to 0 and then clear the cache table
  • 26.
    You should havecronThere are many ways to configure cron (curl, lynx, wget, even GET), but …Here is real “drupal” way:Change file permission for scripts/drupal.sh (chmoda+x scripts/drupal.sh)Use in crontab file (or in Hosting Control Panel) this command:/home/account/www/scripts/drupal.sh --root /home/account/www http://default/cron.phpPS. Cron is used by many modules: Update, Event, Aggregator, Search, Notifications, Send, Image watermark, Watchdog and other which must run time-related tasks.
  • 27.
    Suggestions Before DeploymentBeafraid free hosting with additional adsadmin/build/[modules|menu] doesn’t run
  • 28.
  • 29.
    JavaScript/AJAX/XMLHttpRequest errorsTheseactions would be great to do before/during/after deployment:TRUNCATE TABLE watchdog;drupal_flush_all_caches(); or “Clear Cached Data”"Rebuild Permissions" in Post Settings page“Re-Index site”
  • 30.
    Think at first|| rapid developmentMasquarade moduleTransliterationDevel/Themer moduleDrush module“TEASER break” button in rich editor an Node-SystemUse professional IDE
  • 31.
    ReferencesDrupal Deployment Checklist(!!)http://www.metaltoad.com/blog/drupal-deployment-checklistGeneral information about cron with Drupalhttp://drupal.org/getting-started/6/install/cronAdvanced Cron Moduleshttp://groups.drupal.org/node/17072/edit +++ http://www.drupalcron.org/Dtools module (WSOD tablet)http://drupal.org/project/dtools/cvs-instructionsAdvanced PHP Error Handling via htaccess (!!!)http://perishablepress.com/press/2008/01/14/advanced-php-error-handling-via-htaccess/Stupid htaccess Tricks (!!!)http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/Drupal Tweaks (helping with allocation of php memory size)http://drupal.org/project/drupal_tweaksDrush - Drupal Shell utility http://drupal.org/project/drush || http://groups.drupal.org/drush || http://drupal.org/node/477684Automating Drupal Deployment with drush_make and Features (!!!)http://drupalcampaustin.org/sessions/automating-drupal-deployment-drushmake-and-features Install with Drush (!!! – GREAT short list of command to install)http://knol.google.com/k/michael-chelen/how-to-install-drupal-using-drush/gxxp1ckx8nad/5# That’s allSend me email. I’m here landike@gmail.comFollow me in twitter @landikeCall me via Skype – lan_researcherSee my “media” updates on www.landike.mpdrupal user – LAN_DRUPAL