About PHP

About PHP

PHP is an acronym of hypertext preprocessor. It is a server side language through which we can make a dynamic web page by embedding PHP code into HTML. To run PHP pages you need to have following installation on your system/machine.

OS (Operating System) -> Windows/Linux

Server -> IIS/Apache

Database -> MySQL, MSSQL, ORACLE, MSACCESS, PostgreSQL etc.

PHP -> PHP Installation on System

You can easily run PHP on Windows by installing WAMP server. WAMP stands for Windows+Apache+MySQL+PHP and popularly used as development platform next to LAMP (Linux+Apache+MySQL+PHP).

A sample PHP page script starts as follows:

=========CODE BEGINS========

<?php // PHP Begins

echo 'Hello World'; //(echo) Print Output on Screen

?> //PHP Ends

=========CODE ENDS==========

There are various support and tutorials available for PHP. Some popular resources are:

http://www.php.net (PHP site)

http://www.mysql.com (MySQL site)

http://www.w3schools.com/PHP (PHP Tutorials)

#507926

Thanks for the info!

Nah, just kidding.

#508001

This post is confusing me oO

#508040

Man, thanks.

You saved me a lot of googling!

#508057

In Soviet Russia, Google saves YOU!

#508060

This topic is really confusing me, what made him think it would help someone? You can find informations about PHP all over the web Oo

#508073

have you considered python instead of php?

#510197

Ha, this is funny.

<?php // PHP Begins

echo 'Hello World'; //(echo) Print Output on Screen

?> //PHP Ends

If the person who wrote this really knew php, they would have written the above as what I wrote below

<?php // PHP Begins
echo "Hello World"; //(echo) Print Output on Screen
/* PHP Ends */ ?>

You can't put a // comment after you close the php tag.

My message in php

<?php
if (!isset($_GET['know'])) {
$message = "Fail";
}
else {
$message = "Wow, you actually know php?
";
if (isset($_POST['lie'])) {
$message .= "No you don't";
}
else {
$message .= "I guess you do.";
}
}
echo $message; // Let's find out whether or not you really know php
?>

EDIT: I'm bored, so I wrote this real quick

<?php
if (file_exists('inc/configuration.php')) {
require_once('inc/configuration.php);
if (isset($_GET['post']) && $_GET['post']!="") {
$mysql_query = mysql_query("SELECT * FROM mydatabase WHERE post = ".intval($_GET['post']));
if (!mysql_query) {
echo "Error Occurred: Query Failed to Retrieve Data";
}
else {
while($rows = mysql_fetch_array($mysql_query) {
$postTITLE = $rows['title'];
$postTEXT = $rows['text'];
$postBY = $rows['by'];
}
$message_block = "<div align="center"><div style="width:604px;"><div style="width:300px;float:left;">".mysql_real_escape_string(htmlentities($postTITLE))."</div><div style="width:300px;float:right;">".mysql_real_escape_string(htmlentities($postTEXT))."</div></div><div style="width:604px;">Post By ".htmlentities($postBY)."</div></div>";
echo $message_block;
}
}
else {
echo "Welcome to the Site!";
}
}
else {
echo "Error Occurred: Configuration File is missing";
}
?>

------------

By the way, hello all. I was searching the internet for something else but noticed that there was a web programming area and decided to join because this post made me laugh.

#510336

I'll just complement on your kindness platter007. But these people are not beginners. :)

#519462

PHP is a server-side scripting language for creating dynamic Web pages. You create pages with PHP and HTML. When a visitor opens the page, the server processes the PHP commands and then sends the results to the visitor's browser, just as with ASP or ColdFusion. Unlike ASP or ColdFusion, however, PHP is Open Source and cross-platform. PHP runs on Windows NT and many Unix versions, and it can be built as an Apache module and as a binary that can run as a CGI. When built as an Apache module, PHP is especially lightweight and speedy. Without any process creation overhead, it can return results quickly, but it doesn't require the tuning of mod_perl to keep your server's memory image small.

In addition to manipulating the content of your pages, PHP can also send HTTP headers. You can set cookies, manage authentication, and redirect users. It offers excellent connectivity to many databases (and ODBC), and integration with various external libraries that let you do everything from generating PDF documents to parsing XML.

PHP goes right into your Web pages, so there's no need for a special development environment or IDE. You start a block of PHP code with <?php and end it with ?>. (You can also configure PHP to use ASP-style <% %> tags or even <script LANGUAGE="php"></SCRIPT>.) The PHP engine processes everything between those tags.

PHP's language syntax is similar to C's and Perl's. You don't have to declare variables before you use them, and it's easy to create arrays and hashes (associative arrays). PHP even has some rudimentary object-oriented features, providing a helpful way to organize and encapsulate your code.

Although PHP runs fastest embedded in Apache, there are instructions on the PHP Web site for seamless setup with Microsoft IIS and Netscape Enterprise Server. If you don't already have a copy of PHP, you can download it at the official Web site. You'll also find a manual that documents all of PHP's functions and features.

#528598