Monday 28 November 2011

Drupal fix failed cron with drush

First run:

drush --yes vset cron_semaphore 0
And then

drush cron

php5-fpm and nginx config to avoid Internal server errors

This is a setting that I've found pretty stable (on a high-end server with 16GB ram) for a busy Drupal site, after a lot of headackes with 503 Error due to poor configuration:

nano /etc/php5/fpm/pool.d/www.conf

pm = dynamic

pm.max_children = 25
pm.min_spare_servers = 2
pm.max_spare_servers = 10

pm.max_requests = 100
 request_terminate_timeout = 30s



This may be also have been useful to put the following line in php.ini to make sure that we get rid of faulty long processes:

max_execution_time = 30

Impose the same time limit in the nginx  fastcgi directives:

nano /etc/nginx/sites-available/default:
            fastcgi_connect_timeout 30;

            fastcgi_send_timeout 30;

            fastcgi_read_timeout 30;

And finally, in /etc/php5/fpm/php.in, my memory limit is:


memory_limit = 256M


Don't forget to restart both nginx and php5-fpm for the changes to take effect.



Sunday 27 November 2011

reset MySQL password

Many suggested solutions did not work. But this one does the job

First You have to  Stop mysql server:
 
service mysqld stop

Now Start mysql server in safe mode with Follwing Options:
 


mysqld_safe –user=mysql –skip-grant-tables –skip-networking &

Now you have to Login to mysql server without password:
 


mysql -u root mysql

You will get Mysql Prompt.
 


mysql> UPDATE user SET Password=PASSWORD('newrootpassword') WHERE User='root';
 

mysql> flush privileges;
 

mysql> exit
 
Restart mysql server:
 


service mysqld restart

Login to MySQL With the New Password:
 

 mysql -uroot -pnewrootpassword

Thanks UnixLab