The Advantage of Using PHP and MySQL
May 10, 2017
One of the first choices to make when planning a new web site is if it should be static or dynamic. Static web sites show the same content to each visitor. Of course there can be more than one page on the site, but the content is fixed. On dynamic web sites the content can change. Visitors can interact with it. For example it might be possible for them to leave a comment for other visitors to see. In general a dynamic web site offers much more possibilities. But if you only want to give a short presentation of yourself or a company, the static solution might be the answer. However in most other cases the dynamic web page is the way to go.
Static pages consists of HTML files generated locally on your PC and then uploaded to the web server. This can be done in dedicated programs like Adope Dreamweaver, Microsoft Expression Web or Coffeecup HTML Editor. If a change is to be made the files are changed on the PC and then uploaded to the server again.
To create dynamic web pages you need to use a script. That means the web server reads and “translates” the file instead of just sending it as it is to the web browser. PHP is a commonly used script language. Almost all web hosting provides have it even in the entry level packages.
Example of PHP:
Echo "Hello world!";
The above example shows the text Hello world! PHP and HTML can easily be mixed in one file. Start and end tags shows the server what is PHP and HTML. In the same way as HTML files PHP files can be created in any editor that can save files as plain text. The example don’t really show the real strength of PHP. What makes it well suited for dynamic web pages is the ability to connect to a database. This gives the possibility to store and receive information. This can be used for a wide variety of information such as user names, comment, article texts and so on. This also means you can add information to your web page from any computer with Internet access.
A popular database is MySQL. Both PHP and MySQL are Open Source software and there and many resources for support available.
But even if you don’t want to learn how to program PHP and SQL, it is still possible to reap the benefits of this strong combination. There are many projects that develop scripts you can use for free on your own web page. WordPress is a blogging software. Once it is set up and running it is very easy to add new posts to your page. Another solution is to get a CMS (Content Management System) like Joomla. The script files comes with instructions on how to install them, so it can be done with a minimum of knowledge of PHP. Some web hosts has even made it more easy. They offer an installation script, where you only have to provide a few lines of information, the system takes care of the rest. You can also get other solutions like Forums or bulletin boards programmed in PHP and ready to run.
PHP and MySQL is also a very scalable solution. From a private web page or blog hosted on a cheap hosting provider up to really big social networks. For example is Facebook based on PHP and MySQL.