Seminar on PHP (introducing PHP)

Reviews
Shared by: shubhambpl
Stats
views:
319
rating:
not rated
reviews:
0
posted:
9/23/2009
language:
English
pages:
0
PHP – An Introduction Made By: Anuj Puranik 5th Sem CSE,NIIST Bpl Agenda 1. Brief History of PHP 2. Getting started 3. Examples Brief History of PHP PHP (PHP: Hypertext Preprocessor) was created by Rasmus Lerdorf in 1994. It was initially developed for HTTP usage logging and server-side form generation in Unix. Officially called "Personal Home Page Tools (PHP Tools)". This is the first use of the name "PHP". PHP 2 (1995) transformed the language into a Server-side embedded scripting language. Added database support, file uploads, variables, arrays, recursive functions, conditionals, iteration, regular expressions, etc.Considered by its creator as the "fastest and simplest tool" for creating dynamic web pages . PHP 3 (1998) added support for ODBC data sources, multiple platform support, email protocols (SNMP,IMAP), and new parser written by Zeev Suraski and Andi Gutmans. Development moves from one person to multiple developers PHP 4 (2000) became an independent component of the web server for added efficiency. Added more advanced two-stage parse/execute tag-parsing system called the Zend engine. . Many security features were added. PHP 4.1-4.3 (2001-02) Introduced the superglobals ($_GET, $_SESSION, etc.) , Disabled register_globals by default PHP 5 (2004) adds Zend Engine II with object oriented programming, robust XML support using the libxml2 library, SOAP extension for interoperability with Web Services, SQLite has been bundled with PHP PHP 5.2.4 (2007) Enabled the filter extension by default released on 30 August 2007. It is considered to be free software by the Free Software Foundation. Brief History of PHP As of August 2005, PHP is used on 23,946,328 Domains, 4,348,793 IP Addresses http://www.php.net/usage.php This is roughly 48% of all domains on the web. What is PHP ? PHP is a reflective programming language originally designed for producing dynamic web pages.PHP is used mainly in server-side scripting, but can be used from a command line interface or in standalone graphical applications. Textual User Interfaces can also be created using ncurses. PHP is a recursive initialism for PHP: Hypertext Preprocessor. In Other Words, PHP is a scripting Language generally used for web Developments which has a combined traces a Progaramming Language and a web-dev language PHP is Influenced by C/C++, Perl, Python ,Java Why is PHP used? 1. Easy to Use Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode". Example Why is PHP used? 2. Cross Platform Runs on almost any Web server on several operating systems. One of the strongest features is the wide range of supported databases Web Servers: Apache, IIS(Microsoft Specific), Caudium, Netscape Enterprise Server Operating Systems: UNIX (HP-UX,OpenBSD,Solaris,Linux), Mac OSX, Windows NT/98/2000/XP/2003 Supported Databases: Adabas D, dBase,Empress, FilePro (readonly), Hyperwave,IBM DB2, Informix, Ingres, InterBase, FrontBase, mSQL, Direct MS-SQL, MySQL, ODBC, Oracle (OCI7 and OCI8), Ovrimos, PostgreSQL, SQLite, Solid, Sybase, Velocis,Unix dbm Cross Platforms Architecture Some of the Common & Cost Beneficial Architectures are 1.LAMP Linux,Apache,MySQL,Php 2.WAMP Windows,Apache,MySQL,Php 3.MAMP MacOS,Apache,MySQL,Php XAMP An OS,Apache,MySQL,Php Why is PHP used? 3. Cost Benefits PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on technologies (libraries) for PHP that are also free. PHP Software Platform Development Tools Free Free (Linux) Free PHP Coder, jEdit Why is PHP used? 4. Scripting/Programing Language(C-Like) Since writing a PHP is more or less like a programming Language hence its often easy for the programmers to grab the control in a short while when working in a PHP environment. Hence PHP is now becoming a Programmer’s 1st Choice 5. Fast ,Stable ,No Compilation Since PHP is a Server Side Scripting, hence no additional Plug-ins are required to view the output. 6. Extremely Powerful Easy Use ,Vast Functionality, Wide Applications and Add-ons like PHPmyadmin makes PHP Extremely powerful Web-dev tool as compared to other languges. Getting Started 1. How to escape from HTML and enter PHP mode • PHP parses a file by looking for one of the special tags that tells it to start interpreting the text as PHP code. The parser then executes all of the code it finds until it runs into a PHP closing tag. HTML PHP CODE HTML Starting tag Ending tag ?> ?> ?> Notes Preferred method as it allows the use of PHP with XHTML Not recommended. Easier to type, but has to be enabled and may conflict with XML Always available, best if used when FrontPage is the HTML editor Not recommended. ASP tags support was added in 3.0.4 <% %> Getting Started 2. • Simple HTML Page with PHP The following is a basic example to output text using PHP. My First PHP Page Copy the code onto your web server and save it as “test.php”. You should see “Hello World!” displayed. Notice that the semicolon is used at the end of each line of PHP code to signify a line break. Like HTML, PHP ignores whitespace between lines of code. (An HTML equivalent is
) Getting Started 3. • Using conditional statements Conditional statements are very useful for displaying specific content to the user. The following example shows how to display content according to the day of the week. Getting Started 3. • • Using conditional statements The if statement checks the value of $today_dayofweek (which is the numerical day of the week, 0=Sunday… 6=Saturday) If it is equal to 4 (the numeric representation of Thurs.) it will display everything within the first { } bracket after the “if()”. If it is not equal to 4, it will display everything in the second { } bracket after the “else”. Examples • PHP is a great way to implement templates on your website. • How to implement a simple page counter Examples • • Step 1: Universal header and footer in a single file Create a file called header.php. This file will have all of the header HTML code. You can use FrontPage/Dreamweaver to create the header, but remember to remove the closing and tags. This is ur Header
Page Title
Examples • • Step 2: Universal header and footer in a single file Next, create a file called footer.php. This file will have all of the footer HTML code.
This is Your Footer> someuser@ucr.edu
Examples • • Step 3: Universal header and footer in a single file This is the basic template that you will use on all of the pages. Make sure you name the files with a .php extension so that the server will process the PHP code. In this example, we assume the header and footer files are located in the same directory. Insert content here! Examples Benefits: - Any changes to header or footer only require editing of a single file. This reduces the amount of work necessary for site maintenance and redesign. - Helps separate the content and design for easier maintenance Header Page 1 Content Page 2 Content Page 3 Content Page 4 Content Page 5 Content Footer Examples • Step 3: Simple Page Counter • Next, output the counter value using PHP. Copy this line after the main block of code. This page has been viewed times. • That’s it! The result should look something similar to: Examples • Step 3: Simple Page Counter • You can change the text around the tags to your liking. visitors. This example shows 1. How to escape from HTML and enter PHP mode 2. How to output variables onto the screen using PHP Examples 2. How to output variables using PHP • Echo is the common method in outputting data. Since it is a language construct, echo doesn’t require parenthesis like print(). Output Text Usage: // prints out Hello World Output the value of a PHP variable: // prints out the number of hits Echo has a shortcut syntax, but it only works with the “short open tag” configuration enabled on the server. • • • Examples 3. • Other uses with echo() Automatically generate the year on your pages. This will print out 2007. • You will need to escape any quotation marks with a backslash. OutPut:: I said ”She sells sea shells” (\ is hence known as the escaping character) Content Management System(CMS) A Content Management System (CMS) is a software system used for content management. Content management systems are deployed primarily for interactive use by a potentially large number of contributors The content managed includes computer files, image media, audio files, electronic documents and web content. The idea behind a CMS is to make these files available interoffice, as well as over the web. A Content Management System would most often be used as an archive as well. Many companies use a CMS to store files in a non-proprietary form. Companies use a CMS to share files with ease, as most systems use server-based softs. Working with a CMS does not requires advanced web-dev skills. Predefined Functions and design (can be altered) that can make a good website in no time. (Few Popular CMSs for PHP) 1.Phpnuke 2.Joomla 3.PhpWebsite 4.Nucleaus CMS 5.Php-Fusion Additional Resources • • • • • PHP Manual http://docs.php.net/ PHP Tutorial http://academ.hvcc.edu/~kantopet/php/index.php PHP Coder http://www.phpide.de/ JEdit http://www.jedit.org/ PHP's creator offers his thoughts on the PHP phenomenon, what has shaped and motivated the language, and where the PHP movement is heading http://www.oracle.com/technology/pub/articles/php_experts/rasmus_php.html Hotscripts – A large number of PHP scripts can be found at: http://hotscripts.com/PHP/Scripts_and_Programs/index.html • Criticism of Php 1. PHP does not enforce the declaration of variables prior to their use, and variables which have not been initialized can have operations (such as concatenation) performed on them; an operation on an uninitialized variable raises a E_Notice level error hidden by Default) PHP has no namespace support, which leads to a very large amount of globally available functions that can easily number into the thousands. The standard function library lacks internal consistency (many functions have similar actions and have different name) Lack of late static binding Some portability issues with 32-bit and 64-bit integers (unsigned integers get converted to signed values) 2. 3. 4. 5. References • Wikipedia = http://www.wikipedia.com/php/ • Lynda.Com • Digit’s Fast Track to Web Design [July 2006] • Unleashed PHP5 • http://www.php.net/ Your Shout Queries

Related docs
premium docs
Other docs by shubhambpl
FAQS on Microsoft.NET
Views: 92  |  Downloads: 3
FAQS on Database Management System
Views: 87  |  Downloads: 5
C FAQs
Views: 20  |  Downloads: 2
C/C FAQS
Views: 25  |  Downloads: 5
Seminar on Network Security
Views: 155  |  Downloads: 8
FAQ of Operating System Concepts
Views: 384  |  Downloads: 13
Women
Views: 12  |  Downloads: 1
Global Warming
Views: 190  |  Downloads: 25
Green House Gases
Views: 132  |  Downloads: 0
Effects of Global Warming
Views: 263  |  Downloads: 23