Posts Tagged ‘MySQL’

PHP Performance Test : Linux & Windows

Identical Hardware was used to make the tests.

  • Intel Core2Duo 2.4 GHz
  • 2 GB DDR2 RAM
  • 160 GB SATA 7200 RPM
  • Windows Server 2003/Ubuntu

PHP on Linux Versus PHP on Windows

  • RAW statement execution is faster on Windows.
  • Function Calls are faster on Windows
  • Object Creation & Access are faster on Linux with PHP 5.2 but faster on Windows with PHP 5.3
  • Library calls are faster on Linux. (Example: Encryption process is 3-5 times faster on Ubuntu.)
  • File Access is faster on Linux by a small percentage, except for file copy operations which is as much as 60% slower on Windows probably due to the ACL advanced security.
  • MySQL access with Linux is faster by more than a little and on Windows, MySQL access deteriorates in version 5.3
  • PostgreSQL performance is very close on both platforms (within 6/100 of a second for 1000 Operations) – It’s faster on Windows and faster still on Windows with PHP 5.3
  • MS SQL Server access from PHP 5.2 on Windows is marginally slower than MySQL access on Linux.

Dumping The MySQL database using PHP

If your web hosting provider does not keep the daily backups of your MySQL databases, then you need to think of taking the daily backups to avoid the risk of data loss. Backing up the database is very simple process if your do that using PhpMyAdmin or MYSQL administrator. However, this manual process sometimes may make you feel bored doing the same task daily. Hence, it is better to create the web page that takes the backups automatically. You just need to visit the backup generation page once a day. And it will dump the mysql backup for you. Here is the sample script that dumps the MYSQL database.

<?php
//~ Must edited values

//~ MySQL
$SQL_USER=’username’;
$SQL_PASS=’password’;
$SQL_DB=’database’;

//~ * Back up mail
$MAIL=’your@email.com’;
$SUBJECT=’backup’;
$MESSAGE=’backup’;

//~ * MySQL dump, then zip.
shell_exec(“mysqldump -u $SQL_USER -p$SQL_PASS $SQL_DB $SQL_DB.sql”);
shell_exec(“zip $SQL_DB $SQLDB.sql”);

//~ * Send mail with attachment.
$OB=’—-=_OuterBoundary_000?;
$IB=’—-=_InnerBoundery_001?;
$headers=”From: $MAIL\r\n”
.”MIME-Version: 1.0\r\n”
.”Content-Type: multipart/mixed;\n\tboundary=\”$OB\”\n”;
$Msg=”This is a multi-part message in MIME format.\n”
.”\n–$OB\n”
.”Content-Type: multipart/alternative;\n\tboundary=\”$IB\”\n\n”
.”\n–$IB\n”
.”Content-Type: text/plain;\n\tcharset=\”iso-8859-1\”\n”
.”Content-Transfer-Encoding: quoted-printable\n\n”
.$MESSAGE
.”\n–$IB–\n”
. “\n–$OB\n”
.”Content-Type: application/octet-stream;\n\tname=www.zip\n”
.”Content-Transfer-Encoding: base64\n”
.”Content-Disposition: attachment;\n\tfilename=www.zip\n\n”
.chunk_split(base64_encode(file_get_contents($SQL_DB.’.zip’)))
.”\n\n”
.”\n–$OB–\n”;
mail($MAIL, $SUBJECT, $Msg, $headers);
//~ * Completed message
echo ‘done’;
?>

Web Service Automates WordPress Password Cracking – Blog Hacking As A Service !!

Hackers have developed a distributed Wordpress admin account cracking scheme that poses a severe risk for the security of blogs whose owners select insecure passwords.

PHP scripts located on a virtual server run bruteforce (password guessing) attacks on targeted sites. Many sites can be attacked at the same time by the system, with results written into an associated database.

The SANS Institute’s Internet Storm Centre notes that brute force attacks against Wordpress are commonplace. The distributed nature of the latest attack marks an evolution towards blog hacking as a web service, however, thus marking it out from the crowd.

“While this particular version is relatively simple, the power behind the script and the MySQL database allows the attacker to distribute the attacks not only by sites, but also by passwords tried as well,” ISC security watcher Bojan Zdrnja writes.

Blog administrators are advised to use strong (hard to guess) passwords and to limiting access by IP address as a security precaution to prevent getting pwned.