Please style sheet are not equal in internet explorer browser Firefox, Chrome, Safari, Apple and Opera browser please visit this website.

Thank for Visit My Site and Please sent me Shayari, Status and Quotes post request.

PHP - Introduction to LAMP & PHP, Getting Started with PHP

Introduction to LAMP & PHP
Introduction to LAMP
LAMP is an open source Web development platform based on Linux, Apache, MySQL, and PHP[or Perl/Python]. PHP(short for PHP Hypertext Preprocessor) is a programming language for which Perl or Python is sometimes substituted. The term was coined in Europe, where these programs are commonly used together and have become something of a standard development environment.
The name derives from the first letters of each of the programs. Each program is an open source standard in its own right:
Linux is the operating system; Apache is the most commonly-used Web server; MySQL is a relational database management system (RDBMS) with add-on tools for Web-based administration; and PHP is a popular object-oriented scripting language that encompasses the best features of many other programming languages to make it efficient for Web development.
Developers that use these tools with a version of a Windows operating system instead of Linux are said to be using WAMP.
History of LAMP
The scripting component of the LAMP stack has its origins in the CGI web interfaces that became popular in the early 1990s. This technology allows the user of a web browser to execute a program on the web server, and to thereby receive dynamic as well as static content.
Programmers used scripting languages with these programs because of their ability to manipulate text streams easily and efficiently, even when they originate from disparate sources. For this reason system designers often referred to such scripting systems as glue languages.
Michael Kunze coined the acronym LAMP in an article for the German computing magazine c't in 1998. The article aimed to show that a bundle of free software could provide a viable alternative to commercial packages. Knowing about the IT-world's love of acronyms, Kunze came up with LAMP as a marketing-like term to increase the popularity of free software.
O'Reilly and MySQL AB have made the term popular among English-speakers. Indeed, MySQL AB has since based some of its marketing efforts on the popularity of the LAMP stack.
Components of LAMP
As stated above LAMP is made of four major components:
. Linux: the operating system [although any operating system can be used ranging from Unix(and its other variants), MAC OS to even Windows] Linux is OS of choice because its Free and wide availability and Security and its stability.

Note: to read more about Linux please read our Linux tutorial at
. Apache: the Web server:
Often referred to as simply Apache, a public-domain open source Web server developed by a loosely-knit group of programmers. The first version of Apache, based on the NCSA httpd Web server, was developed in 1995.
Core development of the Apache Web server is performed by a group of about 20 volunteer programmers, called the Apache Group.
However, because the source code is freely available, anyone can adapt the server for specific needs, and there is a large public library of Apache add-ons. In many respects, development of Apache is similar to development of the Linux operating system.
The original version of Apache was written for UNIX, but there are now versions that run under OS/2, Windows and other platforms(almost all popular platforms).
The name is a tribute to the Native American Apache Indian tribe, a tribe well known for its endurance and skill in warfare. A common misunderstanding is that it was called Apache because it was developed from existing NCSA code plus various patches, hence the name a patchy server, or Apache server.
. MySQL:

A relational database management system famous for being OPEN SOURCE, usually free and highly efficient. Essentially a database is defined as an organized collection of data. The DBMS sits "on top of" this data providing and interface between the database and the user.
MySQL is a simple, yet powerful Open Source Software relational database management system that uses SQL. For more details, see or read our MySQL courses at
. PHP(Perl/Python):

the programming language. PHP is a programming language for which Perl or Python is sometimes substituted. The term was coined in Europe, where these programs are commonly used together and have become something of a standard development environment. The name derives from the first letters of each of the programs.
Getting Your Environment Ready
PHP and MySQL are usually associated with LAMP (Linux, Apache, MySQL, PHP). However, most PHP developer ( including me ) are actually using Windows when developing the PHP application. So this page will only cover the WAMP ( Windows, Apache, MySQL, PHP ). You will learn how to install Apache, PHP, and MySQL under Windows platform.
The first step is to download the packages :
. Apache :
. PHP :
You should get the latest version of each packages. As for the example in this tutorial i'm using Apache 2.0.63 (apache_2.0.63-win32-x86-no_ssl.msi ), PHP 5.2.5 ( and MySQL 5.0.
Now let's start the installation process one by one:
. Installing Apache
. Installing PHP
. Modifying Apache Configuration
. Installing MySQL
. Modifying PHP Configuration File
1. Installing and Configuring on Windows
Installing Apache
Installing apache is easy if you download the Microsoft Installer ( .msi ) package.
1. Just double click on the icon to run the installation wizard.
2. Click next to continue installation.
3. Accept the license agreement and click on Next
4. Click next until you see the Server Information window. You can enter localhost for both the Network Domain and Server Name. As for the administrator's email address you can enter anything you want.
If you are Windows XP(or any other NT based Windows OS) Install Apache as Service so every time you start Windows, Apache is automatically started.
5. Click the Next button and choose Typical installation. Click Next one more time and choose where you want to install Apache ( I installed it in the default location C:\Program Files\Apache Group ). Click the Next button and then the Install button to complete the installation process.
To see if you Apache installation was successful open up you browser and type http://localhost in the address bar.
You should see something like this :
By default Apache's document root is set to htdocs directory. The document root is where you must put all your PHP or HTML files so it will be process by Apache ( and can be seen through a web browser ). Of course you can change it to point to any directory you want. The configuration file for Apache is stored in C:\Program Files\Apache Group\Apache2\conf\httpd.conf ( assuming you installed Apache in C:\Program Files\Apache Group ) .
It's just a plain text file so you can use Notepad to edit it. For example, if you want to put all your PHP or HTML files in C:\www just find this line in the httpd.conf :
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs" and change it to :
DocumentRoot "C:/www" After making changes to the configuration file you have to restart Apache ( Start > Programs > Apache HTTP Server 2.0.50 > Control Apache Server > Restart ) to see the effect.
Another configuration you may want to change is the directory index. This is the file that Apache will show when you request a directory. As an example if you type without specifying any file the index.php file will be automatically shown.
Suppose you want apache to use index.php, index.php or main.php as the directory index you can modify the DirectoryIndex value like this : DirectoryIndex index.php index.php main.php Now whenever you request a directory such as http://localhost/ Apache will try to find the index.php file or if it's not found Apache will use index.php. In case index.php is also not found then main.php will be used.
Installing PHP
First, extract the PHP package ( ). I extracted the package in the C:\ drive. Change the new created directory name to php ( just to make it shorter ). Then copy the file php.ini-dist in PHP5 directory to you windows directory ( C:\Windows or C:\Winnt depends on where you installed Windows ) and rename the file to php.ini. directory to you windows directory ( C:\Windows or C:\Winnt depends on where you installed Windows ) and rename the file to php.ini.
This is the PHP configuration file and we'll take a look what's in it later on.
Next, move the php5ts.dll file from the newly created php directory into the Apache2\bin subdirectory. Quoting from php installation file you can also place php5ts.dll in other places such as :
. In the directory where apache.exe is start from ( C:\Program Files\Apache Group\Apache2 \bin)

. In your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and %SYSTEMROOT% directory. Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)

. In your whole %PATH%
Modifying Apache Configuration
Apache doesn't know that you just install PHP. We need to tell Apache about PHP and where to find it. Open the Apache configuration file in C:\Program Files\Apache Group\Apache2\conf\httpd.conf and add the following three lines :
LoadModule php5_module "c:/php/php5apache2.dll"

#note the location may differ depending upon where you have installed PHP on your system.

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
The first line tells Apache where to load the dll required to execute PHP and the second line means that every file that ends with .php should be processed as a PHP file.
You can actually change it to anything you want like .php or even .asp! The third line is added so that you can view your php file source code in the browser window. You will see what this mean when you browse this tutorial and click the link to the example's source code like this one.
Now restart Apache for the changes to take effect ( Start > Programs > Apache HTTP Server 2.0 > Control Apache Server > Restart ) .
To check if everything is okay create a new file, name it as test.php and put it in document root directory ( C:\Program Files\Apache Group\Apache2\htdocs ).
The content of this file is shown below:
phpinfo() is the infamous PHP function which will spit out all kinds of stuff about PHP and your server configuration. Type http://localhost/test.php on your browser's address bar and if everything works well you should see something like this :
Installing MySQL
For Detailed installation guide of MySQL please refer to our MySQL tutorial, which contains installation as well as configuration instruction for MySQL.
Modifying PHP Configuration File ( php.ini )
PHP stores all kinds of configuration in a file called php.ini. You can find this file in the directory where you installed PHP. Sometimes you will need to modify this file for example to use a PHP extension. I won't explain each and every configuration available just the ones that often need modification or special attention.
Some of the configurations are :
1. register_globals
2. error_reporting and display_errors
3. extension and extension_path
4. session.save_path
5. max_execution_time
Before PHP 4.2.0 the default value for this configuration is On and after 4.2.0 the default value is Off. The reason for this change is because it is so easy to write insecure code with this value on. So make sure that this value is Off in php.ini.
error_reporting and display_errors
Set the value to error_reporting = E_ALL during development but after production set the value to error_reporting = E_NONE . The reason to use E_ALL during development is so you can catch most of the nasty bugs in your code. PHP will complain just about any errors you make and spit out all kinds of warning ( for example if you're trying to use an uninitialized variable ).
However, after production you should change the value to E_NONE so PHP will keep quiet even if there's an error in your code. This way the user won't have to see all kinds of PHP error message when running the script.
One important thing to note is that you will also need to set the value of display_erros to On. Even if you set error_reporting = E_ALL you will not get any error message ( no matter how buggy our script is ) unless display_errors is set to On.
extension and extension_path
PHP4 comes with about 51 extensions such as GD library ( for graphics creation and manipulation ), CURL, PostgreSQL support etc. These extensions are not turned on automatically. If you need to use the extension, first you need to specify the location of the extensions and then uncomment the extension you want.
The value of extension_path must be set to the directory where the extension is installed which is PHP_INSTALL_DIR/ext, with PHP_INSTALL_DIR is the directory where you install PHP. For example I installed PHP in C:\php so the extensions path is :
extension_path = "C:/php/ext/"
Don't forget to add that last slash or it won't work After specifying the extension_path you will need to uncomment the extension you want to use. In php.ini a comment is started using a semicolon (;). As an example if you want to use GD library then you must remove the semicolon at the beginning of ;extension=php_gd2.dll to extension=php_gd2.dll
This configuration tells PHP where to save the session data. You will need to set this value to an existing directory or you will not be able to use session. In Windows you can set this value as:
session.save_path = c:/windows/temp/
The default value for max_execution_time is 30 ( seconds ). But for some scripts 30 seconds is just not enough to complete it's task. For example a database backup script may need more time to save a huge database. If you think your script will need extra time to finish the job you can set this to a higher value.
For example to set the maximun script execution time to 15 minutes ( 900 seconds ) you can modify the configuration as max_execution_time = 900 PHP have a convenient function to modify PHP configuration in runtime, ini_set(). Setting PHP configuration using this function will not make the effect permanent. It last only until the script ends.
Alternatives available on Windows
If you are familiar with windows or want to develop your website on Windows then move it to Linux based Host server. Then there are multiple windows equivalent of the LAMP stack. LAMP stands for Linux (Operating System), Apache (Web Server), Mysql (Database), and PHP (Scripting Language). Under these alternatives, instead of using Linux as the Operating System, you use one of the Microsoft Windows OSes such as XP, 2000 or 2k3.
Why use Windows instead of Linux
Windows OSes since 2000 i.e. 2k, XP , 2k3 have been extremely stable as opposed to their predecessors. So if you are proficient in Windows, then there is no reason not to use it for web hosting. (barring security, but that's another issue).
Secondly if you want to develop your site off line and then move it to a LAMP Stack, and you are not familiar with Linux, then these Windows based alternatives serves as an ideal prototyping environment.
You can do almost every thing with them that you can do in LAMP, furthermore they are extremely easy to install, configure, administer and use. Since with these windows alternatives comes as a single bundle (Apache+PHP+MySQL), you don't need to download and install them separately. Just install and you are ready to go.
Given below are some alternatives available for LAMP stack on Windows:
1. XAMPP []
2. WAMP server []
3. Easy PHP
4. PHPTriad
Introduction to PHP
PHP, which is recursive acronyms for "PHP Hypertext Preprocessor", is a server-side, HTML embedded scripting language used to create dynamic Web pages. Much of its syntax is borrowed from C, Java and Perl with some unique features thrown in. The goal of the language is to allow Web developers to write dynamically generated pages quickly.
In an HTML page, PHP code is enclosed within special PHP tags. When a visitor opens the page, the server processes the PHP code and then sends the output (not the PHP code itself) to the visitor's browser. It means that, unlike JavaScript, you don't have to worry that someone can steal your PHP script.
PHP offers excellent connectivity to many databases including MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, and Generic ODBC. The popular PHP-MySQL combination (both are open-source products) is available on almost every UNIX host. Being web-oriented, PHP also contains all the functions to do things on the Internet - connecting to remote servers, checking email via POP3 or IMAP, url encoding, setting cookies, redirecting, etc.
History of PHP
PHP stands for PHP: Hypertext Preprocessor, with that PHP standing for Personal HomePage/Form Interpreter . This type of acronym is known as a retronym. Originally, in 1994, the language was designed as a small set of binaries used to collect some basic site traffic data. In 1997 the parser was rewritten by two Israelis and the name was changed to the current acronym - it being determined that hypertext preprocessor was a decidedly more acceptable name in the business world.
PHP is an open-source language, used primarily for dynamic web content and server-side applications. It is often pointed to as the main competitor with:
. Microsoft's C# - Visual Basic.NET - ASP family,
. Sun's Java - JSP
. Macromedia's ColdFusion
. CGI - Perl
PHP has many open-source libraries included with the core build, and many more are readily available. Extensions exist to help PHP interface with a number of systems, including IRC, a number of compression formats, and Windows API. Other extensions exist to let PHP generate file formats on-the-fly, such as a popular extension which allows PHP to create Macromedia Flash movies.
Since version 3, PHP has integrated object oriented features. Version 5 built substantially on this limited functionality, and PHP now has robust object oriented capabilities, including interfaces, exceptions, destructions, and abstracts.
PHP reached wide-spread popularity with version 4, released in 2000. In 2004 PHP 5 was debuted, and it is now considered one the top languages used for server-side scripting.
PHP succeeds an older product, named PHP/FI. PHP/FI was created by Rasmus Lerdorf in 1995, initially as a simple set of Perl scripts for tracking accesses to his online resume.
He named this set of scripts 'Personal Home Page Tools'. As more functionality was required, Rasmus wrote a much larger C implementation, which was able to communicate with databases, and enabled users to develop simple dynamic Web applications. Rasmus chose to ยป release the source code for PHP/FI for everybody to see, so that anybody can use it, as well as fix bugs in it and improve the code.
PHP/FI, which stood for Personal Home Page / Forms Interpreter, included some of the basic functionality of PHP as we know it today. It had Perl-like variables, automatic interpretation of form variables and HTML embedded syntax. The syntax itself was similar to that of Perl, albeit much more limited, simple, and somewhat inconsistent.
By 1997, PHP/FI 2.0, the second write-up of the C implementation, had a cult of several thousand users around the world (estimated), with approximately 50,000 domains reporting as having it installed, accounting for about 1% of the domains on the Internet. While there were several people contributing bits of code to this project, it was still at large a one-man project.
PHP/FI 2.0 was officially released only in November 1997, after spending most of its life in beta releases. It was shortly afterwards succeeded by the first alphas of PHP 3.0.
PHP 3.0 was the first version that closely resembles PHP as we know it today. It was created by Andi Gutmans and Zeev Suraski in 1997 as a complete rewrite, after they found PHP/FI 2.0 severely underpowered for developing an eCommerce application they were working on for a University project.
In an effort to cooperate and start building upon PHP/FI's existing user-base, Andi, Rasmus and Zeev decided to cooperate and announce PHP 3.0 as the official successor of PHP/FI 2.0, and development of PHP/FI 2.0 was mostly halted.
One of the biggest strengths of PHP 3.0 was its strong extensibility features. In addition to providing end users with a solid infrastructure for lots of different databases, protocols and APIs, PHP 3.0's extensibility features attracted dozens of developers to join in and submit new extension modules.
Arguably, this was the key to PHP 3.0's tremendous success. Other key features introduced in PHP 3.0 were the object oriented syntax support and the much more powerful and consistent language syntax.
The whole new language was released under a new name, that removed the implication of limited personal use that the PHP/FI 2.0 name held. It was named plain 'PHP', with the meaning being a recursive acronym - PHP: Hypertext Preprocessor.
By the end of 1998, PHP grew to an install base of tens of thousands of users (estimated) and hundreds of thousands of Web sites reporting it installed. At its peak, PHP 3.0 was installed on approximately 10% of the Web servers on the Internet. PHP 3.0 was officially released in June 1998, after having spent about 9 months in public testing.
By the winter of 1998, shortly after PHP 3.0 was officially released, Andi Gutmans and Zeev Suraski had begun working on a rewrite of PHP's core. The design goals were to improve performance of complex applications, and improve the modularity of PHP's code base. Such applications were made possible by PHP 3.0's new features and support for a wide variety of third party databases and APIs, but PHP 3.0 was not designed to handle such complex applications efficiently.
The new engine, dubbed 'Zend Engine' (comprised of their first names, Zeev and Andi), met these design goals successfully, and was first introduced in mid 1999.
PHP 4.0, based on this engine, and coupled with a wide range of additional new features, was officially released in May 2000, almost two years after its predecessor, PHP 3.0. In addition to the highly improved performance of this version, PHP 4.0 included other key features such as support for many more Web servers, HTTP sessions, output buffering, more secure ways of handling user input and several new language constructs.
Today, PHP is being used by hundreds of thousands of developers (estimated), and several million sites report as having it installed, which accounts for over 20% of the domains on the Internet.
PHP's development team includes dozens of developers, as well as dozens others working on PHP-related projects such as PEAR and the documentation project.
PHP 5 was released in July 2004 after long development and several pre-releases. It is mainly driven by its core, the Zend Engine 2.0 with a new object model and dozens of other new features.
Why PHP?
It's no secret that there are alternatives to PHP: ASP, JSP, Cold Fusion, and Perl, to name just a few. While each of these languages has differences in syntax and structure, when it comes down to it, they can all produce the same results. So, why would you choose PHP over other options?
- Simplicity. For people new to programming, this is frequently the strongest appeal. Even those with little or no programming experience can quickly get up to speed and begin creating full-fledged applications. Because it was specifically designed for creating web applications, PHP has a host of built-in functions to handle common needs.
- PHP is Open Source. Because PHP's source code is freely available, a community of developers is always working to improve, add to, and find bugs in the language. Open Source means you never need to rely on the manufacturer to release the next version if something doesn't work or pay for expensive upgrades.
- Stability, and compatibility. Currently, PHP runs stable on a range of operating systems including most flavors of UNIX, Windows and Macs and integrates well with most popular servers including IIS and Apache.
PHP is also endowed with other goodies, like native support for many popular databases, an extensible architecture, and a processor that not only uses fewer resources on the server than many of its competitors, but also displays pages in record time.
In Short : PHP scripting and MySQ database enables programmers to create a programme that'll run on any computer, regardless of operating system. PHP has thousands of programming functions to facilitate almost any task.
Where do PHP Stands?
No doubt much of its popularity is due to its relative ease to learn, and its notorious looseness. Arrays and variables in PHP are able to hold any type of object, variables need not be declared, and the syntax is remarkably simple.
Unlike many languages, such as C# or Perl, which have primarily a following of more generalist programmers, many PHP programmers know no other language. This occasionally causes it to be dismissed as a lesser language, but its growing popularity and the many robust and efficient sites built using it as a structure seem to dispel this myth.
PHP has occasionally been criticized for what are viewed by some as security flaws, in comparison to languages such as ASP. A lack of easily understandable error messages, a sometimes overly robust configuration file, and an obviously incomplete set of built-in functions are also pointed to as areas which could use marked improvement.
Development continues apace, however, and with each successive build, PHP appears to address more and more of the concerns raised by its open-source community.
PHP and other Languages

1. PHP vs. ASP?
2. PHP vs. Cold Fusion?
3. PHP vs. Perl?
1. PHP vs. ASP?
ASP is not really a language in itself, it's an acronym for Active Server Pages, the actual language used to program ASP with is Visual Basic Script or JScript. The biggest drawback of ASP is that it's a proprietary system that is natively used only on Microsoft Internet Information Server (IIS).
This limits it's availability to Win32 based servers. There are a couple of projects in the works that allows ASP to run in other environments and webservers: InstantASP from Halcyon (commercial), Chili!Soft ASP from Chili!Soft (commercial) and OpenASP from (free).
ASP is said to be a slower and more cumbersome language than PHP, less stable as well. Some of the pros of ASP is that since it primarily uses VBScript it's relatively easy to pick up the language if you're already know how to program in Visual Basic.
ASP support is also enabled by default in the IIS server making it easy to get up and running. The components built in ASP are really limited, so if you need to use "advanced" features like interacting with FTP servers, you need to buy additional components.
2. PHP vs. Cold Fusion?
PHP is commonly said to be faster and more efficient for complex programming tasks and trying out new ideas. PHP is generally referred to as more stable and less resource intensive as well. Cold Fusion has better error handling, database abstraction and date parsing although database abstraction is addressed in PHP 4.
Another thing that is listed as one of Cold Fusion's strengths is its excellent search engine, but it has been mentioned that a search engine is not something that should be included in a web scripting language. PHP runs on almost every platform there is; Cold Fusion is only available on Win32, Solaris, Linux and HP/UX.
Cold Fusion has a good IDE and is generally easier to get started with, whereas PHP initially requires more programming knowledge. Cold Fusion is designed with non-programmers in mind, while PHP is focused on programmers. A great summary by Michael J Sheldon on this topic has been posted to the PHP mailing list. A copy can be found here.
3. PHP vs. Perl?
The biggest advantage of PHP over Perl is that PHP was designed for scripting for the web where Perl was designed to do a lot more and can because of this get very complicated. The flexibility / complexity of Perl makes it easier to write code that another author / coder has a hard time reading.
PHP has a less confusing and stricter format without losing flexibility. PHP is easier to integrate into existing HTML than Perl. PHP has pretty much all the 'good' functionality of Perl: constructs, syntax and so on, without making it as complicated as Perl can be. Perl is a very tried and true language, it's been around since the late eighties, but PHP is maturing very quickly.
4. PHP vs. JSP
Function / Feature JSP PHP
Programming Approach Completely object oriented Advantage: Clean code
Too descriptive
Scripting with object oriented support Advantage: Functional and quick coding, you can use OOP practices at your convenience
Disadvantage: May get clumsy
String and data manipulation Rich library, too much descriptive and object oriented code Rich functionality. Functional and easy coding.
Web Oriented features
  1. Includes
  2. Mails
  3. File Uploads
  4. Form Handling
  5. Sessions
Almost everything is built in or supported by libraries. Complicated and too much of code. Inbuilt functionality. Easy to use functions, written for the specific tasks
Database Access features Standard JDBC structure/ Use EJB/ Struts framework built over JDBC. Descriptive and too much overhead or boiler plate code involved. Uses the same API for all databases using JDBC drivers Dedicated inbuilt libraries for most of the commonly used databases. Very tight integration with MySQL and PostGRESQL. Very minimal boiler plate code required. The libraries and results are straight forward and easy to use.
XML/XSL/XPATH Use standard SAX/DOM parsers. Too much boiler plate code involved. Well defined APIs and stable implementations are available for XSL and XPATH SAX and DOM parsers available are easy to use and to the point. Another library, Simple XML provides very easy OO approach to handling XML data. XSL and XPATH functionality is also built in.
Extensibility Java Classes and Libraries. Run’s in sandbox and hard JNI approach needed to integrate with server programs. PHP/C/Any thing executable by the underlying OS platform. Can very easily interact with programs on the server. Very good support for native code.
Dynamic Graphics/PDF and bells and whistles Almost everything has a readymade library Supported internally or though libraries.
Web Services/SOAP Addon Libraries like Axis, JAX-WS, etc. In Built
Portals Spec JSR-168 and 286 Many different Portal frameworks
Getting Started with PHP
If you choose PHP as your development language, what you need to get started depends on:
. Sound knowledge of HTML. *
. Working knowledge of JavaScript(optional, but strongly recommended) **
. Sound Knowledge of SQL and knowledge of any RDBMS software (MySQL recommended)***
. Access to a web server that have Apache, MySQL and PHP configured on it


. Apache + MySQL + PHP installed on your machine.
. Any Text editor(for beginner level) or WYSIWYG editor (for advanced scripting).
. phpMyAdmin or any other MySQL administration tool installed.
PHP is as dependent on HTML as any language that generates web pages. If you don't know HTML PHP won't do you much good as you will have difficulty displaying the results of your PHP processing since for all practical purposes the purpose of PHP is to generate HTML.
If you don't have access to a web server, that's not going to create a problem, you can configure Apache+ MySQL + PHP on your windows machine as demonstrated in chapter 1.2(or use any of it's bundled alternative listed in chapter 1.3).
Develop your web site on Windows and when you are done with development make it live on any Linux based host (believe me almost 80-90% companies are developing LAMP solutions work this way).
* Please refer to our XHTML tutorial for HTML.
** Please refer to our JavaScript tutorial for more information on JavaScript
*** Please go through our MySQL tutorial for in-depth information on MySQL.
Choosing an Editor
On Linux
Bluefish -

Supports any protocol that is supported by GNOME VFS. (FTP, SSH...)
gedit -

gedit is a free software, UTF-8 compatible text editor for the GNOME desktop environment. It is designed to have a clean, simple interface inspired by the ideals of the GNOME project.

gPHPedit is a GPL-based, small UTF-8 compatible text editor for the GNOME desktop environment, written by Andy Jeffries. It is similar to gedit with the difference that it is designed for PHP and HTML text editing. The current version is 0.9.91, released on July 5, 2006.
On Windows

Freeware editor with syntax highlighting It is a freeware text editor for Microsoft Windows, aimed at software developers. It can open and edit very large files, while requiring only modest amounts of RAM and hard drive space to run.
Crimson Editor - lightweight editor. Supports FTP
Programmer's Notepad
Programmer's Notepad (PN1) is an open-source text editor targeted at users who work with source code. It was released in 1998. PN1's successor, Programmer's Notepad 2 (PN2), was released in 2002 and is now based on Scintilla.
Possibly the most distinctive feature common to both versions is the combination tabbed document interface and multiple document interface called "Tabbed MDI" by the developer. The TDI is parent to the MDI.

Notepad++ is a free source code editor for Windows. The project is hosted on, from where it has been downloaded over eight million times.
This project, based on the Scintilla editor component, is written in C++ with pure Win32 API calls and uses STL. The aim of Notepad++ is to offer a slim and efficient binary with a totally customizable GUI.
Testing your Environment
While there's nothing wrong with getting started writing PHP scripts sing no-frills editors such as Windows Notepad or vi, chances are you're soon going to want to graduate to a full-fledged PHP-specific development solution. Several open source and commercial solutions are available.
The best way to verify your PHP installation is by attempting to execute a PHP script.
Open a text editor and add the following lines to a new file:
If you're running Apache, save the file within the htdocs directory as phpinfo.php.
Note: from now onwards this tutorial will use XAMPP from Apache Friends for development. You can still use Apache, but if you are having any problem configuring it, just uninstall Apache and install XAMPP. XAMPP is easy to install, no manual configuration required, and all components installed in one go (Apache + MySQL + PHP + phpMyAdmin).
If you're running IIS, save the file within C:\inetpub\wwwroot\.
Now open a browser and access this file by entering the following URL: http://localhost/phpinfo.php.
If all goes well, you should see output similar to that shown in Figure below:
The page above contains a lot of information related to your environment, such as: PHP core Configuration info, apache2handler info, Apache Environment info etc.
If you're attempting to run this script on a Web hosting provider's server, and you receive an error message stating phpinfo() has been disabled for security reasons, you'll need to try Testing Your Installation executing another script.
Try executing this one instead, which should produce some simple output:
echo "A simple but effective PHP test!";
First PHP script
Every language has it... the basic "Hello, World!" script. It is a simple script that only displays the words "Hello, World!". Over the years this has become the traditional phrase to use when writing your first program.
According to Wikipedia, it's mainstream usage spawned from an internal memorandum in 1974 that became incorporated into the book The C Programming Language. It's actual first known usage was in Kernighan's 1972 A Tutorial Introduction to the Language B. From this it has grown into somewhat of a tradition in the programming world.
So how do I do it in PHP? Well the two simplest ways are using Print or Echo.
echo ("val");
 echo "<h1>Welcome to MKDTutorials Education!</h1>"
Here, as we read that HTML Embeds in the php code,that's why <h1>and </h1> is used here in the php script.echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it ( whereas print is a function,it returns a value, it does not take multiple parameters). If you're running Apache, create a folder named test within the htdocs directory and save the file as hello.php in the test directory.
Now, open the page in the browser to see the output:
if your apache installation is working fine, you should have the following output:
1) Write a PHP script to display following MKDTutorials Education Team Welcomes You PHP Rocks

2) Write a PHP script to print your Name, Age and Address



Post a Comment

Circle Me On Google Plus


Follow Us