Firefox Extensions You Need For Web Development

When it comes to Firefox, these are my top 5 favorite extensions that aid in development:

ColorZilla – An advanced eyedropper, color picker, and page zoomer
Html Validator – Adds HTML validation to the View Page Source window.
Split Browser – Splits the browser window so that you can view multiple pages at once.
Web Developer – Adds a menu and toolbar that’s packed with web development tools.
YSlow – Helps determine how a page is performing.

robots.txt vs meta tag. Which has precedence?

Question:
If you have a robots.txt file and a meta tag within an HTML web page, that contradict each other, which has precedence?

Answer:
If there is a conflict between the directive in robots.txt and the meta tag directive (e.g. if your robots.txt allows spidering but your page meta tag does not) the robots.txt directive has precedence.

How to stop people from viewing directory content on an Apache web server

Let’s say you have the following files in your root directory:

/public_html/
- FileA.txt
- FileB.jpg
- FileC.doc

By default, Apache will look for an index.htm or index.php to serve the the user if they navigated to:

http://www.example.com/

If those default files do not exist, Apache will end up showing the contents of the directory.  If you want to stop Apache from doing that, you can add an .htaccess file in the directory. The .htaccess file should contain the following line:
Options -Indexes

This will stop users from being able to view contents of directories. This will work for all subdirectories as well.

Setting up a Test Bench Web Server With Apache, PHP, MySQL, and More on Windows

Create a Website Directory

This is the directory in which your websites will be stored.

  1. Create the main directory (“C:/websites”)
  2. Create a subdirectory for each website (“C:/websites/example”)
  3. Create a subdirectory for the live website content (“C:/websites/example/online”)

Install Apache

  1. Go to Apache’s main website: www.apache.org
  2. Under Apache Projects, click the link that says “HTTP Server”
  3. Download the “Win32 Binary including OpenSSL” from the latest stable release.  At the time of this document, it was version 2.2.9.
  4. Locate the downloaded file and double click on it to launch the installation wizard.
  5. A “Welcome to the Installation Wizard” will appear.  Click “Next”.
  6. Accept the terms of use. Click “Next”.
  7. A notice will appear. Click “Next”.
  8. You will be prompted to enter in your server’s information.  Fill in the following:
    • Network Domain: localhost
    • Server Name: localhost
    • Administrator’s Email Address: admin@example.com
  9. Select “for All Users, on Port 80, as a Service – Recommended”.
  10. Click “Next”.
  11. Select “Typical” setup type. Click “Next”.
  12. The install path should look like:
    C:\Program Files\Apache Software Foundation\ApacheX.X\
    Click “Next”.
  13. Click “Install”.
  14. Wait for installation to complete. Click “Finish”.
  15. Go to http://localhost and make sure it displays “It works!”.

Install PHP

  1. Go to PHP’s main website: www.php.net
  2. Click on the “downloads” link, located at the top of the page.
  3. Download the latest PHP installer. At the time of this document, it was “PHP 5.2.6 installer”.
  4. Locate the downloaded file and double click on it to launch the installation wizard.
  5. A “Welcome to the PHP X.X.X Setup Wizard” will appear.  Click “Next”.
  6. Accept the terms of use. Click “Next”.
  7. The install path should look like:
    C:\Program Files\PHP\
    Click “Next”.
  8. Select the Apache Webserver that you had installed.  In my case, it was “Apache 2.2.x Module”. Click “Next”.
  9. Set the location of the Apache Configuration Directory.  It should be:
    C:\Program Files\Apache Software Foundation\Apache2.2\conf\
  10. The next screen will ask you what items you want to install.  Expand the “Extensions” section and click the arrow next to “MySQL”. Select “Entire feature will be installed on local hard drive”. Click “Next”.
  11. Click “Install”.
  12. Wait for installation to complete. Click “Finish”.

Configuring and Testing both Apache and PHP

  1. Configure Apache
    • Go to:
      C:\Program Files\Apache Software Foundation\Apache2.2\conf
    • Open “httpd.conf” in Notepad.
    • Replace the line:
      DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
      With:
      DocumentRoot "C:/websites/example/online"
    • Replace the line:
      <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
      With:
      <Directory " C:/websites/example/online">
    • Replace the line:
      DirectoryIndex index.html
      With:
      DirectoryIndex index.html index.php
    • Add the following lines to the top of the file:
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps
    • Search for the line:
      # AllowOverride controls what directives may be placed in .htaccess files.
      Replace this line (which should be below the line you just searched for):
      AllowOverride None
      With:
      AllowOverride All
    • Click File -> Save.
    • Click File -> Exit.
  2. Configure PHP
    • Go to:
      C:\Program Files\PHP
    • Open “php.ini” in Notepad.
    • (Optional Step) Replace the line:
      upload_max_filesize = 2M
      With:
      upload_max_filesize = 10M
    • (Optional Step) Replace the line:
      post_max_size = 8M
      With:
      post_max_size = 20M
    • (Optional Step) Replace the line:
      short_open_tag = Off
      With:
      short_open_tag = On
    • (Optional Step) Replace the XXX on the line with your ISP’s SMTP server, YYY:
      SMTP = XXX
      With:
      SMTP = YYY
      Example:
      SMTP = mail.earthlink.net
  3. Create 1st PHP file:
    • Go to:
      C:\websites\example\online
    • Create a file called “phpinfo.php” and open it with Notepad.
    • Enter in:
      <?php
      phpinfo();
      ?>
    • Click File -> Save.
    • Click File -> Exit.
  4. Restart Apache
    • Click Start->Programs->Apache HTTP Server X.X->Control Apache Server->Restart.
  5. Test that Apache and PHP are Correctly Configured

Install MySQL

  1. Go to MySQL’s main website: www.mysql.com
  2. Click on the “Downloads” link, located at the top of the page.
  3. Click the “Download” button for the “MySQL Community Server”.
  4. Select “Windows”
  5. Download the “Windows ZIP/Setup.EXE” (at the time of this document it was “mysql-5.0.67-win32”). Note: You may need to register an account to download it.
  6. Extract the zip file and run “Setup.exe”
  7. A “Welcome to Setup Wizard for MySQL Server X.X” will appear.  Click “Next”.
  8. Select “Typical”. Click “Next”.
  9. Click “Install”.
  10. Click “Next”.
  11. Click “Next”.
  12. Select “Configure the MySQL Server now”. Click “Finish”.
  13. A Configuration Wizard will appear. Click “Next”.
  14. Select “Detailed Configuration”. Click “Next”.
  15. Select “Developer Machine”. Click “Next”.
  16. Select “Multifunctional Database”. Click “Next”.
  17. Select “C:” drive and “Installation Path”. Click “Next”.
  18. Select “Decision Support (DSS)/OLAP”. Click “Next”.
  19. Select “Enable TCP/IP Networking”. Set Port Number to: 3306. Select “Enable Strict Mode”. Click “Next”.
  20. Select “Standard Character Set”. Click “Next”.
  21. Select “Install As Windows Service”. Select “Launch the MySQL Server automatically”.  Select “Include Bin Directory in Windows PATH”. Click “Next”.
  22. Enter the new root password (twice): “example”. Click “Next”.
  23. Click “Execute”.
  24. Click “Finish”.

Configure Apache, PHP, and MySQL together

  1. Copy “libmysql.dll” from:
    C:\Program Files\PHP
    To Both:
    C:\WINDOWS\system
    And:
    C:\WINDOWS\system32

Supplemental Install – phpMyAdmin

  1. Go to phpMyAdmin’s main website:  www.phpmyadmin.net
  2. Click on the “DOWNLOADS” link at the top of the page.
  3. Download the latest release’s “english.zip”.
  4. Create a directory called “phpmyadmin” in “C:/websites”
  5. Extract the contents of english.zip to “C:/websites/phpmyadmin”
  6. Create a file “config.inc.php” inside the main phpmyadmin directory.  The main directory might resemble:
    C:\websites\phpmyadmin\phpMyAdmin-3.0.1-rc1-english
  7. Open “config.inc.php” in Notepad.
  8. Paste in the following data:
    <?php
    /*
    * This is needed for cookie based authentication to encrypt password in
    * cookie
    */
    $cfg['blowfish_secret'] = ‘a8bcFQp98fs8d’; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! *//*
    * Servers configuration
    */
    $i = 0;

    /*
    * First server
    */
    $i++;

    $cfg['Servers'][$i]['user'] = ‘root’;
    $cfg['Servers'][$i]['password'] = ‘example’; // Your MySQL Password

    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = ‘config’;
    /* Server parameters */
    $cfg['Servers'][$i]['host'] = ‘localhost’;
    $cfg['Servers'][$i]['connect_type'] = ‘tcp’;
    $cfg['Servers'][$i]['compress'] = false;
    /* Select mysqli if your server has it */
    $cfg['Servers'][$i]['extension'] = ‘mysql’;
    /* User for advanced features */
    $cfg['Servers'][$i]['controluser'] = ‘root’;
    $cfg['Servers'][$i]['controlpass'] = ‘example’; // Your MySQL Password
    /* Advanced phpMyAdmin features */
    $cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;
    $cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;
    $cfg['Servers'][$i]['relation'] = ‘pma_relation’;
    $cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;
    $cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;
    $cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;
    $cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;
    $cfg['Servers'][$i]['history'] = ‘pma_history’;

    /*
    * Directories for saving/loading files from server
    */
    $cfg['UploadDir'] = ”;
    $cfg['SaveDir'] = ”;
    ?>

  9. Go to:
    C:\Program Files\Apache Software Foundation\Apache2.2\conf
  10. Open “httpd.conf” in Notepad.
  11. Change:
    #Include conf/extra/httpd-vhosts.conf
    To:
    Include conf/extra/httpd-vhosts.conf
  12. Replace the line:
    DocumentRoot “C:/websites/example/online”
    With:
    DocumentRoot “C:/websites”
  13. Replace the line:
    <Directory “C:/websites/example/online”>
    With:
    <Directory “C:/websites”>
  14. Click File -> Save.
  15. Click File -> Open.
  16. Select the file “httpd-vhosts.conf” located at:
    C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra
  17. Paste the following:
    NameVirtualHost *:80
    # —————————————–
    #localhost
    <VirtualHost *:80>
    DocumentRoot “C:/websites/example/online”
    ServerName localhost
    <Directory “C:/websites/example/online”>
    AllowOverride All
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>
    # —————————————–
    #example.local
    <VirtualHost *:80>
    DocumentRoot “C:/websites/example/online”
    ServerName example.local
    <Directory “C:/websites/example/online”>
    AllowOverride All
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>
    # —————————————–
    #phpmyadmin.local
    <VirtualHost *:80>
    DocumentRoot “C:/websites/phpmyadmin/phpMyAdmin-3.0.1-rc1-english”
    ServerName phpmyadmin.local
    <Directory “C:/websites/phpmyadmin/phpMyAdmin-3.0.1-rc1-english”>
    AllowOverride All
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>
    # —————————————–
  18. Click File -> Save.
  19. Open the file “hosts” located at:
    C:\WINDOWS\system32\drivers\etc
  20. Paste the following contents into the file:
    127.0.0.1     localhost
    127.0.0.1     example.local  # Example
    127.0.0.1     phpmyadmin.local     # phpMyAdmin
  21. Click File -> Save.
  22. Restart Apache.

Supplemental Install – Eclipse PDT (PHP Development Tools)

  1. Go to PDT’s main website:  www.eclipse.org/pdt
  2. Click “Downloads” on the left navigation pane.
  3. Download the Windows “All-In-One”.
  4. Unzip the contents of the zip file to:
    C:\Program Files\pdt
  5. The main executable, “eclipse.exe”, will be within the directory:
    C:\Program Files\pdt\eclipse
  6. If it does not run, it is most likely because you do not have Java installed. Download and install the latest version of Java at:
    www.java.com

Supplemental Install – Additional Web Browsers

  1. For testing purposes, we recommend downloading the following web browsers: