0
Why Use PHP and PostgreSQL as a Team?
Free software is not free beer
At the beginning of the Internet age, many Web sites were based on Perl applications, which were using the CGI interface. With the help of the CGI interface, it is possible to use every programming language for generating HTML code on-the-fly. The programming language Perl is optimized for building text processors, so it is a great tool for building Web sites. HTML code is based on text, so dynamic pages can easily be generated. However, Perl was not designed to be a Web language. Especially when running Perl, using the CGI interface is very common. Other programming languages such as PHP can have several advantages over Perl because PHP has been optimized for the Web. Of course, you can use mod_perl, but an increasing number of people rely on PHP.
Both PHP and PostgreSQL are open source, which means that the source code of PHP and PostgreSQL can be used and distributed freely. Using open source software has several advantages:
Costs— You don't have to pay for the software, which helps reduce the total cost of your software projects.
Security— Free software is said to be more secure than commercial software. In many cases security updates for free software are available quickly, so severe security problems will not last a long time.
Information— When using commercial software, you might not know exactly what a certain component does. In this case free software will be helpful because you just have to look at the source code of PHP or PostgreSQL and you will find out what the code does.
Independence— Free software helps you to gain independence from software manufacturers. This is important because you need not follow the update path proposed by a big player in the software business.
Quality— In most cases free software contains high-quality code. People implementing open source are highly motivated, so free software offers stability as well as flexibility.
Freedom— Free software offers the possibility to modify the software to your needs. Features can be added easily, and in addition, you can optimize the software for your application.
The last point especially is truly an important one. "Free software is not free beer"—this is what Richard M. Stallman, the father of free software, has to say about open source. Freedom means that nobody can force you to stick to a concept and nobody threatens your personal freedom. If you have no chance to modify your software, your mind is not free and this must be avoided.
Today a variety of free databases are available. Many developers rely on databases such as MySQL. MySQL offers a special version of SQL that is not ANSI-SQL–compliant. Especially when porting MySQL applications to other databases, MySQL's incompatibility is a real problem because you might have to rewrite or at least modify major parts of your SQL code. In addition, PostgreSQL provides highly sophisticated features such as inheritance, triggers, and embedded languages.
In contrast to MySQL, PostgreSQL is ANSI SQL-92–compliant. Therefore porting applications to PostgreSQL is an easy task, and it is also possible to switch from PostgreSQL to a commercial database such as DB2 or Oracle.
PHP provides an easy-to-use interface to PostgreSQL. PHP's programming interface is built on PostgreSQL's libpq library. This library is used by all important programming languages such as Python, Tcl, or Perl and provides all the features you will need to build powerful database applications.
From book : PHP and PostgreSQL: Advanced Web Programming, by Ewald Geschwinde, Hans-Jürgen Schönig