Posts Tagged ‘PHP’

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’;
?>

Windows Cache Extension For PHP By Microsoft

Windows Cache Extension for PHP has been released by Microsoft. It is currently in its Beta version. If you are heavily dealing with PHP applications on Windows platform, then this is the very cool thing for you. Your PHP applications can run faster than ever even on Windows Platform. It is only available forPHP 5.2.X, Non-thread-safe build and PHP 5.3 X86, Non-thread-safe VC9 build. One another requirement is that this cache extension runs only and only if the IIS is configured to execute PHP with FastCGI.

Supported Configurations

  • Windows XP SP3 with IIS 5.1 and FastCGI Extension
  • Windows Server 2003 with IIS 6.0 and FastCGI Extension
  • Windows Vista SP1 with IIS 7.0 and FastCGI Module
  • Windows Server 2008 with IIS 7.0 and FastCGI Module
  • Windows 7 with IIS 7 and FastCGI Module
  • Windows Server 2008 R2 with IIS 7.0 and FastCGI Module
  • As the name itself suggests, this is the caching technique that results into the better performance. Every PHP request does not need to ask for the same resource from the same source as the resource is cached.

Available cache extensions are Windows Cache Extension 1.0 for PHP 5.2 – Beta and Windows Cache Extension 1.0 for PHP 5.3 – Beta

Installation of this cache extension is very easy. Here are the steps.

  • Download and copy the DLL file
  • Place it at \ext directory of your php installation
  • Update the php.ini file and add extension extension = php_wincache.dll
  • Refresh the application pools and restart necessary services
  • PHP caching techniques available are PHP opcode cache, file cache and relative file path cache.

Oracle Enterprise Linux and Zend Server For High Reliability and Performance

Oracle and Zend have a long-standing commitment to the PHP community, with a history of collaboration that has ensured integration between Oracle and Zend’s PHP solutions. Oracle Database, Application Server and JDeveloper tool, with a PHP extension, all support PHP development. A sizeable percent of Zend customers use Oracle Database infrastructure to develop and deploy enterprise PHP applications.

Oracle and Zend deliver a reliable, high performance Linux and PHP environment for running business-critical Web applications.

  • Oracle customers can easily install and update Zend Server from Oracle Unbreakable Linux Network (ULN) through standard, native RPM package delivery (http://linux.oracle.com)
  • Zend Server includes out-of-the-box connectivity to Oracle Database, minimizing the time required for set up
  • Full support for applications and production environments running on Oracle Enterprise Linux and Zend Server is available via Oracle (for Oracle Enterprise Linux) and Zend (for Zend Server)

Sources:
http://www.zend.com/products/server/
https://linux.oracle.com/pls/apex/f?p=101:3

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.