PHP – An Introduction

download PHP – An Introduction

of 39

Transcript of PHP – An Introduction

  • 7/31/2019 PHP An Introduction

    1/39

    IIMT COLLEGE OF ENGG.

    GR. NOIDA

  • 7/31/2019 PHP An Introduction

    2/39

    COLLOQUIUM M.C.A. TOPIC

    PHP

  • 7/31/2019 PHP An Introduction

    3/39

    PHP An Introduction

    UNDER GUIDENCE :-MR. PRABHAT SIR

    PERSENTED BY:-

    BHOOPENDRA KUMAR MODANWAL

  • 7/31/2019 PHP An Introduction

    4/39

    INTRODUCTION

    1.Agenda

    2.History

    3.Why use php4.Getting start

    5.Advance PHP

    6.PHP CMS7.PHP Framework

  • 7/31/2019 PHP An Introduction

    5/39

    AGENDA

    1. Brief History of PHP

    2.Getting Started

    3.Advance PHP

    4.PHP C.M.S.

    5.PHP Framework

  • 7/31/2019 PHP An Introduction

    6/39

    Brief History of PHP

    PHP (PHP: Hypertext Preprocessor) was created byRasmus Lerdorfin 1994. It was initially developedfor HTTP usage logging and server-side formgeneration in Unix.

    PHP 2 (1995) transformed the language into a Server-side embedded scripting language. Added databasesupport, file uploads, variables, arrays, recursivefunctions, conditionals, iteration, regularexpressions, etc.

    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 .

  • 7/31/2019 PHP An Introduction

    7/39

    Brief History of PHP

    PHP 4 (2000) became an independentcomponent of the web server for addedefficiency. The parser was renamed the ZendEngine. Many security features were added.

    PHP 5 (2004) adds Zend Engine II with objectoriented programming, robust XML support

    using the libxml2 library, SOAP extension forinteroperability with Web Services, SQLite hasbeen bundled with PHP

  • 7/31/2019 PHP An Introduction

    8/39

    Brief History of PHP

    As of August 2004, PHP is used on 16,946,328 Domains,

    1,348,793 IP Addresseshttp://www.php.net/usage.php

    This is roughly 32% of all domains on the web.

    http://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.phphttp://www.php.net/usage.php
  • 7/31/2019 PHP An Introduction

    9/39

    Why is PHP used?

    1.Easy to UseCode is embedded into HTML. The PHP codeis enclosedin special start and end tags that allow youto jump into and out of "PHP mode".

    Example

  • 7/31/2019 PHP An Introduction

    10/39

    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, Microsoft IIS, Caudium, Netscape EnterpriseServer

    Operating Systems: UNIX (HP-UX,OpenBSD,Solaris,Linux), Mac OSX,

    Windows NT/98/2000/XP/2003

    Supported Databases: Adabas D, dBase,Empress, FilePro (read-only),

    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

  • 7/31/2019 PHP An Introduction

    11/39

    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.

  • 7/31/2019 PHP An Introduction

    12/39

    Getting Started

    How to escape from HTML and enter PHP modePHP parses a fileby looking for one of the special tags that tells it to startinterpreting the text as PHP code. The parser then executes all ofthe code it finds until it runs into a PHP closing tag.

    Simple HTML Page with PHPThe following is a basic example tooutput text usingPHP.

    My First PHP Page

  • 7/31/2019 PHP An Introduction

    13/39

    Examples

    PHP is a great way to implement templates on your

    website.

    How to implement a simple page counter

  • 7/31/2019 PHP An Introduction

    14/39

    Examples

    Step 1: Universal header and footer in a single file

    Step 2:Create a file called header.php. This file will have allof the

    header HTML code. You can use FrontPage/Dreamweaver tocreate the header, but remember to remove the closing and tags.

    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 extensionso that the server will process the PHP code. In this example,we assume the header and footer files are located in thesame directory.

  • 7/31/2019 PHP An Introduction

    15/39

    ExamplesBenefits:

    - 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

    Page 1

    Content

    Page 5

    Content

    Page 3

    Content

    Page 2

    Content

    Page 4

    Content

    Header

    Footer

  • 7/31/2019 PHP An Introduction

    16/39

    Advance PHP

    Advance PHP is basicaly devided into two

    part

    1.which is based on CMS

    2.which is based on frame work

  • 7/31/2019 PHP An Introduction

    17/39

    What is CMS

    The name CMS, Content System Management, is

    a vague term, since actually any software

    manages contents.

    More precisely one gives this name to a softwarewhich manages the creation and the publication

    of documents, possibly in a collaborative way.

    On this site, we will speak rather about CMS as

    Web applications, therefore software of

    assistance to put documents in line on Internet.

  • 7/31/2019 PHP An Introduction

    18/39

    Why a CMS?

    Content managers undertake the part common to the pages of your

    site and generates the pages starting from the text or of the data that

    you provide him. He thus delivers you repetitive tasks.

    He can be static and create the pages before they are put in lines, or

    dynamic and create the page at the request of the visitor.

    He does not bring anything about the contents itself, but makes it

    possible to manage the structure of the site, to add and classify the

    pages. The major CMS make it possible to manage a forum, a

    directory, news, most of the time by the addition of extensions.

    Sometimes it makes it possible to adapt the interface of the site, to

    generate more stripped printable pages or to make contributors

    taking part to the site.

  • 7/31/2019 PHP An Introduction

    19/39

    Type of CMS

    If we are taking about the CMS then it is more than 70 but some of CMS

    is given below

    Ariadne ,ArtiVelocity,B2evolution, BlogCMS,Caravel,CMS,

    Chlorine,BoardsChronoSite,Cwiab,CMSimple, CMSMdeSimp,CoppermineCuteNews, DBHcms , DotClear ,DokuWiki,

    Drigg,Drupal,e107, GroupWare,Elgg,Exponent ,eZpublish ,

    FluBB,Freeglobes,Geklog, GuppY, IntraLibre,Itseasy, Joomla!,

    lemon,CMS, Lodel,Mambo, MediaWiki, MidgardCS,Modx,

    NitroTech, NPDS, NucleusCMS, OpenPHPNuke, phpBB,

    Phorum,PHPMotion,PHPNuke, PhpdugPHPList, PhpMyFaq,

    phpWCMS

    http://www.ariadne-cms.org/http://b2evolution.net/http://blogcms.com/http://www.caravelcms.org/http://sourceforge.net/projects/chlorineboards/http://sourceforge.net/projects/chlorineboards/http://chrono.apinc.org/http://sourceforge.net/projects/churchwebsite/http://www.cmsimple-xh.com/http://coppermine-gallery.net/index.phphttp://cutephp.com/http://www.drbenhur.com/http://dotclear.org/http://www.splitbrain.org/projects/dokuwikihttp://drupal.org/http://sourceforge.net/projects/e107/http://www.egroupware.org/http://elgg.org/http://www.exponentcms.org/http://ez.no/http://fluxbb.org/http://www.freeglobes.net/http://www.geeklog.net/http://www.freeguppy.org/http://adullact.net/projects/intralibre/http://www.en1heure.com/itseasy/http://www.joomla.org/http://lemon-cms.sourceforge.net/http://www.lodel.org/http://mambo-foundation.org/http://www.mediawiki.org/wiki/MediaWikihttp://www.midgard-project.org/http://modx.com/http://www.nitrotech.org/http://www.npds.org/http://nucleuscms.org/http://www.openphpnuke.com/http://www.phpbb.com/http://www.phorum.org/http://www.phpmotion.com/http://phpnuke.org/http://www.kubelabs.com/phpdug/http://www.phplist.com/http://www.phpmyfaq.de/http://www.phpwcms.de/http://www.phpwcms.de/http://www.phpmyfaq.de/http://www.phplist.com/http://www.kubelabs.com/phpdug/http://phpnuke.org/http://www.phpmotion.com/http://www.phorum.org/http://www.phpbb.com/http://www.openphpnuke.com/http://nucleuscms.org/http://www.npds.org/http://www.nitrotech.org/http://modx.com/http://www.midgard-project.org/http://www.mediawiki.org/wiki/MediaWikihttp://mambo-foundation.org/http://www.lodel.org/http://lemon-cms.sourceforge.net/http://www.joomla.org/http://www.joomla.org/http://www.en1heure.com/itseasy/http://adullact.net/projects/intralibre/http://www.freeguppy.org/http://www.geeklog.net/http://www.freeglobes.net/http://fluxbb.org/http://ez.no/http://www.exponentcms.org/http://elgg.org/http://www.egroupware.org/http://sourceforge.net/projects/e107/http://sourceforge.net/projects/e107/http://drupal.org/http://www.splitbrain.org/projects/dokuwikihttp://dotclear.org/http://www.drbenhur.com/http://cutephp.com/http://coppermine-gallery.net/index.phphttp://www.cmsimple-xh.com/http://sourceforge.net/projects/churchwebsite/http://chrono.apinc.org/http://sourceforge.net/projects/chlorineboards/http://sourceforge.net/projects/chlorineboards/http://www.caravelcms.org/http://blogcms.com/http://b2evolution.net/http://b2evolution.net/http://b2evolution.net/http://www.ariadne-cms.org/
  • 7/31/2019 PHP An Introduction

    20/39

    Type of CMS

    phpWebSite, phpCMS, PhpWiki, PivotPligg,PmWiki,

    PortalPHP, Prestashop,SEOToaster,SilverStripe,SMF,Spip,

    Storytlr,Templeet, Textpattern,TikiWiki,Typo3 , Wikkawiki,

    Wordpress,Xaraya, Xoops,Zikula.

    http://phpwebsite.appstate.edu/http://phpcms.de/index.en.htmlhttp://phpwiki.sourceforge.net/http://www.pivotlog.net/http://pligg.com/http://www.pmwiki.org/http://www.safari-msi.com/portailphp/http://www.prestashop.com/http://www.seotoaster.com/http://www.silverstripe.org/http://www.simplemachines.org/http://www.spip.net/http://storytlr.org/http://www.templeet.org/http://textpattern.com/http://info.tiki.org/tiki-index.phphttp://typo3.com/http://wikkawiki.org/http://wordpress.org/http://www.xaraya.com/http://www.xoops.org/http://zikula.org/http://zikula.org/http://www.xoops.org/http://www.xaraya.com/http://wordpress.org/http://wikkawiki.org/http://typo3.com/http://info.tiki.org/tiki-index.phphttp://textpattern.com/http://www.templeet.org/http://storytlr.org/http://www.spip.net/http://www.simplemachines.org/http://www.silverstripe.org/http://www.seotoaster.com/http://www.prestashop.com/http://www.safari-msi.com/portailphp/http://www.pmwiki.org/http://pligg.com/http://www.pivotlog.net/http://phpwiki.sourceforge.net/http://phpcms.de/index.en.htmlhttp://phpwebsite.appstate.edu/
  • 7/31/2019 PHP An Introduction

    21/39

    Top popular Type of CMS

    1. Joomla

    2. Drupal

    3. Wordpress

    4. FluxBB

  • 7/31/2019 PHP An Introduction

    22/39

    Joomla Introduction

    Introduction to the popular Joomla CMS (ContentManagement System) and its use. This strangename was chosen among many others! It is aSwahili word that expresses the community vision

    of the tool.Joomla uses are quite varied: portal, magazine, e-commerce.

    In April 2010, Microsoft has signed the Joomla!

    Contributor Agreement and now contributes tothe code for it to work better on its WindowsIIS server.

    http://www.iis.net/http://www.iis.net/http://www.iis.net/http://www.iis.net/http://www.iis.net/http://www.iis.net/http://www.iis.net/
  • 7/31/2019 PHP An Introduction

    23/39

    Advantages of Joomla

    (since version 1.5.9) Upload images in the library.

    Display articles randomly selected to publicize the oldest content,besides more recent additions.

    Print format for each item.

    Sending emails to announce a new article.

    Insertion of a poll in each article (available on Drupal too).

    Banners manager.

    Custom look and feel selected by each user.

    Search field associated with a statistical research tool for the site.

    Syntax-hightlighting for code.

    Possibly assigning a different template for each page.

    Integrated Forum (Extension).

    Integrated FAQ (Extension).

  • 7/31/2019 PHP An Introduction

    24/39

    Drawbacks of Joomla

    Documentation is the weak point of this CMS. We donot even see on the site a list of features of thesoftware, we must pick them up on other sites. Apart aPDF file somewhere on the site I found through

    Google.The wiki and more precisely theAbsolute BeginnersGuide to Joomla provides some information.

    Joomla has only two levels of hierarchy whileWordpress allows you to add sub-categories without

    limitation. That's enough for a site of entrerprises or e-commerce but Joomla is not suitable for adocumentary website.

    http://docs.joomla.org/Beginnershttp://docs.joomla.org/Beginnershttp://docs.joomla.org/Beginnershttp://docs.joomla.org/Beginnershttp://docs.joomla.org/Beginnershttp://docs.joomla.org/Beginners
  • 7/31/2019 PHP An Introduction

    25/39

    Drupal Introduction

    Drupal is a content management systemautomated with which the user can simply writewithout worrying about categorization and otheraspects of site management. But considered in

    this way, Drupal must be installed by anexperienced webmaster, because the originalsetup is limited to basics, there is not even amenu of categories, and it is with the addition of

    modules that we will provide to a site all thefeatures of the Web 2.0: tag cloud, display ofrecent articles, RSS feeds, statistics of visits, etc..

  • 7/31/2019 PHP An Introduction

    26/39

    Advantages of drupal

    The CCK is now part of the core software and is no longer a module.The Content Construction Kit allows to create new types of pages.

    Like Wordpress, you can upload images and make manipulations.

    The interface is simpler, more intuitive.A designer has been specially hired to redesign the interface.

    An update manager is added. Custom fields allow to extend the pages without creating new

    types. This comes from Wordpress.

    All databases may be used now as the software interacts with aninterface layer.

    The Drupal Theme Garden is a repository of themes under the GPL,thus freely usable.

    Drupal 7 is faster due to improved access to the database.

  • 7/31/2019 PHP An Introduction

    27/39

    Disadvantage of drupal

    Drupal is compatible with the data but not withthe code. A new version may require thewebmaster or module developer to change thecode he added to suit the new version.

    But they may still use the contents of thedatabase.

    However, the code compatibility is maintainedbetween minor versions.Drupal 7 becomes

    incompatible with Drupal 6, but Drupal 6.1, 6.2,6.3 etc. remain consistent when the code ofDrupal 6.0.

    d d

  • 7/31/2019 PHP An Introduction

    28/39

    Wordpress Introduction

    Wordpress is both a host ofblogs, Wordpress.com with four million hostedblogs in 2008

    There are other blogging software such as

    dotclear, but Wordpress, through its manycontributors has a very broad range of pluginsand themes that make it nearly universal andprovides almost all the features that we could askfor. We can give it also a more general use,building even a platform for e-commerce.In addition it makes low use of resources and isoptimized for SEO.

    http://wordpress.com/http://www.scriptol.com/seo/http://www.scriptol.com/seo/http://wordpress.com/http://wordpress.com/http://wordpress.com/
  • 7/31/2019 PHP An Introduction

    29/39

    Advantage of Wordpress

    1. Cheap or FreeUsing WordPressfor your website means its cheap or free.WordPress itself is free, a theme is easily under $100 or evenfree and you save loads of money (compare the cost oftemplatevs custom design). Havent you heard? Stingy is in.

    2. Its That EasyIf youve got any computer savvy, WordPress is easy to use. If youcan send an e-mail, use Microsoft Word or set up a Facebookaccount, then you can use WordPress. And normal use doesntrun the risk of mucking up the design. Its website creation fornon-techies.

    3. Do It YourselfWith WordPress you enter the Do-It-Yourself world. No morewaiting for and paying a programmer to fix a tiny error, savingyou time and money.

    http://wordpresscms.ithemes.com/basics/whats-wordpress/http://wordpresscms.ithemes.com/basics/whats-wordpress/http://wordpresscms.ithemes.com/basics/whats-wordpress/http://ithemes.com/custom-web-design-versus-template-web-design/http://ithemes.com/custom-web-design-versus-template-web-design/http://ithemes.com/custom-web-design-versus-template-web-design/http://ithemes.com/custom-web-design-versus-template-web-design/http://ithemes.com/custom-web-design-versus-template-web-design/http://ithemes.com/custom-web-design-versus-template-web-design/http://ithemes.com/custom-web-design-versus-template-web-design/http://wordpresscms.ithemes.com/basics/whats-wordpress/
  • 7/31/2019 PHP An Introduction

    30/39

    Advantage of Wordpress

    4. Many Users, Many PlacesWordPress is online and offers multiple users, which meansyoure not the only one who can fix something in a pinchand you can access it from anywhere. Which means ifyouve got Internet access in Tahiti, you could work from

    there. That also means your important site is backed up ona secure server with multiple redundancies, not some highschool kids laptop.

    5. Climb the Search Results

    WordPress also makes it easier to optimize your searchengine results. That means your site is more likely to landon the first page of Google results, which means people aremore likely to find you.

  • 7/31/2019 PHP An Introduction

    31/39

    Disadvantage of Wordpress

    Many of the themes have a tendency to lookthe same or similar.

    PHPs track record for security is pretty bad.

    Database queries may be very heavy It isnt a full CMS product which is fine for a

    lot of sites but if your site is moving a long

    way away from something based around ablog then you might find it starts to creak abit!

  • 7/31/2019 PHP An Introduction

    32/39

    What is framework

    The idea behind a framework is to offer a design you can

    use across multiple applications. All applications have a

    number of basic things in common.

    A framework is designed to provide a structure for those

    common elements (database interaction, presentationlayer, application logic) so you spend less time writing up

    database interface code or presentation-layer interfaces

    and more time writing the application itself. The

    architecture represented by breaking an application up inthis fashion is referred to as Model-View-Controller

    (MVC). Model refers to your data, View to your

    presentation layer, and Controller refers to the application

    or business logic.

  • 7/31/2019 PHP An Introduction

    33/39

    Why a framework

    There's a reason why PHP is growing rapidly as aserver-side scripting language it's very easy topick up. Many functions are included withoutneeding any sort of namespace importing, and you

    don't even have to write OO code if you don't wantto. Variables are weakly typed and the syntax isfairly familiar.

    But PHP's ease of use is also its downfall. Because

    there are less restrictions on the structure of thecode you write, it's much easier to write bad code.But there is a solution: use a framework.

  • 7/31/2019 PHP An Introduction

    34/39

    Type of framework

    1.Cake PHP

    2. Symfony PHP

    3.Prado

    4.Kohana

    5.Codelgniter

    6. Akelos

    7.Zend Framework

    8.Solar Framework

  • 7/31/2019 PHP An Introduction

    35/39

    Type of framework

    9 . Yii PHP Framework

    10. Maintainable

    11.Seagill

    12.Fuse

    13.Phoco

    14.Limb

    15.Zoop

    16.Blue Shoes

  • 7/31/2019 PHP An Introduction

    36/39

    Cake PHP

    CakePHP is a rapid development framework

    for PHP that provides an extensible

    architecture for developing, maintaining, and

    deploying applications. Using commonlyknown design patterns like MVC and ORM

    within the convention over configuration

    paradigm, CakePHP reduces developmentalcosts and helps developers write less code.

  • 7/31/2019 PHP An Introduction

    37/39

    Zend Framework

    The Zend Framework is an object-oriented

    framework written strictly in PHP 5.

    It'ssimple, easy to work with, and has a

    loose architecture that lets you use various

    Zend components to enhance your

    applications functionality.

  • 7/31/2019 PHP An Introduction

    38/39

    Symfony PHP

    The Symfony PHP Framework holds a

    library of various classes written in PHP 5.

    Architecture, useful components and

    excellent tools are provided for creating

    complex web apps.

  • 7/31/2019 PHP An Introduction

    39/39

    Solar framework

    Solar is a PHP 5 framework for web

    application development. It is fully name-

    spaced and uses enterprise application

    design patterns, with built-in support for

    localization and configuration at all levels.