PHP

From Site5Wiki

Jump to: navigation, search

Subpages:


PHP, a scripting language, is described best by this blurb from php.net:
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.


PHP has enjoyed a great deal of success over the years, and is one of the most requested offerings across the web hosting industry. So of course, Site5 offers PHP. In fact, Site5 offers versions 4 and 5, which are available on all our hosting plans automatically.

Contents

PHP Versions

By default on new Site5 hosting accounts, files ending in the extension .php will be parsed using PHP version 4. Files ending in .php5 will be parsed using PHP version 5. If you wish to override this default and have all files be parsed using PHP5, a .htaccess file can be placed in the directory you wish to use version 5 for .php files (if you want it site wide, just put the .htaccess file in your public_html directory). This .htaccess file needs to contain the following line somewhere in it (if this is all you're using this .htaccess file for, this would be the only line in the file):

AddHandler application/x-httpd-php5 .php

This will cause Apache to parse .php files as PHP5. As nothing has been specified to the contrary, .php5 files will also still be parsed by PHP5.

Command line (SSH) Parsing

To use PHP you can use:

php script.php

or for PHP5, you would use:

/usr/local/php5/bin/php5 script.php

Current Installations

Image:Info.png Yes, we do have both versions installed and available to every single customer.

last updated: --Tom 12:35, 25 January 2008 (EDT)

Version 4.x: 4.4.7
Version 5.x: 5.2.1

PHP for Beginners

Contents of this series of articles:

If you came here to learn about elementary PHP 4 or basic PHP 5, this is for you. Enjoy!

PHP 101 (part 1): Down the Rabbit Hole
An introduction to PHP’s variables and operators.

PHP 101 (part 2): Calling All Operators
The rest of the PHP operators (there are many), and simple form processing.

PHP 101 (PART 3): Looping the Loop
Basic control structures explained.

PHP 101 (PART 4): The Food Factor
Arrays, PHP array functions, and what it all means.

PHP 101 (PART 5): Rank and File
Everything you’re ever likely to need to know about dealing with external files from a PHP script.

PHP 101 (PART 6): Functionally Yours
All about functions, arguments, passing by reference, globals and scope.

PHP 101 (PART 7): The Bear Necessities
A gentle introduction to object oriented programming in PHP 4 and PHP 5.

PHP 101 (PART 8): Databases and Other Animals
All about connecting to a MySQL database from PHP, using the mysql or mysqli extensions.

(PHP 101 (PART 9): SQLite My Fire!
Introducing another database: SQLite.)

PHP 101 (part 10): A Session In The Cookie Jar
Sessions and cookies – how to keep track of visitors to your site.

PHP 101 (part 11): Sinfully Simple
An introduction to PHP’s easiest method for dealing with XML.

PHP 101 (part 12): Bugging Out
Basic error handling.

PHP 101 (part 13): The Trashman Cometh
A primer in basic security.

PHP 101 (part 14): Going to the Polls
Putting the pieces together – a first Web application.

PHP 101 (part 15): No News is Good News
Creating a simple RSS news aggregator.


PHP Modules

Site5 compiles in a slew of commonly requested modules for PHP, enabling the scripting language to make use of various features not found in its core installation. Here is a list of the default modules we offer on PHP4:

bcmath
calendar
ctype
curl
domxml
EXIF
FTP
gd
gettext
IMAP
mbstring
mcrypt
mhash
MySQL
openssl
overload
pcre
POSIX
pspell
session
sockets
standard
tokenizer
wddx
XML
XMLRPC
XSLT
Zend Optimizer
zip
zlib

The list of modules available by default on PHP5 differs slightly. Here is the default list for version 5:

bcmath
calendar
ctype
curl
date
DOM
EXIF
FTP
gd
gettext
hash
iconv
IMAP
LIBXML
mbstring
mcrypt
mhash
MySQL
openssl
pcre
PDO
pdo_sqlite
POSIX
Reflection
session
SimpleXML
sockets
SPL
SQLite
standard
tokenizer
wddx
XML
xmlreader
XMLRPC
xmlwriter
Zend Optimizer
zlib

PHP Resources

PHP is a widely used language, and as such there are a wide variety of resources available on the internet. While we couldn't possibly hope to provide you with a full list, here are a few of the sites that Site5 staff have found useful in the past:

  • php.net -- The home of PHP
    • Image:Feed.png daily news feed
    • Image:Report.png Introductory tutorial
      • Available in the following languages via pull-down menu:
        • Image:CPLP_flag.png Image:BR_flag.png Brazilian Portuguese;
        • Chinese (Simplified); Chinese (Hong Kong Cantonese); Chinese (Traditional);
        • Czech;
        • Danish;
        • Image:Sr_flag.png Dutch;
        • Finnish;
        • French;
        • German;
        • Greek;
        • Hebrew;
        • Hungarian;
        • Italian;
        • Japanese;
        • Korean;
        • Polish,
        • Romanian;
        • Russian;
        • Slovak;
        • Image:Ar_flag.png Image:Bo_flag.png Image:BR_flag.png Image:Cl_flag.png Image:Co-flag.png Image:Ec_flag.png Image:Gf_flag.png Image:Gy_flag.png Image:Py_flag.png Image:Pe_flag.png Image:Sr_flag.png Image:Uy_flag.png Image:Ve_flag.png Spanish; and
        • Swedish.



  • codegrrl.com -- help with PHP and MySQL
    taking the grr out of coding!






Books We Recommend

Core Web Application Development with PHP and MySQL, by Marc Wandschneider ISBN 9780131867161 Image:Page_find.png:



No Nonsense XML Web Development With PHP by Thomas Myer ISBN 9780975240205 Image:Page_find.png:


A practical and concise book that teaches XML from the ground up. This tutorial style presents various XML methodologies and techniques in an easy to understand way, whilst building a fully functional Content Management System by the end of the book.

Building Tag Clouds in Perl and PHP, by Jim Bumgardner ISBN 9780596527945 Image:Page_find.png:




* Image:Tag_red.png: a list of Image:Page_white_php.png specific code snippets, tips and tricks




Image:Answers.png answers/Code Image:Technorati.png technorati/tag/Code; technorati/posts/tag/Code
Image:Magnolia.png ma.gnolia.com/tags/Code Image:Tag_blue.png del.icio.us/popular/Code
Image:Tag_pink.png flickr/tags/Code: most interesting; tag clusters for Code; Flickr groups related to Code Image:Google.png Google/Code; GoogleBlogs search for Code; Google CodeSearch for Code
Image:OReilly.png O'Reilly/Code
Image:Reddit.png reddedit/Code Image:Digg.png digg/Code
Image:Bookmark_add.png furl/Code Image:Chart_organisation.png items tagged Code at SWIK
Image:Crowd.png jaiku/Code Image:Twitter.gif twitter/Code





Image:Tag_red.png Related wiki pages: .htaccess, PEAR, Scripting and Development Guide, Smarty, Installed software and their versions

Retrieved from "http://wiki.site5.com/PHP"
Personal tools