What is PHP?
PHP is a server side scripting language. that is used to develop Static websites or Dynamic websites or Web applications. PHP stands for Hypertext Pre-processor, that earlier stood for Personal Home Pages. PHP scripts can only be interpreted on a server that has PHP installed. The client computers accessing the PHP scripts require a web browser only. A PHP file contains PHP tags and ends with the extension “.php”.
- PHP stands for Hypertext Preprocessor.
- As we said before it is a server-side scripting language.
- PHP is free and is an open source software product.
- The PHP scripts are executed on the server.
- PHP supports many databases (MySQL, Sybase, Oracle and many others.)
- PHP runs on different platforms (Unix, Linux, Windows.)
- PHP is compatible with almost all web-servers used today (Apache, IIS, etc.)
- A PHP file can contain plain text, HTML tags and scripts
- The PHP files can have one of the following extensions: php, php3 or phtml.
What do you need?
Before learning PHP Programming you need to have the following:
- Access to a web server (like Apache)
- PHP and MySQL should be installed on the web server
- The easiest way is to find a cheap web hosting plan that support PHP and MySQL (most of the web-hosting providers do.) For a couple of bucks a month you can get a virtual host. The advantage is that everything is already installed and that you can share your program (that you are going to write) with the rest of the world.
- If you don’t want to spend money, you can also install everything on your local machine. The easiest way is to install WAMP if you have a Windows machine and LAMP if you have a Linux machine. (WAMP = Windows Apache MySQL PHP and LAMP = Linux Apache MySQL PHP.) These packages install everything you need. Read the install manual of these packages for instructions. After installation you should have access to http://localhost in your browser.
Advantages of PHP
- Open source: It is developed and maintained by a large group of PHP developers, this will helps in creating a support community, abundant extension library.
- Speed: It is relative fast since it uses much system resource.
- Easy to use: It uses C like syntax, so for those who are familiar with C, it’s very easy for them to pick up and it is very easy to create website scripts.
- Stable: Since it is maintained by many developers, so when bugs are found, it can be quickly fixed.
- Powerful library support: You can easily find functional modules you need such as PDF, Graph etc.
- Built-in database connection modules: You can connect to database easily using PHP, since many websites are data/content driven, so we will use database frequently, this will largely reduce the development time of web apps.
- Can be run on many platforms, including Windows, Linux and Mac, it’s easy for users to find hosting service providers.
Disadvantages of PHP
- Not suitable for large applications: Hard to maintain since it is not very modular.
- Weak type: Implicit conversion may surprise unwary programmers and lead to unexpected bugs. For example, the strings “1000” and “1e3” compare equal because they are implicitly cast to floating point numbers