PHP
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server, generating HTML which is then sent to the client. The client would receive the results of running that script, but would not know what the underlying code was.
Installation
# Add the repository
sudo add-apt-repository -y ppa:ondrej/php5
# Update the repositories
sudo apt-get update
# Install PHP and CLI
sudo apt-get install -y php5 php5-cli
# Common modules
sudo apt-get install -y php5 php5-curl php-cli php5-mcrypt php5-intl php5-gmp
# Database and Cache modules
sudo apt-get install -y php5-mysql php5-sqlite php5-pgsql php5-memcached
# Image processing
sudo apt-get install -y php5-gd php5-imagick
php5-curl
PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.php5-mcrypt
this is an interface to the mcrypt library, which supports a wide variety of block algorithms such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it supports RC6 and IDEA which are considered "non-free". CFB/OFB are 8bit by default.php5-intl
this package provides a module to ease internationalisation of PHP scripts.php5-gmp
this package provides a module for arbitrary precision arithmetic via the GNU Multiple Precision (GMP) Arithmetic Library.php5-gd
PHP is not limited to creating just HTML output. It can also be used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM. Even more convenient, PHP can output image streams directly to a browser. You will need to compile PHP with the GD library of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with.php-imagick
Imagick is a native php extension to create and modify images using the ImageMagick API.
Configration
The configuration files for PHP are located in /etc/php5
. PHP can be configured separately for each context in which it’s used.
PHP modules can also be enabled/disabled from CLI
Enable:
sudo php5enmod apache2 mcrypt
Disable:
sudo php5dismod apache2 mcrypt
Sources: