Sunday, 31 July 2011

PHP Programming


PHP Programming


    PHP is a scripting language designed to fill the gap between SSI (Server Side Includes) and Perl, intended largely for the web environment. PHP has gained quite a following in recent times, and it is one of the forerunners in the Open Source software movement. Its popularity derives from its C-like syntax, and its simplicity. PHP is currently divided into two major versions: PHP 4 and PHP 5, although PHP 4 is deprecated and is no longer developed or supplied with critical bug fixes. PHP 6 is currently under development.
If you've ever been to a website that needs you to login, you've probably encountered a server-side scripting language. Due to its market saturation, this means you've probably come across PHP. PHP was designed byRasmus Lerdorf to display his resume online and to collect data from his visitors.
Basically, PHP allows a static webpage to become dynamic. "PHP" is an acronym that stands for "PHP:Hypertext Preprocessor". The word "Preprocessor" means that PHP makes changes before the HTML page is created. This enables developers to create powerful applications which can publish a blog, remotely control hardware, or run a powerful website such as Wikipedia or Wikibooks. Of course, to accomplish something such as this, you need a database application such as MySQL.
Before you embark on the wonderful journey of Server Side Processing, it is recommended that you have some basic understanding of the HyperText Markup Language. PHP is also being used to build GUI-driven applications;PHP-GTK is used to build graphical user interfac.          

Setup and Installation


  • Installation on Windows
    • Easy Windows Setup Instructions
  • Installation on Linux
  • Installation on Mac OS X
  • Uses of PHP
Note: Before contributing, check out the discussion page. How to write your examples.
 Examples

Front Page Cleanup

I think the front page needs to be cleaned up a little. The top sections are good along with the contents of 'The Basics' section but further down it gets a little disorganised. It needs to be cleaned up and filled in to make the front page more presentable. Also, do we really need a 'Contributors' section? I thought the point of Wikis was that everyone contributed, it seems against the ethos to attribute certain pages to certain people.

Working with Files


I plan on adding a section related to working with files. I will discuss mainly the use of the f(open|write|close) in conjunction with file() and file_get_contents() as well as devoting a small section to file_put_contents and how to emulate it with PHP 4.
I'm just checking that nobody is already working on a similar section. If I hear no response in a couple of days I will start work on the article on my Talk page and then tranfer it over upon completion.
The article will also make a reference to serialization. Since this could appear in both the Database section and the Session section, I was wondering if it was best to create a separate page and link to it from within all the other pages?

Naming policy?


I am not new to Wikipedia, but this is the first time I have looked at a Wikibook. I have some confusion about the template that says the book's title does not adhere to the "naming policy." What is wrong with the title, and how does it not adhere? Here I have seen discussions about the book's content, cover, PHP version, and so forth, but nothing regarding the name or that template. To anyone that may advise--thanks.
If you click on the link in the naming policy notice, you'll see the preferred naming convention. This wikibook used to use a colon (:) separator for sub pages, which resulted in the need to manually link to the index (example: hello world). Currently, the barely-existing PEAR page seems to be the only page still using the depricated naming convention. 

Version


Are we talking PHP version 4 or 5 here?
PHP5 was recently released, and features the ZEND II engine, which includes enhanced OOP(Object Oriented Programming) features, better XML support, and built in SQLite support.
PHP4, on the other hand, is still the prevalant web technology, and I suspect that most servers will not be offering PHP5 support for some time.
Either way, I suggest that OOP be included in the 'advanced php' section. I just don't know how to write it because of the discrepancies between php4 and php5. 
Ok, since I recieved no response, I will assume that this page is geared towards PHP5. I am going to start writing the OOP features accordingly. I will also edit the intro to make this obvious. 
I think for anything specific to one version, we should show the equivalent in the older / newer version if possible. 
I'd like to second this notion, and extend it. Whenever possible I think functions that are aviable in both versions should be used. For most of the introductory material it doesn't matter. OOP can be part of a later discussion, along with other major version 5 improvements. Since these books are perminant static things we can always drop discussion of version 5 when it becomes the standard (in other words we can stop singling out the difference at that point). I would expect most people learn PHP at the moment are still working in 4.

External links?


There are many "dead" links here to pages that don't exist on wikibooks, and will most likely never exist. For example: GUI or Rasmus Lardorf will most likely not get their own books. It's much more likely that they'll get a Wikipedia page(GUI already has one), and I think that's where those links should take you...
I'd say change them to link to Wikipedia if you find them then, just use common sense.

Smarty Templates

There is no reason to discuss Smarty Templates as part of the language. You can either hit them in a round about PEAR and Templating or put the package in a list of "useful" PHP projects.
While Smarty is not part of the core language, it is mentioned in many other PHP books, and it is a very useful to have knowledge of its features. However, I think merging Templates and Smarty would be useful.

Include/Require functions

There seem to be at least 3 sections which talk about require(_once) and include(_once) Headers and footers, Template and Including Files. Since these deal with basically the same subject, couldn't they be merged into a single page about the use of require and include, and a list/example of the uses of these functions? -- DorianGray
If I don't see any reasons why in the next few days I'll delete Templates and Headers and Footers and move all relevant content to Including Files.

Internal Functions?

I know that the PHP website has a lot of information about PHP's internal functions, but do we want to start highlighting the ones most used? I'm particularly interested in the mail() function myself.
<niallj 20:59, 3 September 2005 (UTC)> I would say that's unnecessary, unless it comes up in the course of a lesson. I feel that a structured, lesson based approached would be better. Example: a lesson on "Sending E-Mail with PHP" rather than "mail()", and "Working with Arrays" as opposed to "Array functions" or "array_sort()" </niallj>

MySQL in PHP5

Should it be mentioned that PHP5 on Windows no longer has MySQL support built in, but has it shipped as a separate DLL that needs to be referenced in php.ini?
Hi, i think that this should be mentioned in the php:mysql page, not the main page. I wrote that it should be downloaded separately -- User:Wykis

Sub-pages

<Jun-Dai 00:20, 3 Jun 2005 (UTC)> Shouldn't the pages for setting up your environment be on subpages? It makes this main page seem awfully noisy to have them right there. </Jun-Dai>
<davidd 23:05, 11 Dec 2005> I agree, I think there seems to be alot of emphasis on lesser PHP topics such as setup, templating etc. and there should be more PHP code and the setup stuff should be in a sub-topic</davidd>

Accessing files

I'd like to see a section on reading and writing from/to files. Anyone? Thanks!
I'm writing it now if no-one has any objections. I plan to put it in the basic section as a starter's guide to file manipulation.--Davidd
Reference source.

No comments:

Post a Comment