Thursday, 21 April 2011

LEARN HOW TO WRITE PHP SCRIPTS - INTRODUCTION




PHP (PHP: Hypertext Preprocessor) is a server-side scripting language which is free and widely used in web development: it allows you to build dynamic websites with the use of dabatases such as MySql databases (which can be queried by using SQL commands from your PHP scripts). PHP is compatible with a large number of servers (e.g. Apache) and platforms (Linux, Windows, Unix), is an open source software, and is very intuitive and easy to learn.

The purpose of this series of tutorials on PHP is to introduce you to the PHP language. Another series of tutorials will later be dedicated to the use of MySql databases and the SQL language. However, you have to keep in mind that only the combination of PHP with the use of databases allows you to create truly dynamic websites. We decided to separate the study of PHP from that of MySQL databases for practical reasons (one of them being that PHP can support many other types of databases, such as Oracle, Access, PostgreSQL, Generic ODBC, but we decided on MyComputerForum to introduce MySQL databases only because they are free, widely used, and a strong community and efficient support has been built around the MySQL solution).

LEARN HOW TO WRITE PHP SCRIPTS - RUNNING PHP ON YOUR SERVER

(in this case your web host can very well block your account for resource abuse).
Before you can develop in PHP, you must be sure that PHP is installed on your server (this will guarantee the execution of the PHP scripts). You can ascertain this by asking your web host, or more simply by looking at the description of your web hosting plan; depending on the situation, for backward compatibility issues, you might also want to check which version of PHP is installed on your server. If you have your own dedicated server, you can install the last version of PHP yourself (it can be downloaded for free on the Internet at php.net).


When developping in PHP, you need to run a local server on your machine in order to check that your scripts function correctly (unless you are so sure about your programming skills that you believe such a verification won't be necessary).
I recommend that you use WAMP, which is a package comprising an Apache server along with the last version of PHP and MySQL; it can be run locally on your computer.
You could also prefer to dowload each component independently (i.e. download PHP at php.net, the Apache server at apache.org, and later on MySql at mysql.com). However, if you do this, you will have to configure your web server yourself in order to establish the communication between all these components.


An alternative is to conduct the tests directly on your web server, but this can be slower and unnecessarily costly, since it will use up bandwith and CPU. Moreover, this can be a problem if you are on a shared server a  this can be a problem if you are on a shared server and a programming mistake triggers a CPU overflow (in this case your web host can very well block your account for resource abuse).

No comments:

Post a Comment