part 2 introduction to dynamic web content and php

15
PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

Upload: franklin-jones

Post on 19-Jan-2016

218 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

PART 2

INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

Page 2: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

LECTURE 1

SETTING UP THE DEVELOPMENT SERVER

Page 3: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

Required ToolsThe tools we will be needing are a development server and a wide range of browsers. At the minimum, you should have the following browsers.Firefox , Safari, Internet Explorer, Google Chrome and Opera. I will suggest that you download and install the latest version of these browsers. Follow the instructions on the next page to Install WampServer.You can get the setup of wamp server from your course resource page.

Page 4: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Double - Click on your WampServer downloaded setup to start it. You should see the following screen

Page 5: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Click next you should now see the following screen.

Page 6: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Select “I accept the agreement” and click next.• You should now see the screen below.

Page 7: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Choose the location where you want WampServer to be installed by clicking on the browse button and selecting a location of your choice. Always remember the location you choose. You can just type this in the box and then click next.

• You should now see the screen below.

Page 8: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Select create a quick launch icon and create a desktop icon check box as shown above.

• Click next, you should now see the screen below.

Page 9: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Click Install to start your installation.

Page 10: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• During the installation, setup might ask you to choose your default browser, just click open.

• You will get a screen asking you to provide your email and SMTP when using the email function of PHP.

• Leave the SMTP on localhost and type your email address in the email field.

• Then click next. If all goes well, you will get the setup complete screen

• Check the launch WampServer now checkbox and Click finish.

• Now let’s test if all is working properly, • Look on your task bar to see if WampServer has been

launched. If it has been launched, you will see the WampServer icon in color green, if it is in red, click on it and select “start all services” from the menu that appears.

• If you don’t see the WampServer icon on your taskbar, just double-click on the WampServer shortcut on your desktop to launch it.

Page 11: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Open your browser and type “localhost” or “127.0.0.1”• If all is well, you should see a screen like this

Page 12: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

• Localhost is used to specify the local computer; it has the IP address of 127.0.0.1

• If you choose a server port other than 80 during installation (e.g. 8080), then you must place a colon followed by that value after the URL like this localhost: 8080.

Page 13: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

Testing the Development ServerAfter installation, you should have a shortcut to WampServer on your desktop. Double click on it to start it. There should now be a WampServer icon on your task bar, it should be green in color indicating that all services are running. If it is red, click on it and select “start all services” from

the menu that appears. Now click on the WampServer icon again and select “www directory” from the menu that appears. You should find the following files in the directory. Favicon, index and testmysql.TRANSFER YOUR SCHOOL OF PROGRAMMING FOLDER TO THE www directory.

Page 14: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

to open any file in your browser, this is how you do it.Type http://localhost/folder_name/file_name.to open the index page, it will be http://localhost/School of Programming/index.htmlWhen opening a file in the pages folder, it will be http://localhost/School of Programming/pages/

about.htmlAlways refer to your file referencing notes to recall how to refer to files from a different location.

Page 15: PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP

PHP SYNTAXPHP documents ends with the .php extension. It can

be placed anywhere in an html code. It starts with <?php followed by all your php code and ends with ?>. Here is a program that displays hello world on the

page.<? php

Echo “Hello World!”;

?>

Notice that every line of a PHP code must end with a semi-

colon