Home Business IT Open Source Vamp the Linux LAMP with PHP

One key driver of free and open source software is the LAMP paradigm – cleverly named after the systems it embraces – Linux, Apache, MySQL and PHP. This powerful combination delivers high powered data-enabled web and intranet sites with a minimum of fuss. Here’s how to get started with PHP.

PHP is a web scripting language (akin to Microsoft’s Active Server Pages or Adobe’s ColdFusion.) Originally, it began as a humble collection of Perl scripts designed to ease the creation of popular web addons like guest books and message boards, PHP meaning simply “Personal Home Page.”

PHP is now in its 5th version and has received massive reworking and updates since its unpretentious beginnings, becoming a solid platform for building web sites at all levels. It provides basic interactive features through to dynamic enterprise applications. PHP is the most obvious starting point for learning how to work with the LAMP environment because it is the most visible component. PHP pages make up the user interface that people will interact with (whereas Linux and Apache provide the underlying engine, and MySQL gives database storage.)

Even if you do not actually run a Linux environment yourself, chances are your web host gives you PHP (and MySQL) for free. This is true of paid web hosts as well as any complimentary free web space that your ISP gives.

In fact, it’s well worth getting familiar with the basics of PHP just to enhance your own personal web page. It’s also worthwhile so you can debug or at least make sense of PHP pages you encounter. You’ll find it dead easy even if you’ve never programmed before.

Entering PHP mode
PHP code is interspersed with standard HTML tags. The web server – Apache, mostly, but PHP pre-processors can be added to IIS and other servers – receives a request from a web browser as usual. It picks up the PHP page and executes the programming commands inside, rendering any generated output along with the HTML tags. This final output is returned to the web browser, giving the illusion of an ordinary, static web page despite the fact it was generated right on the fly by the server.

The pre-processor fires when the web page suffix is .php instead of the regular .html (or .htm). It then looks inside the file for special tags which indicate where literal HTML output stops and PHP code begins. There are four possible tags that can be used, all achieving the same purpose:

<script language=”php”

When the pre-processor encounters one of these tags, it stops recognising text as HTML to be returned as-is and instead sees it as program code to execute. This continues until a closing tag is found, at which point the pre-processor just emits subsequent text as straight HTML again.

The closing tag must match the opening tag; use ?> for either of the first two options above, %> to close <% and </script> to match <script language=”php”>.

A variable is a data item that can have a value assigned to it. Over the course of the program you may alter this value and use it for display or in calculations.

Some languages are strict about how variables are used. If you specify it has integer values only you can’t then store a decimal number or a text string in it. PHP is different, and this is one of the reasons it is generally considered a fast language to work in. In PHP, a variable begins with a dollar sign ($) and that’s it; you do not explicitly state any restriction on the data it can hold. Instead, PHP will work out the data stored by how it is used and what’s more, it’ll go out of its way to help you work with different types of data.

Let’s put these together to make a real working PHP page.

WEBINAR 26/27th May

Thinking of deploying Business Intelligence (BI)? So are your competitors.

And the most important, fundamental, tool for delivering your BI information to your users? Dashboards.




VMware changed the rules about the server resources required to keep a database responding

It's now more difficult for DBAs to see interaction between the database and server resources

This whitepaper highlights the key differences between performance management between physical and virtual servers, and maps out the five most common trouble spots when moving production databases to VMware

1. Innacurate metrics
2. Dynamic resource allocation
3. No control over Host Resources
4. Limited DBA visibility
5. Mutual ignorance

Don't move your database to VMware before learning about these potential risks, download this FREE Whitepaper now!


David M Williams

joomla site stats

David has been computing since 1984 where he instantly gravitated to the family Commodore 64. He completed a Bachelor of Computer Science degree from 1990 to 1992, commencing full-time employment as a systems analyst at the end of that year. Within two years, he returned to his alma mater, the University of Newcastle, as a UNIX systems manager. This was a crucial time for UNIX at the University with the advent of the World-Wide-Web and the decline of VMS. David moved on to a brief stint in consulting, before returning to the University as IT Manager in 1998. In 2001, he joined an international software company as Asia-Pacific troubleshooter, specialising in AIX, HP/UX, Solaris and database systems. Settling down in Newcastle, David then found niche roles delivering hard-core tech to the recruitment industry and presently is the Chief Information Officer for a national resources company where he particularly specialises in mergers and acquisitions and enterprise applications.






Join the iTWire Community and be part of the latest news, invites to exclusive events, whitepapers and educational materials and oppertunities.
Why do I want to receive this daily update?
  • The latest features from iTWire
  • Free whitepaper downloads
  • Industry opportunities