Monday, July 19, 2010

Lesson number one!

Today i set up my first server.
I did it using xampp program. I will not put a link here, since it is availible for everyone and is actually easy to find. XAMPP is really easy program that was adviced in book Wiley - For Dummies PHP and MySQL Web Development All in One. After you downloaded and installed you have to run xampp control panel and run apache server(i runned both apache and mysql).
So....after you have cleared this you need to
"1. Open httpd.conf for editing.
To open the file, choose Start➪Programs➪Apache HTTPD
Server➪Configure Apache Server➪Edit Configuration.
If Edit Configuration isn’t on your Start menu, find the httpd.conf file
on your hard drive, usually in the directory where Apache is installed,
in a conf subdirectory (for example, c:\program files\Apache
group\Apache\conf). Open this file in a text editor, such as Notepad
or WordPad.
2. Activate the PHP module.
Look for the module statement section in the file and locate the following
line:
#LoadModule php6_module “c:/php/php6apache2.dll”
Remove the # from the beginning of the line to activate the module. If
you’re installing PHP 5, you need the following line:
LoadModule php5_module “c:/php/php5apache2.dll”
If you’re using Apache 1.3, rather than Apache 2, the module name is
php6apache.dll or php5apache.dll.
3. Tell Apache which files are PHP programs.
Look for a section describing AddType. This section might contain one
or more AddType lines for other software. The AddType line for PHP is
AddType application/x-httpd-php .php
Look for this line. If you find it with a pound sign at the beginning of the
line, remove the pound sign. If you don’t find the line, add it to the list
of AddType statements. You can specify any extension or series of
extensions.
This line tells Apache that files with the .php extension are files of the
type application/x-httpd-php. Apache then knows to send files
with .php extensions to the PHP module.
4. Start Apache (if it isn’t running) or restart Apache (if it is running).
You can start it as a service in Windows NT/2000/XP/Vista by choosing
Start➪Programs➪Apache HTTPD Server➪Control Apache Server and
then selecting Start or Restart. You can start it in Windows 98/Me by
choosing Start➪Programs➪Apache Web Server➪Management.
Sometimes restarting Apache isn’t sufficient; you must stop it first and
then start it. In addition, your computer is undoubtedly set up so that
Apache will start whenever the computer starts. Therefore, you can shut
down and then start your computer to restart Apache."
"1. Open the php.ini file for editing.
2. Change the settings you want to change.
Steps 3, 4, and 5 mention some specific settings that you should always
change if you’re using the specified environment.
3. Only if you’re using PHP 5 or earlier, turn off magic quotes.
Look for the following line:
magic_quotes-gpc On
Change On to Off.
4. Only if you’re using PHP 5 or 6 on Windows, activate mysqli or mysql
support.
See instructions in the section “Activating MySQL Support on Windows,”
later in this chapter.
5. Only if you’re using PHP on Windows with the IIS Web server, turn
off force redirect.
Find this line:
;cgi.force_redirect = 1
You need to remove the semicolon so that the setting is active, and also
change the 1 to 0. After the changes, the line looks as follows:
cgi.force_redirect = 0
6. Only if you’re using PHP 5 or later, set your local time zone.
Find the line:
;date.timezone =
Remove the semicolon from the beginning of the line. Add the code for
your local time zone after the equal sign. For instance, the line might be
date.timezone = America/Los_Angeles
You can find a list of time zone codes at www.php.net/manual/en/
timezones.php.
7. Save the php.ini file.
8. Restart your Web server so that the new settings go into effect."
That was taken from the book. Well actually i recommend to download this book or buy it and read whole paragraph about xampp. If you have problems you can write me dorkster100@gmail.com
Now i recommend you to download notepad++ it is also availible for everyone so search for it yourself. It is quite easy task.
Open your notepad++ and you can start typing your code.
< html>
< head>
< /head>
< body>
< ?php
?>
< /body>
< /html>
This is kind of thing that you type in everytime. < html>< /html> are tags that report to computer that between them is code in html. < head> and < body> are tags where you can insert some objects or text using html. Basically HTML is language that allows you to make tables, insert text and insert pictures in to the website. PHP is language that can be used in html, actually it also works without html, but if you are making web, then both php and html are required...also mysql is useful, but it will come later. starts php code.
following code is between tags.
echo"Hello World!";
this is the very first code that i wrote.
echo means output into the website...
so now save what you have written into the htdocs folder which is located in xampp folder. And save it not as a text but as php...that means for example Helloworld.php...when u save it in notepad++ you can choose it when you are saving...
In order to view the results open browser and write
http://localhost/nameofyourfile.php

PS. there is no gap in the beggining < html> < body> < head>

No comments:

Post a Comment