Tips for software developers

 

Install Apache, PHP, MySQL and phpMyAdmin on Debian

 
  • Install Apache 2:
    apt-get install apache2
  • Install PHP 5:
    apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi
  • Install MySQL:
    apt-get install mysql-client mysql-common mysql-server php5-mysql
  • Install phpMyAdmin:
       download phpMyAdmin from http://www.phpmyadmin.net and unzip it to /var/www/
       it's better to rename the default phpMyAdmin folder to avoid hackers
  • Start the sevices:
    /etc/init.d/mysql start
    /etc/init.d/apache2 start
       if there are problems, you may need to check configuration files under /etc/apache2/
 

Install Eclipse and its plugins

 
 

Make Windows XP Search All Types of Files

 
  • Click Start, and then click Search.
  • Click Change preferences, and then click With Indexing Service (faster local searches).
  • You have two choices here:
    1. Disable Indexing Service by clicking No, do not enable indexing service. And you can try to search again ... or
    2. Click Change Indexing Service Settings (Advanced), and continue to next step ...
  • On the toolbar of Indexing Service console, click Show/Hide Console Tree.
  • In the left pane, right-click Indexing Service on Local Machine, and then click Properties.
  • On the Generation tab, click to select the Index files with unknown extensions check box, and then click OK.
  • Close the Indexing Service console.
 

Install Apache, PHP, MySQL and phpMyAdmin on Windows Vista

** For Windows 2000/XP/2003 Server, you can download an all-in-one binary package XAMPP for Windows
 
  • Download Apache, PHP, MySQL and phpMyAdmin (latest versions when this section's written):
    apache_2.2.8-win32-x86-no_ssl.msi
    php-5.2.6-Win32.zip
    mysql-6.0.4-alpha-win32.zip
    phpMyAdmin-2.11.6-all-languages-utf-8-only.zip
  • Disable Windows User Account Control (UAC):
    Control Panel > User Accounts > Turn User Account Control on or off
  • Disable IIS if it's enabled:
    Control Panel > Turn Windows features on or off > Internet Information Services
  • Install Apache:
    Try http://localhost after the installation, the page should show It works!
  • Install PHP:
    Unzip the PHP package to c:\php
    Rename/copy php.ini-recommended to php.ini
    Move php5ts.dll to C:\Windows\System32\
    Copy libmysql.dll to C:\Windows\System32\
    Edit php.ini and set doc_root=C:/Program Files/Apache Software Foundation/Apache2.2/htdocs (for example)
    Edit httpd.conf (C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf, for example) and add the following lines to the end of the file:
       # PHP5 installation:
       ScriptAlias /php/ "C:/PHP/"
       AddType application/x-httpd-php .php .php5
       LoadModule php5_module "C:/PHP/php5apache2_2.dll"
       # configure the path to php.ini
       PHPIniDir "C:/php"
    Make sure you have DirectoryIndex index.php index.html set in the httpd.conf file
    Restart Apache after you modify httpd.conf or php.ini
  • Install MySQL:
    Configure firewalls to enable TCP port 3306 and then unzip the MySQL package and run Setup.exe
    Edit php.ini to set extension_dir="c:/php/ext" and uncomment extension=php_mysql.dll
    Restart Apache after you modify httpd.conf or php.ini
  • Install phpMyAdmin:
       Unzip the phpMyAdmin package to
        "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

       Create a config.inc.php file under the root directory of phpMyAdmin with the following contents:
    <?php
    $cfg['blowfish_secret'] = 'ba17c1ec07d65003';  // use here a value of your choice
    
    $i=0;
    $i++;
    $cfg['Servers'][$i]['auth_type']     = 'cookie';
    
    $i=0;
    $i++;
    $cfg['Servers'][$i]['user']          = 'root';
    $cfg['Servers'][$i]['password']      = 'PASSWORD'; // use here your password
    
    ?>
    
 

MySQL hot backup

 
  • Using "mysqldump" and "gzip" to dump and compress all the databases:
    mysqldump --all-databases -uUSER -p | gzip > MYSQL_BACKUP_FILENAME.gz
  • Using "mysqlhotcopy" to backup databases (needs privilege to access MySQL database files):
    mysqlhotcopy --user=USER --password=PASSWORD db1 ... dbn /path/to/new_directory
 

Source code and important data backup

 
 

PHP Tips

 
  • Set error reporting to its highest level when debugging:
    error_reporting(E_ALL);
  • Lower error reporting level for release version, to disable error reporting:
    error_reporting(0);
  • Dynamically modify non-system PHP settings - ini_set():
    ini_set()
 

Perl Tips

 
  • "use strict" can catch stupid mistakes like typos in variable names:
    use strict;
 

Go Green!

 
mselvarajan2@ymail.com