Apache, PHP, MSSQL dan FreeTDS di Ubuntu

PAIDJO.COM – Penjelajahan didunia per-server-an Linux, sudah memasuki pada judul Apache, PHP, MSSQL dan FreeTDS di Ubuntu Server 11.10. Kita mencoba bagaimana melakukan koneksi database

Basic Syntax PHP – Part 2

Escaping from HTML

There are four ways of escaping from HTML and entering “PHP code mode”:

1. <? echo (“this is the simplest, an SGML processing instruction\n”); ?>

2. <?php echo(“if you want to serve XHTML or XML documents, do like this\n”); ?>

3. <script language=”php”>

echo (“some editors (like FrontPage) don’t

like processing instructions”);


4. <% echo (“You may optionally use ASP-style tags”); %>

<%= $variable; # This is a shortcut for “<%echo ..” %>

The first way is only available if short tags have been enabled. This can be done by enabling the short_open_tag configuration setting in the PHP config file, or by compiling PHP with the –enable-short-tags option to configure.

The second way is the generally preferred method, as it allows for the next generation of XHTML to be easily implemented with PHP.

The fourth way is only available if ASP-style tags have been enabled using the asp_tags configuration setting.

Note: Support for ASP-style tags was added in 3.0.4.

The closing tag for the block will include the immediately trailing newline if one is present.

Basic PHP – Part 1

What is PHP?

PHP (officially “PHP: Hypertext Preprocessor”) is a server-side HTML-embedded scripting language.

Simple answer, but what does that mean? An example:

Example 1-1. An introductory example







echo “Hi, I’m a PHP script!”;




Notice how this is different from a CGI script written in other languages like Perl or C — instead of writing a program with lots of commands to output HTML, you write an HTML script with a some embedded code to do something (in this case, output some text). The PHP code is enclosed in special start and end tags that allow you to jump into and out of PHP mode.

What distinguishes PHP from something like client-side Javascript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there’s really no way that users can tell what you have up your sleeve.