Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

Published in: Technology
  • Be the first to comment


  1. 1. P HP: H ypertext P reprocessor
  2. 2. PHP PHP stands for P HP: H ypertext P reprocessor <ul><ul><li>PHP is a server-side scripting language, like ASP
  3. 3. PHP scripts are executed on the server
  4. 4. It is free to download and use
  5. 5. It is an open source software </li></ul></ul>
  6. 6. <ul><ul><li>It supports many databases
  7. 7. MySQL,
  8. 8. Informix,
  9. 9. Oracle,
  10. 10. Sybase,
  11. 11. Solid,
  12. 12. PostgreSQL and Generic ODBC, etc. </li></ul></ul>
  13. 13. ADVANTAGES <ul><ul><li>Open Source, readily available and dual-licensed
  14. 14. Very Easy to understand Syntax
  15. 15. Interfaces very easily with Apache/MySQL
  16. 16. Pretty easy to access other web-based tools through PHP (i.e. google maps, etc.)
  17. 17. It's available with documentation in many languages </li></ul></ul>
  18. 18. Disadvantages <ul><ul><ul><li>PHP tends to execute more slowly than assembly, C, and other compiled languages.
  19. 19. PHP is loosely typed.
  20. 20. Web programming is open to security flaws due to unimplemented or unknown vulnerabilities, takes a bit more caution. </li></ul></ul></ul>
  21. 21. How PHP Works? When a user navigates her browser to a page that ends with a .php extension, the request is sent to a web server, which directs the request to the PHP interpreter. The PHP interpreter processes the page, communicating with file systems, databases, and email servers as necessary, and then delivers a web page to the web server to return to the browser.
  22. 22. PHP FILES <ul><li>PHP files can contain text, HTML tags and scripts.
  23. 23. PHP files are returned to the browser as plain HTML. 
  24. 24. PHP files have a file extension of &quot;.php&quot;, &quot;.php3&quot;, or &quot;.phtml&quot;
  25. 25. PHP code is executed on the server, and the plain HTML result is sent to the browser.
  26. 26. A PHP file contains HTML tags and some PHP scripting code. </li></ul>
  27. 27. Basic PHP Syntax <ul><ul><li>A PHP scripting block always starts with </li></ul><li><?php and ends with ?>. </li><ul><li>A PHP scripting block can be placed anywhere in the document. </li></ul></ul>
  28. 28. <ul><ul><li>On servers with shorthand support enabled us to start a scripting block with </li></ul><li><? and end with ?>
  29. 29. For maximum compatibility, it is recommended that to use the standard form ( <?php ) rather than the shorthand form. </li></ul>
  30. 30. <ul><ul><li>Basic Rules:
  31. 31. Each code line in PHP must end with a semicolon .
  32. 32. The semicolon is a separator and is used to distinguish one set of instructions from another.
  33. 33. There are two basic statements to output text with PHP:
  34. 34. In the eg we have used the echo statement to output the text &quot;Hello World&quot;.
  35. 35. Note: The file must have a .php extension. If the file has a .html extension , the PHP code will not be executed. </li></ul></ul>echo and print
  36. 36. Comments in PHP: In PHP, we use // to make a single-line comment or /* and */ to make a large comment block. <html><body> <?php -> Single-line Comment -> Large Comment ?> </body></html> //This is a comment /* This is a comment block */
  37. 37. VARIABLES IN PHP <ul>* Variables are used for storing information values, like text strings, numbers or arrays. <ul>* When a variable is declared, it can be used over and over again in your script. * All variables in PHP start with a $ sign symbol. </ul></ul>
  38. 38. The correct way of declaring a variable in PHP : $var_name = value; EG: Creating a variable containing a string, and a variable containing a number: <?php $txt=&quot;Hello World!&quot;; $x=16; ?>
  39. 39. PHP . ini <ul><li>PHP.ini is very useful and it is a configuration file that is used to customize behavior of PHP at runtime.
  40. 40. This enables easy administration in the way that administer Apache web server using configuration files. </li></ul>
  41. 41. The Settings in which upload directory, register global variables, display errors, log errors, max uploading size setting, maximum time to execute a script and other configurations is written in this file. When PHP Server starts up it looks for PHP.ini file first to load various values for settings.
  42. 42. <ul><ul><li>The configuration file (php.ini) is read when PHP starts up.
  43. 43. php.ini file controls many aspects of PHP's behavior.
  44. 44. In order for PHP to read it, it must be named 'php.ini'.
  45. 45. PHP looks for it in the current working directory, in the path designated by the environment variable.
  46. 46. The php.ini directives allows us to set configure our PHP setup. </li></ul></ul>
  47. 47. The parse_ini_file() function parses a configuration (ini) file and returns the settings in it in an array. Syntax: parse_ini_file(file,process_sections) file Required. Specifies the ini file to check process_sections Optional. If set to TRUE, it returns is a multidimensional array with section names and settings included. Default is FALSE
  48. 48. This function can be used to read in your own application's configuration files, and has nothing to do with the php.ini file. The following reserved words must not be used as keys for ini files: null, yes, no, true, and false. There are also some reserved characters that must not be used in the keys: {}|&~![()&quot;.
  49. 49. Contents of &quot;test.ini&quot;: [names] me = Robert you = Peter [urls] first = &quot;; second = &quot;;
  50. 50. PHP code: <?php print_r(parse_ini_file(&quot;test.ini&quot;)); ?> The output of the code above will be: ( [me] => Robert [you] => Peter [first] => [second] => )
  51. 51. Thank You