We are still actively working on the spam issue.
PHP (PHP Hypertext Preprocessor) is a server-side programming language that is very popular and often frowned upon. The acronym PHP was originally Personal Homepage, later to have its named changed to the more informative PHP Hypertext Preprocessor. It uses a C style syntax and even some basic C functions. PHP is very easy to learn and use; can make small to medium web projects but is not suitable for large web applications.
Known projects written in PHP:
- Facebook - Most visited botnet social networking site.
- Yahoo - Recently PHP but slowly transitioning into node.js.
- Wordpress - Popular blog web hosting service.
PHP is written inline with HTML documents, making it ideal for people who have experience with designing websites with HTML/CSS and want to create a more dynamic web experience. PHP is processed by the server before it is rendered in the browser.
All of the examples here assume that you have a rudimentary understanding of HTML and have web server software installed on your system, or access to a web server with PHP.
The PHP documentation is a valuable resource that should always be open in a separate tab when you're developing PHP projects.
<?php echo "Hello world!"; ?>
If you put this code into a file and give it a .php extension, it will render plain text to the web browser. If you embed PHP code in an HTML document, you must include the closing ?> tag, but if you have a pure PHP file the closing tag can and should be omitted (prevents extra newlines from being erroneously added and other errata; see ).
<?php // variable declaration $date = date("Y/m/d"); // using the variable with the echo function echo $date; ?>
The Date function is a great tool to show how PHP generates dynamic content. The above format displays the full year, the month and day all in numbers like so: 1999/02/16.
XAMPP is one solution for easy setup if you're that lazy.
Most package managers have a current version (5.x) of PHP being maintained. Server software needs specific tools to allow PHP to be executed on the system.
On a Debian based distribution, you must install the Apache web server, the PHP module and PHP itself.
$ sudo apt-get install apache2 libapache2-mod-php5 php5
Nginx requires you to have php5-fpm or php5-cgi installed and configured. This will show you how to install and configure php5-fpm with nginx.
You could, if you're silly, download WAMPserver but that is generally not the best move. However, if you were serious about PHP development you would use a dedicated server.