PHP: Get Started
What is PHP?
Christian Wenz
@chwenz
Agenda
Why PHP?
Installing PHP
PHP Quick Start
I've never thought of PHP as more
than a simple tool to solve
problems.
— Rasmus Lerdorf
Why PHP?
PHP: Hypertext Preprocessor (http://php.net/)
Scripting language, mostly used on web servers
Market share: approximately 40% (!)
In the TIOBE Programming Community Index Top 10 since 1999
Runs on virtually any web server and platform
Supports virtually any database
Open-source, actively maintained
Great supply of talent
History of PHP
1994: Rasmus Lerdorf started working on what would later become
PHP
1995: Release of version 1.0, named “Personal Home Page Tools (PHP
Tools)
1998: Release of PHP 3 with parser rewritten by Zeev Suraski and Andi
Gutmans
2000: Release of PHP 4, powered by new core, “Zend Engine”
2004: Release of PHP 5 (including improved OOP support)
2009: Release of PHP 5.3 (instead of PHP 6)
Installing PHP
http://php.net/downloads.php provides access to the source code and
external links to binary packages
Official Windows binaries: http://windows.php.net/
All-in-one installer: https://www.apachefriends.org/
Sets up PHP, Apache, MySQL, and more
Detailled installation instructions in the online manual:
http://php.net/install
Configuring PHP
php.ini configuration file (usually in the PHP installation directory)
Used for PHP settings, and to load extensions
Usually a server restart is required for changes to take effect
PHP Quick Start
PHP code is (usually) embedded into HTML files, or in its own PHP file
File extension: .php (unless configured otherwise)
<?php and ?> as delimiters
Other options exist, but are not recommended
Code output appears exactly where the code was
“Hello World”
PHP provides the luxury version of “Hello World”
phpinfo()
Outputs a lot of data about the PHP installation
Version information
Configuration options and settings
Installed extensions
Server environment variables
Can also be used to find out what the hosting partner has provided
Documentation
Available at http://php.net/manual
Shortcut: http://php.net/abc, e.g.
http://php.net/phpinfo
http://php.net/install
http://php.net/install.windows
Also available for download (and offline browsing)
Summary
PHP is the most popular server language for the web
PHP runs on all relevant server operating systems
phpinfo() provides all information about the current PHP
installation
The PHP manual at http://php.net/manual provides a great
documentation of the language and its extensions