Set auto_prepend_file with .htaccess on Hosteurope managed hosting

Submitted by Anonymous (not verified) on Mon, 05/03/2010 - 11:11

To set a standart auto_prepend_file for php on a dedicated root server is not a bit thing but on a virtual webhosting or managed server it could be a big issue. Because you dont have systemwide global access to httpd.conf and php.ini files.

My small solutions for Hostrurope managed virtual hosting packets:

Add this line to your .htaccess file
php_value auto_prepend_file  /is/htdocs/wp1193698874_ABCDEFGH/www/auto_prepend.php

And be sure that your auto_prepend.php really exists and its path is correct.

Replace string in big database or large text file

Submitted by Anonymous (not verified) on Sun, 05/02/2010 - 22:28

You have a cms and a big database with over 100 tables and 100.000 entries. And you need to replace all entries contain "example.com" with "www.example.com". How you do that? Editing all entries manually with phpmyadmin? It could takes weeks to complete. I have found a solution and want to share with you.

Steps:

1. Export your whole database in a text file : db.sql
2. Replace string using Linux sed command
3. Empty your db and import new sql file

Export your mysql database into a text file: db.sql

mysqldump -u root -p your_database_name > db.sql

[Howto Fix] Table './eximstats/sends' is marked as crashed and should be repaired

Submitted by rex on Fri, 04/30/2010 - 17:16

I've tryed to dump my whole databases with mysqldump

mysqldump --all-databases > all_databases.sql

got the error 'Table './eximstats/sends' is marked as crashed and should be repaired when using LOCK TABLES'

'eximstats' is my databasename und 'sends' my tablename.

I've tryed to repair the table with

mysqlcheck -u root --check auto-repair --optimize all-databases

but it no not worked

I've also tryed to repair ith with


mysql> repair table eximstats.sends;

Configure phpMyAdmin to login automagicly without prompted for username and password

Submitted by n8coder on Thu, 04/29/2010 - 11:30

Do you need to configure phpMyAdmin to login automagicly without prompted for username and password? I needed two hours to get it works, do not spend so much time and just follow steps below:

1. Download PhpMyAdmin

2. unzip phpmyadmin

3. create a file named "config.inc.php" with following content and replace login information with yours


 * Date: Thu, 29 Apr 2010 11:20:23 +0200
 */

/* Servers configuration */
$i = 0;

Using "Linux Find" command to get human readable directory sizes in public_html

Submitted by Anonymous (not verified) on Tue, 04/27/2010 - 14:52

Say you have 100 top level directories and 1000 files just under ../public_html/ without counting deeper located files and dirs. and you want to get an overview of dirs under your www-directory. You can do it with one line command.

Use find to find directories, set maxdept to just get top-level folders.

Combine it with -exec and get same time the disk usage of dirs.

Use -h for human readable file sizes GB, MB, KB instead of byte size.

 
find /home/YOUR_USERNAME/public_html/ -type d -maxdepth 1 -exec du -sh {} \;

PHP Block for Custom Role under Drupal 6

Submitted by n8coder on Mon, 04/26/2010 - 11:33

Sometimes we need a block for just some users or a group of our websites. Under Drupal we can create a user group(role) and check current logges users role to give that user access or not. In this example I named it 'my_custom_role', but you can name it what ever you want ie: editor, moderator, privileged_customers, clients etc...

<?php
global $user;
if (
in_array('my_custom_role',$user->roles)) {
  return
TRUE; // or print any content for my_custom_role
}
else {
  return
FALSE; // or print any content for other users
}
?>