Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chap 2 – Getting Started COMP268-800YL Professor Mattos.

Similar presentations


Presentation on theme: "Chap 2 – Getting Started COMP268-800YL Professor Mattos."— Presentation transcript:

1 Chap 2 – Getting Started COMP268-800YL Professor Mattos

2 Installing Apache & PHP Appendix E gives you all details you will need to install both Apache HTTP Server and PHP Module You should prepare the environment that will allow you to do your homework.

3 Life Cycle of a Web Page (1/2) - Browser makes a request for a document in a Web site. Request is transmitted through HTTP. - Web Server accepts the request. Static HTML files are returned immediately. - In a request for a Dynamic file, Web Server turn over the request to an appropriate helper application.

4 Life Cycle of a Web Page (2/2) PHP is a module that resides within the Web Server. The Web Server opens the script and pass any PHP instruction to the PHP Module for processing and waits for the answer. If there is any MySQL statements, then PHP makes further requests to the database to retrive, send or update information.

5 PHP Script opening tag ?> -> closing tag PHP instructions are contained within the above two HTML style tags. You need to use a text editor in order to create PHP files.

6 PHP statements must be terminated with semicolon (exception: last line of the script) Other accepted tags are: – (PHP Short Tags) – (ASP-style) – php code (HTML style tags) php script files need to be placed under the server’s document root.

7 Strings All string must be enclosed in a pair of quotes. To join two strings together, use the concatenation operator, a dot. If you need to print a quote, precede it with a backslash or enclose it with the other quote’s type.

8 PHP and HTML They are two different languages. You cannot mix HTML tags directly in a PHP block or vice-versa.

9 Statements, Whitespace, Line Breaks PHP is a free form language. Whitespace refers to space, tab and new lines.

10 Comments Plain English text to explain what is going on. Ignored by PHP Interpreter Single-line comment starts with a hash (#) or double slashes (//). Multiple line comments can be written inside /* comments */ as in C style.

11 Using PHP functions Built-in Functions -> http://www.php.net/quickref.php http://www.php.net/quickref.php Function names are not case-sensitive.

12 PHP on the command line You can execute php scripts at the command line. It might be helpful for testing and debugging. Specify the path for the php.exe, use the –f switch and the name of your script PHP Interactively -> allows you to write PHP on the fly.

13 PHP.ini If changing the default settings, you need to reinitialize the web server.


Download ppt "Chap 2 – Getting Started COMP268-800YL Professor Mattos."

Similar presentations


Ads by Google