SlideShare a Scribd company logo
1 of 5
PROGRAMMING, DATABASES AND THE WEB
                              WITH
                       HTML, PHP & MySQL



                                                 C Neil Bauers


                                      East Norfolk Sixth Form College


Abstract

This paper describes how East Norfolk Sixth Form College brought its BTEC National Diploma for IT Practitioners
into the Internet age by introducing a range of free software tools. The tools were selected for near zero cost, both for
the college and for students. Cross platform compatibility was another requirement. The combination of Linux,
Apache, MySQL and PHP was selected as the best compromise for cost, compatibility and usability. These choices
have had a significant influence on the teaching of the Website, Programming and Database units in our BTEC ITP
programme.


Introduction

The Internet already reaches about 10% of the world population. A further tenfold growth can be expected. The
number of Internet users is growing fast but with the introduction of ADSL, cable and other broadband options, the
bandwidth available to these users is growing too. This makes it possible for home and small business users to run
their own servers. These servers can provide any Internet service including mail, web page serving, file transfers,
bulletin boards, chat and game servers. In Norfolk (UK), there is an exponential growth in the number of BTEC
students who are running their own servers. Our BTEC programme aims to give our students a really useful set of
skills for their progression into employment. These skills are not limited to home servers. Internet service providers
support the same set of facilities with greater bandwidth and reliability but at a higher cost.


Computers in School, College and at Home

There are a number of landmark dates.

     •     1976 - First school computer
     •     1984 - First school computer room
     •     1988 - First school network
     •     1992 - Internet available on the network
     •     1995 - Most students had a computer
     •     2000 - Most students had the Internet
     •     2004 - Exponential growth in students with server technology
     •     2007 - Most computing students are likely to have server technology?


Updating the BTEC Programmes

There is likely to be a shift and growth in the way small businesses use the web. This is possible because of low cost,
high bandwidth Internet connections and through the availability of employees able to exploit these facilities.

Students need relevant skills. There is a perceived need to make the ITP programme much more Internet centred
through the use of Internet tools and services.

This process is based on existing BTEC units and content but the assignments have been updated and new
business scenarios introduced, to encourage web-based solutions to problems.


Resources

Schools and colleges never have unlimited resources. If a good solution is available at low cost it must at least be
investigated.

To provide the services described in this paper a server is needed. This can be a simple PC with 256 MB of RAM. All
the software is free.
It is possible to run Windows with Internet Information Services (IIS). For easier administration, Linux was chosen.
Colleges will need good co-operation from their IT support people. East Norfolk Sixth Form College has been running
web servers administered by teaching staff for student use for three years without incident and the students have
benefited greatly. The servers are restricted to the Intranet so there are no worries over security or real-world
complaints about inappropriate or copyright material being used. Any problems can be dealt with internally.


Server Software

At the time of writing students had the following configurations.

     •    Linux + Apache web server + PHP + MySQL (Recommended for easy administration)
     •    Free BSD + Apache web server + PHP + MySQL
     •    Windows XP Home + Apache web server + PHP + MySQL
     •    Windows XP Pro’ + IIS or Apache + PHP + MySQL
     •    Windows 2000 Pro’ + IIS or Apache + PHP + MySQL
     •    Windows 98 + Personal Web Server (PWS, rather limited - not recommended)


Other Software

     •    HTML       for web page authoring
     •    PHP        for scripts that run on the server
     •    MySQL      for command line and web-accessible databases



Learning Curves

Here is a useful Google search string " LAMP Linux Apache php mysql". There are many tutorials and how-to sites.

L         Linux
A         Apache
M         MySQL
P         PHP

It has taken about three years to introduce changes to the BTEC programmes and further changes are still being
made including the gradual introduction of XML.

The first and simplest programme update was the use of HTML on a real web server.

In year two, PHP programming and server side scripting were introduced.

In year three students, started using the MySQL RDBMS server. At present, most of the work is done using a
command line interface and only the simplest web links are being made to this server. Students still prefer MS
Access for database projects but this may change in the next year or two.


Implementing Change

When the BTEC Website units were introduced, no web server was available at our college and all the student work
was disk based. One of the requirements of the specification was to create "dynamic" pages. This was fudged this by
using JavaScript embedded in the web pages. Truly dynamic pages should use code running on a web server so a
so a server based solution was needed.

Students have enormous brainpower, research capability, enthusiasm and time and there are always a few who are
ahead of their teachers in specific areas, Linux is easy to install and configure with help from a 'guru'. A student came
to the rescue. Within a couple of days a Linux box with users, FTP uploading and Web Server was up and running.
(Thank you Mark Cullen!)

This solution was not perfect but it was useable with computing students. They could create and upload web pages
to a real server.

The first implementation required students to log into the Linux box and alter their file permissions to make them work
with the Apache web server. This is a useful skill for specialists but it made the server too hard to use with beginners
and students on media courses. This was later fixed by upgrading the FTP software (vsftpd). Now, even Media
students use this resource.


Choosing a Scripting Language

The choices were JavaScript for Java Server Pages, VBScript with Active Server Pages or PHP. Pascal Server
Pages (PSP) do exist but these lack many of the features available in PHP such as Database access and Graphics
Generation on the server.
PHP was chosen because
    •   it is free
    •   it is fairly easy to learn
    •   it runs on Windows and Linux
    •   it is possible to write traditional command line programs in PHP
    •   PHP can be used for the BTEC Introduction to Software Development unit
    •   PHP is designed to run inside web pages on a server so it can be used with the BTEC Website units
    •   PHP syntax is very similar to the C and Java family of languages. Transferable skills.
    •   PHP closely resembles Macromedia Flash Action Script. Flash can be used for Multimedia and Visual
        Programming Internet applications, potentially covering two more BTEC units.

VBScript, Java and PSP don't have this set of advantages.

PHP is not strongly typed. This is its chief disadvantage and programming purists might reject it on these grounds
alone. It is necessary and possible to teach variable declarations and data types from a different angle. Indeed a
good awareness of data types is needed to make PHP behave correctly.


Learning How to Program in PHP

PHP programs can be run from the command line. If the network restricts access to the command line, it is possible
to launch the PHP interpreter from a batch file. A simple example program is listed below.

PHP is easy to learn. There are many web examples and tutorials and the PHP documentation contains useful
examples too. PHP is a little odd in that all variables begin with a $ sign so variables are named like $foo. At the end
of this document, there is a link to a collection of PHP example programs of the type needed for the Introduction to
Software Development BTEC unit.

<?php

// -----------------------------------------------------------------

function readline()
{
  $fp = fopen("php://stdin", "r");
  $in = fgets($fp, 4094);                            // Maximum windows buffer size
  fclose ($fp);

    return $in;
}

// -----------------------------------------------------------------

// INPUT
echo "nnPlease enter a number ... ";
$N1 = readline();

echo "nnPlease enter a number ... ";
$N2 = readline();

// PROCESS
$output = $N1 + $N2;

// OUTPUT
echo "nnThe answer is $output.nnn";
?>




Learning How to Make Web Pages Dynamic

Once again our student guru was consulted. There are many examples and tutorials on the Web. PHP was running
by default on the Linux server so there were no set up difficulties. It was simply necessary to embed PHP code into a
web page. Here is a simple example.

<!-- hello.php -->

<html>

<head>
<title>Hello World</title>
</head>
<body>

<?php
  // PHP pages won't work if you just load them straight
  // into a web browser from your local disk. The PHP
  // code must be interpreted by the PHP Pre-processor
  // running on the web server. Name the web page with
  // a .php file extension.

  echo "<h1>Hello World!</h1>n";
?>

</body>
</html>


Linking to Databases

PHP links to the MySQL relational database easily. There is quite a lot to learn before MySQL could be used as the
main RDBMS for student use. We have started down this path. Here is a simple SELECT query that returns a
database column into an array ($result).

                     <?php
                        $result =
                          mysql_query("SELECT my_col FROM my_tbl")
                          or die("Invalid query: " . mysql_error());
                     ?>

Configuration Files

These are tricky to get right.

Two files need to be edited. On Suse 8.1 they are located in ...

           /etc/httpd/httpd.conf                              Apache web server
           /etc/vsftpd.conf                                   Vsftpd FTP server

The SuSE 9.1 files are
        /etc/apache2/default-server.conf                      Apache web server
        /etc/vsftpd.conf                                      Vsftpd FTP server

These files are documented on http://www.softwareforeducation.com/lamp/
The non-default settings are highlighted.

MySQL and PHP work with default settings.

Conclusion

Why should a college go down the LAMP route? In a world of unlimited funding, every student could be equipped
with Microsoft SQL Server and all the related tools. The LAMP route is available at almost zero cost. The learning
and skills are valuable in their own right and are transferable to other platforms. Up to 60% of servers run Apache
and many also use the PHP and MySQL combination.

Acknowledgements

The open source community has made all this possible.

Linux        SUSE Linux Distribution     http://www.suse.co.uk/uk/index.html
Unix         Free BSD                    http://www.freebsd.org/
Web Server   Apache Project              http://httpd.apache.org/
FTP          VSFTPD                      http://vsftpd.beasts.org/          Newer version is better
SSH          PuTTY                       http://www.chiark.greenend.org.uk/~sgtatham/putty/
Scripting    PHP                         http://www.php.net/downloads.php
Database     MySQL                       http://www.mysql.com/

Tutorial     W3Schools                   http://www.w3schools.com/           Excellent tutorials
Tutorial     SQL Zoo                     http://sqlzoo.net/                  Useful SQL resources

Guru         Mark Cullen                 An enthusiastic student at East Norfolk Sixth Form College who helped to
                                         get this project started.

References

Book:                      Teach Yourself PHP, MySQL and Apache in 24 Hours
Author:                    Julie C. Meloni
Paperback 500 pages:       January 31, 2004
Publisher:            Sams
ISBN:                 0672326205
Edition:              Paperback
Amazon price:         £15.39


Address of Author

EMail:                    nbauers@samphire.demon.co.uk

Author's Web Resources:   http://www.SoftwareForEducation.com/
                          http://samphire.demon.co.uk/

More Related Content

What's hot (6)

Drupal
DrupalDrupal
Drupal
 
2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real
 
WordPress Manual in Compatible with XAMPP
WordPress Manual in Compatible with XAMPPWordPress Manual in Compatible with XAMPP
WordPress Manual in Compatible with XAMPP
 
Joomla Manual in Compatible with XAMPP
Joomla Manual in Compatible with XAMPPJoomla Manual in Compatible with XAMPP
Joomla Manual in Compatible with XAMPP
 
Php unit i
Php unit i Php unit i
Php unit i
 
WordPress Complete Manual in XAMPP
WordPress Complete Manual in XAMPPWordPress Complete Manual in XAMPP
WordPress Complete Manual in XAMPP
 

Viewers also liked

Do or Do Not Plan There Is.
Do or Do Not Plan There Is.Do or Do Not Plan There Is.
Do or Do Not Plan There Is.Jonathan Hartley
 
Inriktningsmål för hållbarhet
Inriktningsmål för hållbarhetInriktningsmål för hållbarhet
Inriktningsmål för hållbarhetPierre Ringborg
 
Materials design presentation 01 (2)
Materials design presentation 01 (2)Materials design presentation 01 (2)
Materials design presentation 01 (2)Brenda Westtesten
 
Spirit of football deck
Spirit of football deckSpirit of football deck
Spirit of football deckdanwood9
 
Jhovanni guia 10 (1)
Jhovanni guia 10 (1)Jhovanni guia 10 (1)
Jhovanni guia 10 (1)jhovannito22
 
Alternative cigarettes for Tobacco Smokers
Alternative cigarettes for Tobacco SmokersAlternative cigarettes for Tobacco Smokers
Alternative cigarettes for Tobacco Smokerspurecigs
 
Årsredovisning 2013 Varbergs Kommun
Årsredovisning 2013 Varbergs KommunÅrsredovisning 2013 Varbergs Kommun
Årsredovisning 2013 Varbergs KommunPierre Ringborg
 
Pacific Islands Programs fo Exploring Science (PIPES)
Pacific Islands Programs fo Exploring Science (PIPES)Pacific Islands Programs fo Exploring Science (PIPES)
Pacific Islands Programs fo Exploring Science (PIPES)HEEA_administrator
 
Episodio 1 en_búsqueda_de_las_tic
Episodio 1 en_búsqueda_de_las_ticEpisodio 1 en_búsqueda_de_las_tic
Episodio 1 en_búsqueda_de_las_ticNataly Falla
 
How to Design For Mobile: 10 Easy Steps You Can Do Now
How to Design For Mobile: 10 Easy Steps You Can Do NowHow to Design For Mobile: 10 Easy Steps You Can Do Now
How to Design For Mobile: 10 Easy Steps You Can Do NowMatomy Media Group
 
Pacesetter Exclusive Event - November 6, 2014
Pacesetter Exclusive Event - November 6, 2014 Pacesetter Exclusive Event - November 6, 2014
Pacesetter Exclusive Event - November 6, 2014 caseypereira
 

Viewers also liked (16)

Do or Do Not Plan There Is.
Do or Do Not Plan There Is.Do or Do Not Plan There Is.
Do or Do Not Plan There Is.
 
Inriktningsmål för hållbarhet
Inriktningsmål för hållbarhetInriktningsmål för hållbarhet
Inriktningsmål för hållbarhet
 
Materials design presentation 01 (2)
Materials design presentation 01 (2)Materials design presentation 01 (2)
Materials design presentation 01 (2)
 
Spirit of football deck
Spirit of football deckSpirit of football deck
Spirit of football deck
 
Jhovanni guia 10 (1)
Jhovanni guia 10 (1)Jhovanni guia 10 (1)
Jhovanni guia 10 (1)
 
Autism in children
Autism in childrenAutism in children
Autism in children
 
Alternative cigarettes for Tobacco Smokers
Alternative cigarettes for Tobacco SmokersAlternative cigarettes for Tobacco Smokers
Alternative cigarettes for Tobacco Smokers
 
Valu inlaga 1991-2010
Valu inlaga 1991-2010Valu inlaga 1991-2010
Valu inlaga 1991-2010
 
Årsredovisning 2013 Varbergs Kommun
Årsredovisning 2013 Varbergs KommunÅrsredovisning 2013 Varbergs Kommun
Årsredovisning 2013 Varbergs Kommun
 
Mars
MarsMars
Mars
 
rrr
rrrrrr
rrr
 
Pacific Islands Programs fo Exploring Science (PIPES)
Pacific Islands Programs fo Exploring Science (PIPES)Pacific Islands Programs fo Exploring Science (PIPES)
Pacific Islands Programs fo Exploring Science (PIPES)
 
Episodio 1 en_búsqueda_de_las_tic
Episodio 1 en_búsqueda_de_las_ticEpisodio 1 en_búsqueda_de_las_tic
Episodio 1 en_búsqueda_de_las_tic
 
How to Design For Mobile: 10 Easy Steps You Can Do Now
How to Design For Mobile: 10 Easy Steps You Can Do NowHow to Design For Mobile: 10 Easy Steps You Can Do Now
How to Design For Mobile: 10 Easy Steps You Can Do Now
 
Privacy Policy
Privacy PolicyPrivacy Policy
Privacy Policy
 
Pacesetter Exclusive Event - November 6, 2014
Pacesetter Exclusive Event - November 6, 2014 Pacesetter Exclusive Event - November 6, 2014
Pacesetter Exclusive Event - November 6, 2014
 

Similar to Prog db-and-web-with-html-php-and-my sql

Similar to Prog db-and-web-with-html-php-and-my sql (20)

Php verses .net
Php verses .netPhp verses .net
Php verses .net
 
Food borne human diseases
Food borne human diseasesFood borne human diseases
Food borne human diseases
 
Pro lab synopsis (body)
Pro lab synopsis (body)Pro lab synopsis (body)
Pro lab synopsis (body)
 
Introduction to Web Frameworks
Introduction to Web FrameworksIntroduction to Web Frameworks
Introduction to Web Frameworks
 
test4
test4test4
test4
 
Web
WebWeb
Web
 
test4
test4test4
test4
 
test3
test3test3
test3
 
TECHNOLOGY FOR BACK-END WEB DEVELOPMENT: SERVER-SIDE SCRIPTING
TECHNOLOGY FOR BACK-END WEB DEVELOPMENT: SERVER-SIDE SCRIPTING TECHNOLOGY FOR BACK-END WEB DEVELOPMENT: SERVER-SIDE SCRIPTING
TECHNOLOGY FOR BACK-END WEB DEVELOPMENT: SERVER-SIDE SCRIPTING
 
Lecture1 introduction by okello erick
Lecture1 introduction by okello erickLecture1 introduction by okello erick
Lecture1 introduction by okello erick
 
PPT - A slice of cake php
PPT - A slice of cake phpPPT - A slice of cake php
PPT - A slice of cake php
 
Simple Web Services with PHP
Simple Web Services with PHPSimple Web Services with PHP
Simple Web Services with PHP
 
Documentation of Online jobs for BCA last sem on PHP.
Documentation of Online jobs for BCA last sem on PHP.Documentation of Online jobs for BCA last sem on PHP.
Documentation of Online jobs for BCA last sem on PHP.
 
lamp.pptx
lamp.pptxlamp.pptx
lamp.pptx
 
Lamp technology
Lamp technologyLamp technology
Lamp technology
 
Online Fitness Gym Documentation
Online Fitness Gym Documentation Online Fitness Gym Documentation
Online Fitness Gym Documentation
 
Aspnet2.0 Introduction
Aspnet2.0 IntroductionAspnet2.0 Introduction
Aspnet2.0 Introduction
 
E commerce p1 edit
E commerce p1 editE commerce p1 edit
E commerce p1 edit
 
lamp-technology-8860-9KNDvBR.pptx
lamp-technology-8860-9KNDvBR.pptxlamp-technology-8860-9KNDvBR.pptx
lamp-technology-8860-9KNDvBR.pptx
 
Know about cake php framework with vertexplus
Know about  cake php framework with vertexplusKnow about  cake php framework with vertexplus
Know about cake php framework with vertexplus
 

Prog db-and-web-with-html-php-and-my sql

  • 1. PROGRAMMING, DATABASES AND THE WEB WITH HTML, PHP & MySQL C Neil Bauers East Norfolk Sixth Form College Abstract This paper describes how East Norfolk Sixth Form College brought its BTEC National Diploma for IT Practitioners into the Internet age by introducing a range of free software tools. The tools were selected for near zero cost, both for the college and for students. Cross platform compatibility was another requirement. The combination of Linux, Apache, MySQL and PHP was selected as the best compromise for cost, compatibility and usability. These choices have had a significant influence on the teaching of the Website, Programming and Database units in our BTEC ITP programme. Introduction The Internet already reaches about 10% of the world population. A further tenfold growth can be expected. The number of Internet users is growing fast but with the introduction of ADSL, cable and other broadband options, the bandwidth available to these users is growing too. This makes it possible for home and small business users to run their own servers. These servers can provide any Internet service including mail, web page serving, file transfers, bulletin boards, chat and game servers. In Norfolk (UK), there is an exponential growth in the number of BTEC students who are running their own servers. Our BTEC programme aims to give our students a really useful set of skills for their progression into employment. These skills are not limited to home servers. Internet service providers support the same set of facilities with greater bandwidth and reliability but at a higher cost. Computers in School, College and at Home There are a number of landmark dates. • 1976 - First school computer • 1984 - First school computer room • 1988 - First school network • 1992 - Internet available on the network • 1995 - Most students had a computer • 2000 - Most students had the Internet • 2004 - Exponential growth in students with server technology • 2007 - Most computing students are likely to have server technology? Updating the BTEC Programmes There is likely to be a shift and growth in the way small businesses use the web. This is possible because of low cost, high bandwidth Internet connections and through the availability of employees able to exploit these facilities. Students need relevant skills. There is a perceived need to make the ITP programme much more Internet centred through the use of Internet tools and services. This process is based on existing BTEC units and content but the assignments have been updated and new business scenarios introduced, to encourage web-based solutions to problems. Resources Schools and colleges never have unlimited resources. If a good solution is available at low cost it must at least be investigated. To provide the services described in this paper a server is needed. This can be a simple PC with 256 MB of RAM. All the software is free.
  • 2. It is possible to run Windows with Internet Information Services (IIS). For easier administration, Linux was chosen. Colleges will need good co-operation from their IT support people. East Norfolk Sixth Form College has been running web servers administered by teaching staff for student use for three years without incident and the students have benefited greatly. The servers are restricted to the Intranet so there are no worries over security or real-world complaints about inappropriate or copyright material being used. Any problems can be dealt with internally. Server Software At the time of writing students had the following configurations. • Linux + Apache web server + PHP + MySQL (Recommended for easy administration) • Free BSD + Apache web server + PHP + MySQL • Windows XP Home + Apache web server + PHP + MySQL • Windows XP Pro’ + IIS or Apache + PHP + MySQL • Windows 2000 Pro’ + IIS or Apache + PHP + MySQL • Windows 98 + Personal Web Server (PWS, rather limited - not recommended) Other Software • HTML for web page authoring • PHP for scripts that run on the server • MySQL for command line and web-accessible databases Learning Curves Here is a useful Google search string " LAMP Linux Apache php mysql". There are many tutorials and how-to sites. L Linux A Apache M MySQL P PHP It has taken about three years to introduce changes to the BTEC programmes and further changes are still being made including the gradual introduction of XML. The first and simplest programme update was the use of HTML on a real web server. In year two, PHP programming and server side scripting were introduced. In year three students, started using the MySQL RDBMS server. At present, most of the work is done using a command line interface and only the simplest web links are being made to this server. Students still prefer MS Access for database projects but this may change in the next year or two. Implementing Change When the BTEC Website units were introduced, no web server was available at our college and all the student work was disk based. One of the requirements of the specification was to create "dynamic" pages. This was fudged this by using JavaScript embedded in the web pages. Truly dynamic pages should use code running on a web server so a so a server based solution was needed. Students have enormous brainpower, research capability, enthusiasm and time and there are always a few who are ahead of their teachers in specific areas, Linux is easy to install and configure with help from a 'guru'. A student came to the rescue. Within a couple of days a Linux box with users, FTP uploading and Web Server was up and running. (Thank you Mark Cullen!) This solution was not perfect but it was useable with computing students. They could create and upload web pages to a real server. The first implementation required students to log into the Linux box and alter their file permissions to make them work with the Apache web server. This is a useful skill for specialists but it made the server too hard to use with beginners and students on media courses. This was later fixed by upgrading the FTP software (vsftpd). Now, even Media students use this resource. Choosing a Scripting Language The choices were JavaScript for Java Server Pages, VBScript with Active Server Pages or PHP. Pascal Server Pages (PSP) do exist but these lack many of the features available in PHP such as Database access and Graphics Generation on the server.
  • 3. PHP was chosen because • it is free • it is fairly easy to learn • it runs on Windows and Linux • it is possible to write traditional command line programs in PHP • PHP can be used for the BTEC Introduction to Software Development unit • PHP is designed to run inside web pages on a server so it can be used with the BTEC Website units • PHP syntax is very similar to the C and Java family of languages. Transferable skills. • PHP closely resembles Macromedia Flash Action Script. Flash can be used for Multimedia and Visual Programming Internet applications, potentially covering two more BTEC units. VBScript, Java and PSP don't have this set of advantages. PHP is not strongly typed. This is its chief disadvantage and programming purists might reject it on these grounds alone. It is necessary and possible to teach variable declarations and data types from a different angle. Indeed a good awareness of data types is needed to make PHP behave correctly. Learning How to Program in PHP PHP programs can be run from the command line. If the network restricts access to the command line, it is possible to launch the PHP interpreter from a batch file. A simple example program is listed below. PHP is easy to learn. There are many web examples and tutorials and the PHP documentation contains useful examples too. PHP is a little odd in that all variables begin with a $ sign so variables are named like $foo. At the end of this document, there is a link to a collection of PHP example programs of the type needed for the Introduction to Software Development BTEC unit. <?php // ----------------------------------------------------------------- function readline() { $fp = fopen("php://stdin", "r"); $in = fgets($fp, 4094); // Maximum windows buffer size fclose ($fp); return $in; } // ----------------------------------------------------------------- // INPUT echo "nnPlease enter a number ... "; $N1 = readline(); echo "nnPlease enter a number ... "; $N2 = readline(); // PROCESS $output = $N1 + $N2; // OUTPUT echo "nnThe answer is $output.nnn"; ?> Learning How to Make Web Pages Dynamic Once again our student guru was consulted. There are many examples and tutorials on the Web. PHP was running by default on the Linux server so there were no set up difficulties. It was simply necessary to embed PHP code into a web page. Here is a simple example. <!-- hello.php --> <html> <head> <title>Hello World</title> </head>
  • 4. <body> <?php // PHP pages won't work if you just load them straight // into a web browser from your local disk. The PHP // code must be interpreted by the PHP Pre-processor // running on the web server. Name the web page with // a .php file extension. echo "<h1>Hello World!</h1>n"; ?> </body> </html> Linking to Databases PHP links to the MySQL relational database easily. There is quite a lot to learn before MySQL could be used as the main RDBMS for student use. We have started down this path. Here is a simple SELECT query that returns a database column into an array ($result). <?php $result = mysql_query("SELECT my_col FROM my_tbl") or die("Invalid query: " . mysql_error()); ?> Configuration Files These are tricky to get right. Two files need to be edited. On Suse 8.1 they are located in ... /etc/httpd/httpd.conf Apache web server /etc/vsftpd.conf Vsftpd FTP server The SuSE 9.1 files are /etc/apache2/default-server.conf Apache web server /etc/vsftpd.conf Vsftpd FTP server These files are documented on http://www.softwareforeducation.com/lamp/ The non-default settings are highlighted. MySQL and PHP work with default settings. Conclusion Why should a college go down the LAMP route? In a world of unlimited funding, every student could be equipped with Microsoft SQL Server and all the related tools. The LAMP route is available at almost zero cost. The learning and skills are valuable in their own right and are transferable to other platforms. Up to 60% of servers run Apache and many also use the PHP and MySQL combination. Acknowledgements The open source community has made all this possible. Linux SUSE Linux Distribution http://www.suse.co.uk/uk/index.html Unix Free BSD http://www.freebsd.org/ Web Server Apache Project http://httpd.apache.org/ FTP VSFTPD http://vsftpd.beasts.org/ Newer version is better SSH PuTTY http://www.chiark.greenend.org.uk/~sgtatham/putty/ Scripting PHP http://www.php.net/downloads.php Database MySQL http://www.mysql.com/ Tutorial W3Schools http://www.w3schools.com/ Excellent tutorials Tutorial SQL Zoo http://sqlzoo.net/ Useful SQL resources Guru Mark Cullen An enthusiastic student at East Norfolk Sixth Form College who helped to get this project started. References Book: Teach Yourself PHP, MySQL and Apache in 24 Hours Author: Julie C. Meloni Paperback 500 pages: January 31, 2004
  • 5. Publisher: Sams ISBN: 0672326205 Edition: Paperback Amazon price: £15.39 Address of Author EMail: nbauers@samphire.demon.co.uk Author's Web Resources: http://www.SoftwareForEducation.com/ http://samphire.demon.co.uk/