About Drupal Web Development
Blog about drupal modules, drupal sites, php web development, developer hints, tricks and drupal FAQ

admin's blog

Error accessing home page of phpMyAdmin 2.8.1

Posted April 26th, 2012 by admin

Error accessing home page of phpMyAdmin 2.8.1

Warning: session_write_close() [function.session-write-close]: open(C:\DOCUME~1\user\LOCALS~1\Temp\php\session\sess_orpi7es4n3h62bk9f0sul5raj5, O_RDWR) failed: No such file or directory (2) in D:\wwwroot\phpmyadmin\index.php on line 44


Warning: session_write_close() [function.session-write-close]: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\DOCUME~1\user\LOCALS~1\Temp\php\session) in D:\wwwroot\phpmyadmin\index.php on line 44

Solution
Problem was with deleted directories specified in php.ini by session.save_path
Fixed by creating valid path C:\DOCUME~1\user\LOCALS~1\Temp\php\session\

Fast and easy MySQL backup and recovery with shell command

Posted April 26th, 2012 by admin

Quick backup and restore of the MySQL database using mysqldump and gzip utility:

Backup:

mysqldump -u <user> -p<password> <database_name> | gzip -9 > database_dump.sql.gz

Recovery:

gunzip < database_dump.sql.gz | mysql -u <user> -p<password> <database_name>

How to print array in Drupal using drupal_set_message

Posted April 18th, 2012 by admin

Problem:
How to print array in Drupal using drupal_set_message

Solution:

drupal_set_message('<pre>'. print_r($array_or_object, TRUE) .'</pre>');

How to remove all emails from inbox

Posted April 14th, 2012 by admin

Problem
Problem occurs when inbox is overloaded. I can not login into webmail to delete all messages.

Solution
1. ssh to the host
2. cd /var/qmail/mailnames/domain.com/webmaster/Maildir/cur
3. remove all files by command: find . -name '*' | xargs sudo rm
4. Inbox is empty

CentOS - list all users

Posted April 14th, 2012 by admin

cat /etc/password
shows you all existing users.

How to create new SVN repository

Posted April 14th, 2012 by admin

1. open

/etc/httpd/conf.d/subversion.conf

2. add appropriate section for new repository:

<Location /svn-repository>
DAV svn
SVNPath /srv/svn/repository
AuthType Basic
AuthName "repository Repository"
AuthzSVNAccessFile /srv/svn/svn-acl-conf
AuthUserFile /srv/svn/repository.htpasswd
Require valid-user
</Location>

3. Create new htpasswd file by:

htpasswd -cm /srv/svn/repository.htpasswd repository
New password:

Re-type new password:

4. Create repository dir:


cd /srv/svn
svnadmin create repository
chown -R apache.apache repository

5. Restart httpd service:

service httpd restart

My current MySQL conf file my.cnf

Posted April 14th, 2012 by admin


[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
max_allowed_packet = 100M
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
skip-networking


skip-bdb


set-variable = innodb_buffer_pool_size=1G
set-variable = innodb_additional_mem_pool_size=20M
set-variable = innodb_log_file_size=250M
set-variable = innodb_log_buffer_size=8M
set-variable = innodb_thread_concurrency=4
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


skip-bdb


set-variable = innodb_buffer_pool_size=1G
set-variable = innodb_additional_mem_pool_size=20M
set-variable = innodb_log_file_size=250M
set-variable = innodb_log_buffer_size=8M
set-variable = innodb_thread_concurrency=4

Backup and restore MySQL db

Posted April 14th, 2012 by admin

Problem
There are unrecovery problems in Ibdata log files

Solution
# login to mysql:

> mysql -u admin -p


mysql> show databases;

# per each db dump all data


> mysqldump -u admin -p database | gzip -9 > database.sql.gz

# Now Ibdata log files can be deleted


> service mysqld restart

# Restore all dbs from dump files


gunzip < database.sql.gz | mysql -u admin -p database

# Retype password for DB users.

Batch convert upper case file names to lower case

Posted April 14th, 2012 by admin

Problem
Need batch convert upper case file names to lower case for jpg files.

Solution
run in shell:

for i in *.JPG; do mv $i `echo $i | tr [:upper:] [:lower:]`; done

Get 500 Internal Server Error when log into VZPP (Plesk Control Panel)

Posted April 14th, 2012 by admin

Error:
Get 500 Internal Server Error when log into VZPP (Plesk Control Panel)

Solution:

/etc/init.d/psa restart

Syndicate content