Friday, February 15, 2008

Firefox extension for developers (beta)

I want to list the Firefox add-ons that I commonly use related to developing. Some of them are very well known, but some are kind of new ones.
  1. Web developer toolbar: This might be the most famous, maybe the better firefox extension for web designers and developers. It can do too many things impossible to list in a single article. There is a nice article of how to check the accessibility of a web site using this tool.

  2. Firebug: This is the another well-known Firefox extension that compete with the web developer toolbar. You can edit, debug, and monitor CSS, HTML, and JavaScript.

  3. Javascript debugger: Powerful JavaScript debugging environment for Mozilla based browsers.

  4. YSlow: Analyzes web pages and tells you why they're slow based on Yahoo's rules for high performance web sites. It gives you: Performance report card, HTTP/HTML summary, List of components in the page, andTools including JSLint.

  5. Live HTTP Headers: View HTTP headers of a page and while browsing.

  6. Modify headers: Add, modify and filter http request headers. You can modify the user agent string, add headers to spoof a mobile request (e.g. x-up-calling-line-id) and much more.

For design related extension, you can check here.

.... still writting

Thursday, January 10, 2008

Common PHP's directives for general behavior

In PHP, you can customize the PHP's directives in three levels:
  • global level: php.ini file
  • virtual host or directory level: httpd.conf or .htaccess
  • executing php script level: ini_set() function
There is a configuration directive scope attached to each parameter. Refer to the documentation of the directives for more details. In the php.ini file note that starting a line with a semicolon (";") comments it out, so PHP will not read it.

I make a list of commonly used configuration directives (parameters) that help to customize the behavior of PHP. I am not saying you have to change the value of the directives, this just mention the effect of setting the value specified. The directives here are only relevant to PHP's general behavior, not related to an specific extension.
  1. zend.ze1_compatibility_mode = on , allows PHP4 applications to run in version 5 without problems. =) Cool, isn't?
  2. short_open_tag = on , allow the following scape format:
  3. output_buffering = on , send all output of a script at once, after the script has been completed. It allows make changes to the HTTP header throughout the script. No more "Cannot add header information - headers already sent".
  4. implicit_flush = on , flush the content of the output buffer after each call to print() or echo(). Useful where the server requires an unusually long period of time to perform something, and you want to show status update to the user rather than just wait.
  5. max_execution_time = number , maximum amount of seconds that a PHP script can execute.
  6. max_input_time = number , seconds that a PHP script devotes to parsing request data. Important when you upload large files.
  7. error_reporting = E_ALL , reports ALL errors and warnings (level of error-reporting sensitivity). Check the manual for other values.
  8. display_errors = on , show the error from the level specified by error_reporting directive.
  9. log_errors = on , any error will be logged to a particular file or to the syslog specified by error_log directive.
  10. error_log = "file" , if log_errors is enabled, this directive specifies the message destination.
  11. register_globals = on , enable this is a security risk Make globally available any external variable of the type COOKIE, ENVIRONMENT, GET, POST, and SERVER without its type. For example, use $var instead of $_GET['var']
  12. post_max_size = #M , maximum Mbytes of data can be sent via POST to a PHP script.
  13. magic_quotes_gpc = on , all single and double quotes, backslashes, and null chars are automatically escaped with a backslash. Only valid for data transmitted via GET, POST, and COOKIE.
  14. include_path = ". ; path" , this path serves as the base path used by functions such as include(), require(), etc. Separate multiple directories with a semicolon (;)
  15. doc_root = "path", used only if it is not empty. Indicate the default from which all PHP scripts will be server.
  16. open_basedir = ''path" , set a base directory to which all file operations will be restricted.
  17. file_uploads = on , enable the file uploading feature.
  18. upload_tmp_dir = "path" , temporary directory where files are first uploaded to the server.
  19. upload_max_filesize = #M , maximum Mbytes of the size of the file being uploaded.
  20. extension_dir = "path" , tells the directory in which the loadable extensions (modules) reside. The default, "./", means the extensions are located in the same directory as the executing script.
  21. enable_dl = on, allows to load PHP extension at run time.
  22. extension = "file" , dynamically load a particular module. Make sure that the appropriate software is installed on the operative system.
I hope this summary can we useful.

Mr. Anderson

Sunday, January 6, 2008

Install Apache 2.2 with PHP 5 on Windows Vista

Hello

I spent some hours installing Apache-PHP on Windows vista, and I think it will be helpful to publish the detail instructions.

Suggestion: It is always a good practice, especially if you are a beginner, to make a backup of the configuration files. For example you can follow the pattern: filename-YYDDMMhhmm.ext

Installing Apache HTTP Server (2.2.6)
  1. Download Apache 2 binaries for windows and save it in the desktop - for example. This version has fixed the problems with the Apache Monitor.

  2. If you have any web server, like IIS, or other application using the port 80, stop it before start the installation. Type the following at the prompt for find out if the port 80 is already taken (look for the pattern '%s':80 in the second column), c:\> netstat -ao find /i "listening"

  3. Open the command window with administrator privileges. Go to start > All programs > Accessories. Right-click on Command Prompt and select run as administrator. Note: It is not necessary to stop the User Account Control (UAC).

  4. Run the setup from the command window just opened. Browse to the directory where you save apache, c:\users\user-name\desktop in this case, and type in the command prompt, c:\users\user-name\desktop> msiexec /i apache_2.2.6-win32-x86-no_ssl.msi

  5. Install Apache in its default location, C:\Program Files\Apache Software Foundation\Apache2.2 , or choose one appropriate for you.

  6. When the wizard ask you for the domain, server name, and administrator email write the appropriate values if you are installing a production server, otherwise write the values suggested between parenthesis ().

  7. Choose the default server on port 80 for all users option.

  8. When the install finishes you can try http://localhost/ in the web browser and it should show you "It works". :)

  9. For stop, start, and restart Apache HTTP Server, go to Start > All programs > Apache HTTP Server 2.2.6 > Control Apache Server, and right-click on the desire option and select run as administrator.

  10. Troubleshooting: The log file of install and general errors is located on the folder C:\Program Files\Apache Software Foundation\Apache2.2\logs. You can also use the option on Start > All programs > Apache HTTP Server 2.26 > Configure Apache Server > Test configuration to see if there is any error on the configuration file of Apache, httpd.conf.

Installing PHP (5.2.5)
  1. Download the windows binaries zip package of php. I tried to use the installer, but I got an error configuring PHP with CGI as well as with module; something like "...Parent: Received restart signal -- Restarting the server....Child 8448: Exit event signaled. Child process is ending" in the error.log file. So we proceed with a manual installation. Anyway, manual installation is always recommended because there is more things to learn :).

  2. Unzipped the files in c:\php. A location without spaces is preferred. (You could read the install.txt file for further information about it).

  3. Copy the file php.ini-recommended to a new file named php.ini

  4. Go to start and right-click on computer and click on properties. In the new opened window, click on Advanced system settings, on the left panel, and the System properties window will be opened. Select the tab advanced, and click on Environment variables button. In the system variables panel, look for the Path variable and click in the Edit button. Add at the end of the Path environment variable, the path were PHP is installed, ...;C:\php\ . This indicates the path of the file php5ts.dll, the main dll of PHP.

  5. Open the notepad or your favorite text editor with administrator privileges and open the httpd.conf located in C:\Program Files\Apache Software Foundation\Apache2.2\conf. Append the following lines to the file httpd.conf at the end, to configure PHP as a module.
    PHPIniDir "C:/php/"
    LoadModule php5_module "c:/php/php5apache2_2.dll"
    AddType application/x-httpd-php .php

  6. Restart apache. Go to Start > All programs > Apache HTTP Server 2.2.6 > Control Apache Server, and right-click on the restart option and select run as administrator.

  7. Do the following for test the Apache-PHP integration. Create a file called test.php in the folder C:\Program Files\Apache Software Foundation\Apache2.2\htdocs with he content: <?php phpinfo(); ?>

  8. Open the web browser and go to http://localhost/test.php. You should see general information about the current state of the PHP installed.

Next, I will publish general additional settings that I commonly use to personalize the developing environment.

Good luck

Mr. Anderson