Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Saturday, January 5, 2008

3 Reasons Why PHP Message Boards Rock


f you are web designer, chances are you include forums on at least some of the sites you manage. If you haven't explored PHPBB2 you are missing out as this type of message board offers to designers a forum that is well supported, easy to manage, and above all else: free! Let's see why PHPBB2 is a hit with so many web designers.

Compared to some web designers, I am relatively new to the business. I created my first forum with MSN groups in 2002 then, six months later, I made the move over to EZBoard. Sure, it did not have all the bells and whistles of vBulletin and other corporate developed boards, but it did the trick for me. That is, until EZBoard was hacked and my livelihood nearly disappeared in moments some two years later!

In search of something different, I considered the move to vBulletin, but I was quite frankly not wanting to shell out license and upgrade fees on a regular basis. At the time of the EZBoard incident, I was running six forums, so I knew that I would eventually have about that many when I completed my transition away from EZBoard.

So, why PHPBB2? For three reasons:

1. It is free. Yes, absolutely! Since it is "open source" code, developed by the developers, it is offered as a free download to whosoever will. Believe me that is a big appeal and, apparently, many designers around the world feel the same way as over 200,000 people are members of their support forum.

2. It can be used across platforms. Whether you work in Windows or Linux, IIS or Apache PHPBB2 is usable and fully functionable.

3. Highly modifiable. Open Source extensibility is evident with the incorporation of PHP, HTML, CSS, and MySQL into the forum.

For the novice, PHPBB2 does take some getting used to especially since you are responsible for installing, maintaining, backing up, upgrading, and modifying your own forum. For your benefit you can access onsite Flash tutorials which are a great way to walk your way through the installation process too. As with any software it is vulnerable to outside attacks, so take care to make sure you regularly back up your forums and familiarize yourself with the security procedures.

In all, PHP message boards really do rock and at a price that cannot possibly be beat!

By Matthew Keegan

Should I Learn PHP and MySQL or Not?


I've had quite a few people ask me this question: "Should I learn PHP and MySQL?".

The answer is never easy. It all depends on what you're trying to accomplish. Are you looking to be involved in your own website? Is it being run on PHP and MySQL? What would you like to do with your website?

There's a million questions you can ask yourself. I, personally, believe that anyone who wants to become more involved with their own website or run their own Web Design and Development Company should, at the minimum, learn the basics of PHP and MySQL.

Why should you? Well, let's take a few examples...

Maybe you want to create a Members are on your site and you want to be able to offer downloads, use a more interactive Contact script, show information dynamically for your customers (i.e. Time and Date, Their personal information, the information they searched for last, Billing information, Download history, username and/or password, etc) to make it easier for them to browse through your site.

Maybe you want to be able to use PHP for your Search Engine Optimization needs? Needs such as 404 Redirects, 301 redirects, etc.

Maybe you need to create a built in search system for your e-commerce site? Maybe you're looking to simply redirect people to an Affiliate program?

See the many, MANY ways you can use PHP? It's a very valuable tool to know and understand. Imagine yourself having the knowledge to take a product like Wordpress and fully customize it to your own, personal, needs?

Think you can make money off of one of your Wordpress Plugin Ideas by knowing PHP? Think you can build a better Content Management System than what's currently available? What about a new Social Networking Script - OR Community?

Companies like PHPFox have made a killing with their php knowledge. Likewise for companies such as Mambo, vBulletin and various other scripts that you can purchase.

So the next question would be HOW you can learn PHP?

There's a million ways to learn but I try to explain to everybody that watching Videos and DOING the coding practices they ask you to do is how you'll learn quickly.

Sure... lot's of people have learned PHP by reading books. But I find the problem with books is a lack of support. You're always going to learn more by seeing and doing rather than reading and doing. Luckily there are solutions to this problem.

You can also visit popular forums such as Sitepoint, Digitalpoint and other Webmaster related forums or communities that allow other members to help with questions and answers.

No matter what you choose to do - just remember that DOING is how you learn. Practice without reading or watching. Just take the little knowledge you have at the time and make it grow with practice.

I hope you figure out what you need to accomplish and good luck!

By Clint Lenard

What Makes A PHP Web Hosting Companies Perfect


Most of us know PHP has revolutionized web designing and dynamic web programming since its public release in 1995. Main reason behind this is its stability, fast performance and FREE availability. With its ready to use source code, powerful core libraries, it has become one of the most popular scripting languages over the years.

We'll try to find out here some of the best companies supporting PHP web hosting.

Following are few points which must be looked into before going for any of the best web hosting company.


Reliability of the company

Disk Space offered

99.9% Uptime

Customer support

Data transfer / Bandwidth

Scripting support - CGI, PHP, ASP

Control Panel

FTP access

Multiple Domain and sub domain support

From our research and analysis, we've found out few companies offering the best web hosting in the market.

We've taken example of three companies among the web hosting providers 1.BlueHost, 2.GoDaddy and 3.HostMonster.

BlueHost offers $6.95/month (2 year) package which includes 300GB web space, host unlimited domains, 2500 e-mail accounts, e-mail forwarding and autoresponders, unlimited subdomains, 50 MYSQL databases, 50 postgre sql databases, CGI Support, Site statistics, Support for PHP and Flash, Additionally Blog, guestbook and mailing list and CMS (Mambo and Joomla) support, Streaming video and audio support, OS Commerce and SSL secure server support, FREE search engine submission.

GoDaddy offers $5.59/month (2 year) package (Deluxe plan) which includes 100GB web space, 1000 GB transfer, 1000 e-mail accounts, unlimited domains, 25 MySQL databases, unlimited e-mail forwards, support for forum, blog and photo galleries. Additionally offers $25 google adwords credit, $50 Microsoft adCenter credit.

HostMonster offers $4.95/month (2 year) package which includes 300GB web space, 3000GB transfer, unlimited domains and subdomains, unlimited e-mail accounts, forwarding and autoresponder support, CGI /PHP Support, 100 MySQL Databases, 100 PostGreSQL databases, Web statistics, Audio and video streaming support, Flash support, Real Audio and video Support, $50 yahoo credit, $50 google credit and search engine submission for your website.

If we carefully compare the packages offered by these companies, we can see that HostMonster offers the best package with $4.95/month for 2 years. You can follow the same guideline for choosing other best web hosting packages available out there.


By Ben Huang

Speeding PHP Using APC PHP Cache


If you look at a PHP source file you will notice one thing. It's a source file. Not particularly surprising, but think about when you deploy a PHP application, what do you deploy? PHP source files. Now for many other languages; Java, C, etc when you deploy an application you deploy the compiled file. So, the question that you want to ask yourself is this, how much time does a PHP application spend compiling source files vs running the code? I'll answer that for you, a lot.

There are advantages to being able to deploy source files though. It makes it easy to do on the fly modifications or bug fixes to a program, much like we used to do in the early BASIC languages. Just change the file and the next time it's accessed your change is reflected. So, how do we keep the dynamic nature of PHP, but not recompile our files every time they are accessed?

A PHP cache. It's surprising to me that this concept isn't built into the base PHP engine, but perhaps that's because some company's can sell this add on to speed up PHP. Luckily for us, some companies/open source projects provide this plug in to PHP at no charge. These plug ins are generally known as PHP accelerators, some of them do some optimization and then caching and some only do caching. I'm not going to pass judgement on which one is the best, any of them are better than nothing, but I decided to use APC, the Alternative PHP Cache. I chose this one because it is still in active development and is open source and free.

Alternative php cache can be found at php.net, just look down the left column for APC. It comes in source form, so you will need to compile it before installing it, don't worry about that part. If you're using Red Hat 4 or CentOS4 I'll tell you exactly how to do it. If you're using something else, you'll need the same tools, but getting the tools might be a bit different.

1. The Tools
Do you know how many web sites, forums and blogs I went to with my error messages before I found the answers as to what I was missing when I was trying to install APC - Alternative PHP Cache? Two days worth, but I finally found the correct combination and it's really quite obvious as is everything once you know the answer. There are three sets of dev tools that you will need.

1a. You'll need a package called "Development Tools" this will include all the important dev tools like the GCC compiler, etc.
1b. You'll need a package called php-devel which as you might guess are development tools for PHP
1c. You'll need a package called httpd-devel which of course are dev tools for Apache web server.

On Red Hat or CentOS getting these should be as easy as the following 3 commands:

yum groupinstall "Development Tools"
yum install php-devel
yum install httpd-devel

You'll do these three one at a time and follow any instructions (usually just saying yes).

Now it's time to follow the instructions contained in the APC package. Since these may change over time I'm not going to go through them. They are very complete. If you follow the instructions and get an apc.so file out of it, then you're all set, just modify your php.ini file and you're good to go.

There are two problems that I encountered that you may encounter too. The first is an error when running phpize. I ignored this error and everything succeeded okay, but not before I spent hours looking for the solution to this error. Here is the error.
configure.in:9: warning: underquoted definition of PHP_WITH_PHP_CONFIG

run info '(automake)Extending aclocal'

or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
configure.in:32: warning: underquoted definition of PHP_EXT_BUILDDIR
configure.in:33: warning: underquoted definition of PHP_EXT_DIR
configure.in:34: warning: underquoted definition of PHP_EXT_SRCDIR
configure.in:35: warning: underquoted definition of PHP_ALWAYS_SHARED
acinclude.m4:19: warning: underquoted definition of PHP_PROG_RE2C

People would have had me updating my PHP version from 4.3.9 and everything else under the sun to get rid of this error, but in the end it didn't matter. My APC compiled and installed nicely and I am good to go.

The other slight problem that I ran into was the location of php-config. The install instructions wanted me to do the following:

./configure --enable-apc-mmap --with-apxs
--with-php-config=/usr/local/php/bin/php-config

However my php-config is in /usr/bin/php-config. Making that change allowed this part to work.

So, have at it, once it's done you can expect to see huge improvements in your web site response times and reductions on your CPU load. One more quick note, My server hosts about 20 web sites, but only 3 or 4 are really busy. To reduce the memory footprint of caching everything for all 20 sites I used the apc.filters property. Although this property is slightly flawed for non qualified includes, it worked nicely for my Serendipity blogs. Your mileage with this property will vary according to the software you are using and how it does it's includes.

By Jon Murray

How to Use an RSS Feed to Provide Content for Your Website

Search engines love websites that are continuously updated with fresh content. As a website owner, if you want to achieve or maintain a good search engine ranking, then your goal should be to continually provide updated keyword–based content on a regular basis to your website. Naturally, if you're providing the content yourself, this takes a lot of work. Let me show you how you can get fresh, keyword-based content updated on your site on a daily basis with no work on your part using RSS feeds and PHP, and most of all, the search engines will love it!

RSS is an acronym that is short for Really Simple Syndication. It's a type of XML (eXtensible Markup Language) that is used for syndicating content. XML is used to describe data and is basically a markup language – like HTML.

Before I go into the list of items that are needed to make all of this work, I will mention that the details outlined in this article apply to websites that support PHP. PHP is a popular server-side scripting language that is used to create dynamic website content. If your website is running on a Unix-based operating system (like Linux), chances are your web server supports the PHP scripting language. Check with your web host to be sure.

Now, I can make this a long drawn out article on the technical details behind RSS, XML and PHP, but that would result in a boring article that hardly anyone would read! Instead, I'll just layout the necessary details for an entrepreneurial minded individual to setup a website using these technologies in a quick and least confusing fashion, I hope.

Task: Let's say we run a website on gardening and we want to use an RSS feed to add changing content to our site on a regular basis without us having to do any work.

Our goal is to make this new content readable by the search engine spiders. In order to do that, the content needs to be returned via server-side scripting – not client-side scripting (i.e. JavaScript). This is a mistake that a lot of websites that use RSS make.

You see, JavaScript is executed by the client; PHP is executed on the web server. When a search engine spider comes across a JavaScript 'script' tag, it stops spidering until it moves beyond the closing 'script' tag. On the other hand, PHP converts the script to HTML on the web server and sends the results back to the client (browser). So when a search engine spider comes across a web page that uses RSS with PHP, the spider only 'sees' the returned HTML – as if the PHP script were never there. So, PHP with RSS is definitely the route to take for SEO conscious website owners.

Here's what we need to accomplish our task:
1) An RSS feed link
2) An RSS Tool (PHP script) that can convert an RSS feed into HTML
3) An HTML output-template

Getting an RSS feed link...

A good place to start looking for an RSS feed is 2rrs.com, where you can execute an 'RSS Search' for the keyword 'gardening'. You'll likely see a bunch of results. Click on any of them. You'll now find an RSS2HTML link under the 'Details' section - which is your RSS feed link. Copy the full HTTP path to this link; we will need it for configuration in later steps.

Now we need to get an RSS Tool (PHP script) that can convert an RSS feed into HTML, and we also need an HTML output-template…

So, we need a method to take our RSS feed and convert it into HTML so we can insert it into our web page. The best way to do this is to use an awesome little PHP script called rss2html.php.

You can download this script here: http://www.feedforall.com/more-php.htm (Choose Option two -> Download)

Unzip the download file and you'll find a sample HTML output-template file called sample-template.html and an rss2html.php file. These files will eventually need to be moved to your web server, but before you do that, let's configure everything...

The PHP file is the work horse and does the RSS XML to HTML conversion, so there are some configuration settings within this file that need to be set. Open the file in a regular text editor (like Word Pad) and make the following 3 configuration changes:

Configuration change #1:
Find the following line of code: $XMLfilename = "sample.xml"; Change it to: $XMLfilename = "Your-RSS-Feed-Link";

The above line of code tells the PHP script where to get your RSS XML feed (file). Remember, the RSS XML feed contains the content which you are trying to add to your website. The website that you get your RSS feed from will update this feed as new content becomes available from the website. (Note: be sure not to download the XML file and specify a local path to it – this will result in your website always using the same XML file – which means your website will not be updated with new content from the RSS XML source.)

Configuration change #2:
Find the following line of code: $TEMPLATEfilename = "sample-template.html"; Insert your HTML output-template name in place of sample-template.html.

The rss2html.zip that you downloaded from the feedforall link above comes with a sample-template.html that you can use. However, the template from feedforall encompasses the entire HTML code for the entire webpage (from the opening 'html' tag to the closing 'html' tag). If you're inserting this content into your pre-existing webpage, then you'll likely only want to use the HTML code between the opening 'table' tag and the closing 'table' tag. This will allow you to insert a table into your webpage where each row represents an article from your RSS XML feed source.

Configuration change #3:
Find the following line of code: $FeedMaxItems = 10000;

The number '10000' above represents the number of items that you want to retrieve from the RSS feed – which works out to be the number of rows in your HTML table from the previous step. You can leave this setting as is, or you can change it to any positive number your like. For example, if you change it to 5, then the PHP script will display the top 5 RSS feed articles from your RSS feed source.

When you're done with these configuration settings you can upload these files to your scripts directory on your web server and add the following line of code to your website's HTML file where you would like the RSS feed content to appear:

include ('path_to_scripts_directory/rss2html.php');

Make sure to prefix the above line of code with a 'less-than' symbol followed by a question mark, as well as, postfix it with a question mark followed by a 'greater-than' symbol. Also, remember, if your webpage was initially an html file (i.e. filename.html) then you will want to change it to filename.php in order for the web server to know how to handle the above PHP script.

There you go... an easy way to add changing content to your website without any extra work on your part.

Sincerely,

By Michael Ellis

PHP Redirect - How to Send Someone to Another URL With PHP


When designing a web site, it is occasionally necessary to redirect a user to another URL to the one they have tried to access. This can normally be accomplished using HTTP redirect, however sometimes they just are not applicable or you would prefer to do it with PHP, for example:

1. If a page is undergoing some maintenance and you wish to redirect users to an error page.

2. As part of a PHP conditional IF statement you want to redirect to another page, perhaps you want to check if a user is logged in yet and if not redirect to the login prompt.

I am sure the are many other reasons that escape me at the time of writing for why you may wish to do this.

Fortunately PHP does provide a means to allow web designers to take this control. This task is accomplished by manipulating the header of a web page before it has been served. In order to redirect a page to an alternative URL replace the contents of the file with:

Note that if any output has been written to the browser (including HTML tags) this approach will not work, it must be either the only or the first output in the file. Therefore if you want to use it as part of a conditional logic test put that at the start of the file, for example:

OPEN PHP

IF(loggedIn == TRUE){

CLOSE PHP

…HTML output can go here

OPEN PHP

}ELSE{

header( 'Location: http://www.yourURL.com' ) ;

}

CLOSE PHP

In order to view the code correctly in this article the OPEN PHP and CLOSE PHP tags are used instead of the actual start and end tags for PHP code - to run the code you need to substitute them for the correct open and close tags.

This technique is an easy way to control the flow of control in a browser based PHP application. Generally if you wish to always redirect one URL to another you should use a HTTP redirect, but a PHP redirect is also an option.
Dave Hodgson is a technical consultant by career and a website designer for fun. He has spent time working for large systems integrators, small consultancy firms and on individual freelance projects. The articles written by Dave are in the nature of tricks and tips he has learned through his career and interactions with clients.

By Dave Hodgson

Using PHP and MySQL to Develop a Simple CMS - Version 1


In this article I'll try to describe how to develop a very simple Content Management System (CMS). I've chosen PHP as the server-side scripting language and MySQL as the database management system purely because I think they are fairly easy to use and they do the job very well.

I won't spend any time describing CMSs, what they are, or why you should or should not use them as there are plenty of excellent articles on this site that describe them perfectly well. I'll just explain one way of developing one.

This CMS consists of a single web page (index.php) that can have its contents updated by use of a standard form (updatePage.htm). The contents entered via the form are stored in a database, and are accessed and displayed by the web page. Although this CMS is too simple to be of any real use, it could be used as the starting point for a real life CMS solution. In subsequent articles I'll look at various ways to extend the CMS to make it more useful.

There are four files in this project:

cms.sql
updatePage.htm
updatePage.php
index.php

cms.sql
This file creates a database called cms, and creates a table in that database called page. It also loads some intial data into the table. You only need to use this file once.

updatePage.htm
This web page contains a simple form that can be used to enter the contents displayed by index.php.

updatePage.php
This is the form handler - the script that processes the data (entered in updatePage.htm) and inserts it into the database table (page).

index.php
This is the web page that displays the data held in the database table.

You can download a zip file containing these four files from http://www.computernostalgia.net/downloads/cms_v1.zip

cms.sql

1. CREATE DATABASE cms;
2. USE cms;
3. CREATE table page (
4. pageID integer auto_increment,
5. contents text,
6. primary key (pageID)
7. );
8. insert into page (pageID, contents) values ('1', 'dummy text');

Line 1 creates a database called cms in the MySQL database management system.

Line 2 tells MySQL to use the database for the subsequent commands.

Line 3 creates a table in the database.

Line 4 creates a column called pageID, which will contain integers, and which will be automatically incremented as new records are added to the table. As we only have one web page (index.php) in our imaginary website, we will only have one record and therefore one integer: 1. If we added additional pages to the table, they would be automatically numbered (2, 3, 4, etc).

Line 5 creates a second column called contents, which will contain text. This is where the editable contents displayed by index.php will be stored.

Line 6 sets pageID as the primary key, which you can think of as a reference for the table. As we only have one table, which will contain only one record, we won't make any use of the key. I've included it though because it's good practice to do so.

Line 7 simply closes the bit of code that was started in line 3.

Line 8 inserts some intial data into the table: 1 as the first (and only) pageID, and 'dummy text' as the contents of the first record.

updatePage.htm

(Note that for display considerations, I've inserted spaces into the HTML tag names, otherwise they would be processed as HTML code.)

1. <>
2. <>
3. <>Really Simple CMS< /title >
4. < /head >
5. <>
6. <>Really Simple CMS< /h1 >
7. < name="form1" method="post" action="updatePage.php">
8. Enter page content:<>< rows="10" cols="60" name="contents">< /textarea >


9. < type="submit" name="Submit" value="Update Page">
10. < /form >
11. < /body >
12. < /html >

This is just standard HTML, which probably doesn't really need explaining. All it does is present a form, the contents of which are sent to updatePage.php when the 'Update Page' button is clicked.

updatePage.php

1. < ?php 2. $contents=$_REQUEST['contents']; 3. mysql_connect("localhost", "root", "password"); 4. $result = @mysql_query("UPDATE cms.page SET contents='$contents'"); 5. mysql_close(); 6. ? >

This is the form handler, that's to say, the script that processes the data entered into the form (in updatePage.htm).

Line 1 signifies the start of a PHP script.

Line 2 requests the contents that were posted from the form. We could have written
$contents=$_POST['contents']; instead if we had wanted to.

Line 3 connects to the MySQL database server, setting up the host name, which I've assumed to be localhost, the database user, which I've assumed to be root, and the password needed to connect to the database. I have no idea what this would be for your system so I've just written the word password.

Line 4 updates the page table in the cms database with the new contents.

Line 5 closes the database connection.

Line 6 closes the PHP script.

index.php

1. <>
2. <>
3. <>Home Page< /title >
4. <>
5. <>Home Page< /h1 >
6. < ?php 7. mysql_connect("localhost", "root", "password"); 8. $result = mysql_query("select contents from cms.page"); 9. while ($row = mysql_fetch_assoc($result)){ 10. $contents = $row['contents']; 11. } 12. echo $contents; 13. ? >
14. < /body >
15. < /html >

This is the web page that displays the contents from the database. It's called index.php rather than index.htm because the web page contains PHP code. If the page was called index.htm, the PHP preprocessor, which is part of the web server, would not know that the page contained PHP code, and would therefore not try to process the script part of the page (lines 6 to 13). This would cause the script itself to be displayed in the browser rather than the HTML generated by the script.

Most of the lines in this web page are pretty straight forward and don't need explaining. Lines 6 to 13 contain the PHP script that extracts the contents from the database and displays (echos) it in the browser.

Installing/Running the CMS

To use the CMS you need to copy the files onto your web server into the area allocated for web pages. Your web server needs to support PHP and MySQL; if it doesn't, the CMS won't work.

You also need to use the correct database connection names and passwords (those used in the mysql_connect lines in the PHP scripts).

Exactly how you run the cms.sql file to set up the database and database table will vary from web server to web server so it's difficult to give precise instructions here. If you have a phpMyAdmin icon or something similar in your web servers control/administration panel you should be able to use that.

Once you've set up the database and table, you can simply browse to the updatePage.htm web page and update the database contents. You can then browse to the index.php page to view the updates.

If you have any problems or comments regarding the CMS, please email me at johndixon@computernostalgia.net and I'll be pleased to assist you if possible.


By John Dixon

PHP : A Functional Tool To Create Dynamic Web Pages


You can use PHP on almost every operating system and platform including: PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS.

PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd.

PHP uses procedural programming or object oriented programming, or a mixture of them. PHP is used mainly in server-side scripting; command line interface and writing desktop application.

Server-side scripting is the most traditional use for PHP. To use PHP for server-side scripting you need a PHP parser, a web server and a web browser. You enter PHP codes with the parser on a web server and it is translated into a PHP page that you can view on your web browser. However, it is also possible to make PHP script run without a server or browser. All you need is a PHP parser. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks.

While PHP is not the best language to use when writing a desktop application, it is possible. With PHP you can create a desktop application with a graphical user interface. If one is familiar with PHP and would like to use its features, there is PHP-GTK. With PHP-GTK you also have the ability to write cross-platform applications this way. However, PHP-GTK is an extension to regular PHP and not available in the main distribution.

While PHP websites are treated by web browsers as ordinary HTML pages, they are superior from regular websites in the sense that they have more features.

With PHP you are not limited to output HTML. PHP allows for the outputting of images, PDF files and even Flash movies. You can also output text in almost any form such as XHTML and any other XML file. PHP auto generates these files, and saves them in the file system, instead of printing it out. This forms a server-side cache for your dynamic content.

PHP supports a wide range of databases including Adabas D, InterBase, Postgre SQL, dBase, FrontBase,SQLite, Empress, mSQL, Solid, FilePro, Direct MS-SQL, Sybase, Hyperwave, MySQL, Velocis, IBM DB@, ODBC, Unix dbm, Informix, Oracle, Ingress and Ovrimos.

PHP also supports ODBC, the Open Database Connection standard which allows you to connect to any other database supporting this world standard.

PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol.

PHP has support for the WDDX complex data exchange between virtually all Web programming languages. PHP also has support for instantiation of Java objects and using them transparently as PHP objects.

PHP has text processing features. For parsing and accessing XML documents, PHP 4 supports the SAX and DOM standards, and you can also use the XSLT extension to transform XML documents. PHP 5 standardizes all the XML extensions on the solid base of libxml2 and extends the feature set adding SimpleXML and XMLReader support.

Between its functionality and its ease of use PHP is one of the best ways for anyone- be they a beginner or a veteran - to create a dynamic and interactive website to share with users of the World Wide Web.

By Mikhail Tuknov

Practical Uses of PHP


It almost goes without saying that you will want your business website to be compelling, interactive, and secure. All of these characteristics will make your website more effective at bringing in and keeping customers. But how to go about it in a way that is stable, cost-effective, and easy to manage? One popular solution is to use the server-side scripting language PHP to help you solve those problems.

What is PHP?

Created in 1995, PHP originally stood for "Personal Home Page", however it is now generally understood to mean "PHP: Hypertext Preprocessor". It was originally designed to create dynamic or more interactive web pages. It is a widely-used, open-source, general-purpose scripting language. PHP is a "high-level" language, meaning that it's generally more human-friendly (and easier to learn) than other programming languages such as C, ASP or ASP.net.

PHP was originally designed for use in Web site development, but rapidly grew to become a much more robust language. PHP's primary use is as an "embedded" scripting language, which means that the actual PHP code is embedded in HTML code. When used in this way, PHP enables your web server to process web pages before they're displayed in the user's web browser.
Benefits of PHP

PHP is popular because it can be embedded directly into HTML coding.

PHP can be used on all major operating systems and is supported on most web servers.

PHP's main focus is development for the web, so it has a quick development time and can solve scenarios much quicker than some of the other web design languages.

The latest version of PHP is a very stable and mature language used for web programming much like Java and Microsoft C#.

It is open source so it is free!

Database: It is very easy to write simple scripts which allow your Web site to interact with a database.

Cross-Platform: Both the PHP engine and the PHP code can be used on almost any platform, making it extremely versatile.

Development Tools: You only need a text editor to work on PHP; you do not need any development environment or compilers.

What can you do with PHP?

PHP generally runs on a web server, taking PHP code as its input and creating Web pages as output, however you can also use it for command-line scripting and client-side GUI applications. PHP is an extremely versatile language which enables you to create high-end, stable Web sites with plenty of bells and whistles. Here are just a few of the things you can do with PHP:

Make HTML Web Forms

Store Information in Databases

Remember Web site visitors (cookies and sessions)

Work with Arrays

Work with Files (File Management and downloads)

Parsing and Generating XML (also useful for large quantities of products on e-commerce)

Check which browser your visitor is using

How does PHP Work?

As its name ("PHP: Hypertext Preprocessor") suggests, PHP derives its power by "preprocessing" hypertext on the server side. This generally means that when the PHP script (saved as a .php file) runs on your web server, it performs the programmed actions, and returns HTML code that will then be sent back to your customer's web browser. The PHP script itself is not included in the HTML that is sent to the browser, so the PHP code is invisible and secure to the user.

For example, let's consider the following simple PHP statement. (This example is merely to show the basic syntax of PHP in action. Any detailed discussion of PHP code is beyond the scope of this article.)



In this statement, is the closing tag, and echo is a PHP instruction that tells PHP to output the text that follows it as plain HTML code. The PHP software processes the PHP statement and outputs the following:

<p>Hello World

This is a regular HTML statement that is delivered to the users browser. The PHP statement itself is not delivered to the browser, so the user never sees any PHP statements.

Using PHP to Improve Your Website.

PHP has many capabilities features designed specifically for use in Web sites, including the following:

1. Securing Your Website.

PHP can be used to secure your website (or certain areas of your website) so that your customer must enter a valid username and password. This can be used to reward preferred customers and to build an exclusive "membership" component of your business.

2. Working with Web Forms.

PHP can display an HTML form and process the information that the user types in. This can be an excellent way to learn more about your customers by asking them to provide profile information, and to collect information about their specific interests.

3. Communicate with Your Databases.

PHP is particularly adept at interacting with your databases, and storing information from the user or retrieving information that is displayed to the user. PHP handles connecting to the database and communicating with it, so it's not necessary to know all of the technical details for connecting to or exchanging messages with the database. You tell PHP the name of the database and where it is, and PHP handles the details. All major databases are currently supported by PHP.

4. Customer Loyalty Functions.

You can also use PHP to create a number of different functionalities on your website that will further help you to build customer loyalty, including interactive polls, a guestbook, and a message board.

The popularity of PHP continues to grow rapidly because it has many advantages over other technical solutions. PHP is fast (because it's embedded in the HTML code, the time to process and load a Web page is relatively short), PHP is free (it is open-source software), and PHP is versatile (is runs on a wide variety of operating systems, including Windows, Mac OS, Linux, and most Unix variants).

Perhaps most importantly, PHP is a very well-established language. There are many user-run Internet communities that make very large amounts of information (and scripts) available. With so much experience behind it, using PHP for certain dynamic features can be a cost-effective and low-hassle way of increasing the stability of your website.

by Jeremy Gislason

Basics Of Php


Practical Uses of PHP

It almost goes without saying that you will want your business website to be compelling, interactive, and secure. All of these characteristics will make your website more effective at bringing in and keeping customers. But how to go about it in a way that is stable, cost-effective, and easy to manage? One popular solution is to use the server-side scripting language PHP to help you solve those problems.

What is PHP?

Created in 1995, PHP originally stood for "Personal Home Page", however it is now generally understood to mean "PHP: Hypertext Preprocessor". It was originally designed to create dynamic or more interactive web pages. It is a widely-used, open-source, general-purpose scripting language. PHP is a "high-level" language, meaning that it's generally more human-friendly (and easier to learn) than other programming languages such as C, ASP or ASP.net.

PHP was originally designed for use in Web site development, but rapidly grew to become a much more robust language. PHP's primary use is as an "embedded" scripting language, which means that the actual PHP code is embedded in HTML code. When used in this way, PHP enables your web server to process web pages before they're displayed in the user's web browser.
Benefits of PHP

PHP is popular because it can be embedded directly into HTML coding.

PHP can be used on all major operating systems and is supported on most web servers.

PHP's main focus is development for the web, so it has a quick development time and can solve scenarios much quicker than some of the other web design languages.

The latest version of PHP is a very stable and mature language used for web programming much like Java and Microsoft C#.

It is open source so it is free!

Database: It is very easy to write simple scripts which allow your Web site to interact with a database.

Cross-Platform: Both the PHP engine and the PHP code can be used on almost any platform, making it extremely versatile.

Development Tools: You only need a text editor to work on PHP; you do not need any development environment or compilers.

What can you do with PHP?

PHP generally runs on a web server, taking PHP code as its input and creating Web pages as output, however you can also use it for command-line scripting and client-side GUI applications. PHP is an extremely versatile language which enables you to create high-end, stable Web sites with plenty of bells and whistles. Here are just a few of the things you can do with PHP:

Make HTML Web Forms

Store Information in Databases

Remember Web site visitors (cookies and sessions)

Work with Arrays

Work with Files (File Management and downloads)

Parsing and Generating XML (also useful for large quantities of products on e-commerce)

Check which browser your visitor is using

How does PHP Work?

As its name ("PHP: Hypertext Preprocessor") suggests, PHP derives its power by "preprocessing" hypertext on the server side. This generally means that when the PHP script (saved as a .php file) runs on your web server, it performs the programmed actions, and returns HTML code that will then be sent back to your customer's web browser. The PHP script itself is not included in the HTML that is sent to the browser, so the PHP code is invisible and secure to the user.

For example, let's consider the following simple PHP statement. (This example is merely to show the basic syntax of PHP in action. Any detailed discussion of PHP code is beyond the scope of this article.)



In this statement, is the closing tag, and echo is a PHP instruction that tells PHP to output the text that follows it as plain HTML code. The PHP software processes the PHP statement and outputs the following:

<p>Hello World

This is a regular HTML statement that is delivered to the users browser. The PHP statement itself is not delivered to the browser, so the user never sees any PHP statements.

Using PHP to Improve Your Website.

PHP has many capabilities features designed specifically for use in Web sites, including the following:

1. Securing Your Website.

PHP can be used to secure your website (or certain areas of your website) so that your customer must enter a valid username and password. This can be used to reward preferred customers and to build an exclusive "membership" component of your business.

2. Working with Web Forms.

PHP can display an HTML form and process the information that the user types in. This can be an excellent way to learn more about your customers by asking them to provide profile information, and to collect information about their specific interests.

3. Communicate with Your Databases.

PHP is particularly adept at interacting with your databases, and storing information from the user or retrieving information that is displayed to the user. PHP handles connecting to the database and communicating with it, so it's not necessary to know all of the technical details for connecting to or exchanging messages with the database. You tell PHP the name of the database and where it is, and PHP handles the details. All major databases are currently supported by PHP.

4. Customer Loyalty Functions.

You can also use PHP to create a number of different functionalities on your website that will further help you to build customer loyalty, including interactive polls, a guestbook, and a message board.

The popularity of PHP continues to grow rapidly because it has many advantages over other technical solutions. PHP is fast (because it's embedded in the HTML code, the time to process and load a Web page is relatively short), PHP is free (it is open-source software), and PHP is versatile (is runs on a wide variety of operating systems, including Windows, Mac OS, Linux, and most Unix variants).

Perhaps most importantly, PHP is a very well-established language. There are many user-run Internet communities that make very large amounts of information (and scripts) available. With so much experience behind it, using PHP for certain dynamic features can be a cost-effective and low-hassle way of increasing the stability of your website.

by Jeremy Gislason

How to Learn PHP and MySQL as Quickly as Possible


Learning Programming is a tough subject, no matter which language you choose.

It took me months to figure out php and MySQL enough to build real, quality, Websites that were "good enough".

Eventually I figured out the easiest way to learn. It took me MONTHS to figure it out... but I did.

So what does it take to learn a Programming Language such as PHP?

"Doing" is what it takes. 90% of the people who try to take on such a task end up feeling "dumb" or "slow". This usually is NOT the case. I've found that, like myself, most people try to learn PHP from reading and going through code to "understand" what it means.

I was the same way until I was told "just do it". My mentor must have been the most patient man on the face of this earth - because I was constantly telling him I could not do it. But he kept on me telling me the same line I'm telling you: "just do it".

What does this mean? It means trying to create your very own scripts, whether small or of decent size. Start out with printing out the date to the browser. Continue with Loops. Create scripts that create mathematical equations. Print out your name, last name, etc.

Once you figure out the basics, make sure you continue to learn by doing! You will never be able to take your skills to the next level just by reading.

I also stress to other newbies that they need to learn by watching as well. Writing code can become quite a task and it's better to see someone else do that, if possible (which it is by watching videos).

It's quite easy to get caught up in bad practices while writing code if you do not follow good programming standards. Sloppy (spaghetti) code seems to be the evil of the programming world that occurs from newbies who read online tutorials by so called "programmers". Most of these "programmers" are NOT what they claim to be. So be careful of whom you choose to learn from.

PHP and MySQL (database) go together like peanut butter and jelly. I cannot tell you how important it is to learn these two languages together. MySQL may not be the "best" Database in the world but it is very easy to learn and very capable of building large scale applications.

So remember: if you're not "doing", you're not learning. Start learning PHP basics and make sure you're following along and trying to code your own small scripts when starting out. I know, I know... it LOOKS like it's too hard. It's not. This is not something you're going to learn overnight, but it's quite possible that you can learn enough to do what you need to do in just a matter of weeks!

Keep learning and continue doing.

If you're looking to become a PHP programmer - you need to see these videos!

By Clint Lenard