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:

<?php
<?
<%
<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”>.

Variables
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.


FREE WHITEPAPER - REMOTE SUPPORT TRENDS FOR 2015

Does your remote support strategy keep you and your CEO awake at night?

Today’s remote support solutions offer much more than just remote control for PCs. Their functional footprint is expanding to include support for more devices and richer analytics for trend analysis and supervisor dashboards.

It is imperative that service executives acquaint themselves with the new features and capabilities being introduced by leading remote support platforms and find ways to leverage the capabilities beyond technical support.

Field services, education services, professional services, and managed services are all increasing adoption of these tools to boost productivity and avoid on-site visits.

Which product is easiest to deploy, has the best maintenance mode capabilities, the best mobile access and custom reporting, dynamic thresholds setting, and enhanced discovery capabilities?

To find out all you need to know about using remote support to improve your bottom line, download this FREE Whitepaper.

DOWNLOAD!

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.

Connect