FAQ

FAQ

The selected file /tmp/file*** could not be uploaded, because the destination * is not properly configured

Posted July 26th, 2012 by admin

The selected file /tmp/file*** could not be uploaded, because the destination * is not properly configured.

Main problem is that on shared or VPS hosting those directories: files/ tmp/ do not have proper owner and chmod settings:


chown apache:apache tmp
chmod 750 tmp

Drupal bulk delete nodes per filter

Posted July 3rd, 2012 by admin


<?php
error_reporting(E_ALL);
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$nodetype = "nodetype";
$uid = 1468;
$limit = 500;
$results = db_query("SELECT nid FROM {node} WHERE type='%s' AND uid=%d LIMIT %d", $nodetype, $uid, $limit);

$count = 0;

while ($result = db_fetch_object($results)) {
node_delete($result->nid);
print 'Deleted node: ' . $result->nid . '';
$count++;
}

print "Total deleted: $count";

?>

Remove ^M characters at end of lines in vim

Posted June 13th, 2012 by admin

Remove ^M characters at end of lines in vim

To remove the ^M characters at the end of all lines in vim, use:

:%s/^V^M//g

The ^v is a CONTROL-V character and ^m is a CONTROL-M. When you type this, it will look like:

:%s/^M//g

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

Syndicate content