Thursday, 24 February 2011

Etch repositories

One of my servers runs Debian Etch, very old distrib. To upgrade php on this server I need etch repositories. All of them are on archive Debian server:
deb http://archive.debian.org/debian/ etch main non-free contrib 
deb http://archive.debian.org/debian-security/ etch main non-free contrib 

deb http://archive.debian.org/debian-volatile/ etch main non-free contrib

Tuesday, 15 February 2011

Upgrade to new Debian 6

List of repositories to insert to /etc/apt/sources.list:
deb http://ftp.us.debian.org/debian/ squeeze main
deb http://security.debian.org/ squeeze/updates main
deb http://ftp.debian.org/debian squeeze-updates main


As you see, volatile is replaced by another site. There are no sites with src packages, because I don't use them :)

Here they are:
deb-src http://ftp.us.debian.org/debian/ squeeze main
deb-src http://security.debian.org/ squeeze/updates main

Tuesday, 8 February 2011

PHP script to convert character set for all tables in database


$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'pass';
$dbname = 'db';

header('Content-type: text/plain');

$dbconn = mysql_connect($dbhost, $dbuser, $dbpass) or die( mysql_error() );
$db = mysql_select_db($dbname) or die( mysql_error() );

$sql = 'SHOW TABLES';
$result = mysql_query($sql) or die( mysql_error() );
while ( $row = mysql_fetch_row($result) )
{
$table = mysql_real_escape_string($row[0]);
$sql = "ALTER TABLE $table DEFAULT CHARACTER SET cp1251 COLLATE cp1251_general_ci";
mysql_query($sql) or die( mysql_error() );
print "$table changed to cp1251.\n";
}
mysql_close($dbconn);
?>

Ping does not work

Today I would like to discuss a banal situation: host A is directly connected to host B, ping from host A to host B does not work. What are...