Sessions
- Introduction to PHP
- Form Handling in PHP
- Using Variables and Expressions in PHP
- Using Variables and Expressions in PHP (Lab)
- PHP Operators
- PHP Operators (Lab)
- Conditional Statements in PHP
- Conditional Statements in PHP (Lab)
- Flow Control in PHP
- Flow Control in PHP (Lab)
- Functions in PHP
- Functions in PHP (Lab)
- Working with Arrays
- Working with Arrays (Lab)
- Handling Databases with PHP
- Working with Cookies
- Working with Cookies (Lab)
- Session Management in PHP
- Handling E-mail with PHP
- Handling E-mail with PHP (Lab)
- OOP Concepts
- OOP Concepts (Lab)
**Introduction to PHP **
Objectives
At the end of this session, the student will be able to:
- Explain the history of PHP.
- Identify the need for PHP.
- Explain PHP tools and setup.
Introduction
PHP stands for Hypertext Preprocessor. It is an open source scripting language embedded within
HyperText Markup Language (HTML) codes and is used for developing dynamic Web pages. PHP scripts are executed on the Web server
History of PHP
PHP, created in 1994 by Rasmus Lerdorf originally stood for Personal Home Page. Rasmus Lerdorf
used a set of Perl scripts to maintain his personal home page and track access. These were replaced
with Personal Home Page Tools, which were a set of Common Gateway Interface (CGI) binaries written in C programming language. In order to add more functionality, these Personal Home Page Tools were incorporated with Form Interpreters (FI) to create an advanced version of PHP called PHP/FI. Form interpreters are a set of Perl scripts used by a form to process data from a Web form. PHP/FI enabled communication with databases and development of simple dynamic Web application.
In the year 1997, PHP/FI advanced to PHP/FI 2.0 with thousands of users installing it in approximately 50,000 server domains. However, PHP/FI 2.0 lacked extensive features which led to the development of PHP 3.0.
PHP 3.0 was the first version of PHP developed by Andi Gutmans and Zeev Surakshi in the year 1997.
This version supported different databases, protocols, and Application Programming Interfaces (APIs).
The developers used the extensibility feature of PHP 3.0 to add new features to it and enhance its
functionality. In addition, PHP 3.0 also provided object oriented syntax support.
In the year 2000, PHP 4.0 was released with security enhancements. PHP 4.0 provided support for multiple Web servers, HTTP sessions, output buffering, and security for user inputs. PHP 5.0 was released in the year 2004. PHP 5.3.6 was released in March 2011.
Need for PHP
PHP is a scripting language suitable for server-side scripting and provides dynamic content from a Web
server to a Web client.
The advantages of using PHP are as follows:
Is easy to learn, use, and implement
Is freely available and can be customized
Can be executed on any Web server on any platform
PHP is a set of scripting tools used for performing various server-side functions. In addition, it can also be used for command line scripting and for developing client-side Graphical User Interface (GUI) applications that are platform independent.
The different uses of PHP are as follows:
Application Control - is specifically designed to control access logging for HTTP servers. Initially
it was used as an application control language.
Database Access
is designed to act as a middleware to provide a Web interface for accessing a
database. PHP can access any Structured Query Language (SQL) or Open Database Connectivity
(ODBC) database and read and write data from these databases.
File Access
is used to work with files. It can read, write, and edit documents remotely. In other
words, it can be used for file and directory maintenance. PHP can also be used for generating
files in various formats, such as Portable Document File (PDF) and HTML. It is increasingly used
to process Extensible Markup Language (XML) data for HTTP distribution. It generates an e-mail
by retrieving data from documents and sending it through any standard mail protocol.
Graphics
is used to create graphs and charts and generate image files, such as Graphics
Interchange Format (GIF) and Portable Network Graphics (PNG).
Server-Side Scripting
is designed to implement server scripts. The client requests will be
processed on the server. A PHP parser, a Web server, and a Web browser are required to
implement server-side scripting.
Command Line Scripting
is used to execute scripts on the UNIX/Linux platforms. A Web server
and a Web browser are not required in command line scripting; only the PHP parser is required.
Desktop Applications
is used to create desktop applications with a GUI. Advanced features of
PHP can be implemented in client applications to enable interactive GUI.
Introduction to PHP Tools and Setup
PHP tools are used for developing and designing a Web page. They are text editors that allow developers
to design Web sites. PHP tools can be implemented after installation of PHP.
PHP Tools
PHP tools are programming text editors containing all the supporting features that enable fast development
of Web sites. The tools that are used for developing dynamic Web pages are as follows:
PHPDebugger DBG
Enables step by step execution and debugging of a PHP script without
changing the PHP code. It supports multiple debugging processes simultaneously. A PHP
Debugger simplifies PHP debugging because you can control the execution of PHP scripts without
changing the code. For example, using PhpED's PHP Debugger from NuSphere, you can perform
various PHP debugging operations including:
Inspecting PHP variable and class.
Modifying the value of a PHP variable.
Defining breakpoints to interrupt script execution.
Invoking a PHP function to view results.
Navigating through the code.
Viewing the line generating error.
Enabling secure debugging with Secure Shell (SSH).
ionCube Standalone PHP Encoder
Protects the PHP code and ensures security and runtime
performance.
Codelock -
Enables to encrypt both PHP and HTML code and protect Web pages.
PHing -
Is a PHP build system, which enables to design a Web application in a structured manner.
NuSphere PHPEd -
Is an Integrated Development Environment (IDE) for PHP and a complete
platform for developing PHP based Web applications. It enables to create, debug, profile, deploy,
and integrate PHP code.
xored:WebStudio -
Is an IDE for PHP. Built on Eclipse platform, this tool comprises a set of
Eclipse editing, debugging, and deployment tools.
PHPmole -
Is a combination of Dreamweaver and Microsoft Visual Studio and runs on a GNOME
platform to work with PHP. A GNOME platform is a desktop environment for Linux. This tool has
an object based design and a user friendly interface.
Simplewire PHP SMS Software Development Kit (SDK) -
Provides a wireless text-messaging
platform. It enables to embed messaging services into an application, which can be sent to mobile
devices.
Quanta Plus Web Development Environment -
Is a Web development environment to edit XML,
HTML, PHP, and other text based Web documents.
K PHP Develop-
Is an integrated Web development tool with different modules, such as server,
server setup, and client and plug-ins to access database servers, such as MySQL and Sybase.
gedit -
Is a GNOME based text editor for writing PHP scripts. It is installed as the default text
editor in Linux operating systems.
Installing PHP
PHP is an open-source scripting language. The source code can be downloaded for free from the official
PHP Web site. The version of PHP used is 5.3.6. You can download the php-5.3.6.tar.gz file from
http://www.php.net/downloads.php.
To install PHP, you must have a Web server and a database installed. The Web servers that support
PHP are as follows:
- Internet Information Services (IIS).
- Apache.
- Zeus.
Some of the databases supported in PHP are as follows:
DB2
MSSQL
MySQL
Oracle
PostgreSQL
To install PHP, perform the following steps:
Right-click php-5.3.6.tar.gz files and select Extract Here. The contents are extracted to the
php-5.3.6 folder in the current directory.Right-click php-5.3.6 folder and select Open In Terminal. The Terminal Window is displayed.
To configure the source code of PHP, enter the following command at the command prompt:
./configure --with-apxs2=/usr/local/apache2/bin/apxs
displays the output of the command.
- To build the compiled files, enter the following command at the command prompt:
make
displays the output of the command.
- To install PHP, enter the following command at the command prompt:
make install
displays the output of the command
The make install command copies the compiled binary files and the executables to their respective
locations. The installation of PHP is now complete.
Posted on Utopian.io - Rewarding Open Source Contributors
Posted on Utopian.io - Rewarding Open Source Contributors
Duplicate submission.
Again reminder of comment on other submission:
"Your submission cannot be accepted as it involves plagiarism. Your account will be temporarily banned. Continuous use of plagiarism would lead to your permanent ban from using utopian."
Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.
[utopian-moderator]