Installation of PHP

Source: Internet
Author: User

Installation of PHP

What do you need?
This tutorial will not explain how to install PHP, MySQL, or Apache servers.

If your server supports PHP-you don't have to do anything! You don't need to compile anything or install any additional tools-just create some. P hp files in your Web page directory-and the server will parse for you. Most websites provide support for hosting PHP.

However, if your server does not support PHP, you must install PHP. The following is a link to a good tutorial from php.net How to install PHP5:

http://www.php.net/manual/en/install.php

PHP for download
Download PHP's free browsing: http://www.php.net/downloads.php

Download MySQL Database
Download MySQL free browsing: http://www.mysql.com/downloads/index.html

Download Apache Server
Download Apache free browsing: http://httpd.apache.org/download.cgi

You cannot view the PHP source code Select "View Source file" in the browser-you will only see the output p hp file, which is pure H TML. This is because the script executes the results on the server before it is sent back to the browser.


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

Basic PHP syntax
A PHP script block always starts with "? PHP and purpose? ” 。 A PHP script block can also be placed anywhere in the file.

The support of shorthand on the server, you can enable the startup script block "? and end it? “ 。

However, for maximum compatibility, we recommend that you use a standard format "(<? PHP), rather than in shorthand form.

“ ? PHP's? ”

PHP files typically contain HTML tags, like HTML files, and some PHP scripting code.

Below, we have an example of a simple PHP script to send the text of the "Hello World" browser:

<body> "? The PHP
echo "Hello World";
? "/Weight"
"/html"

Each line of code must be in PHP with a semicolon. A semicolon is a separator that is used to differentiate the instruction set from another.

There are two basic report output text in PHP: Echo and print. In the example above, we used the Echo declaration, the output of the text "Hello World."

Note: The file must be available. PHP extensions. In the archives. HTML file name, PHP code will not be executed.


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

Comments in PHP
In PHP, we use//make a single line of comments or/* and */make a lot of comment blocks.

 
   
<?php
This is a comment
/* This are
a comment block
* *
?>
</body>
    
      
Variables are used to store values, such as numbers, strings, or functions, so that they can be used for many times as a script.


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

Variables in PHP
Variables are used to store values, such as text strings, numbers, or arrays.

When a variable is set that can be used over and over again in your script

All the variables in PHP begin as symbols of the symbol.

The correct way to set a variable in PHP:

$ var_name = value;

New PHP programmers often forget the variables that start with a flag. In this case, it will not work.

Let's try to build a variable with a string, and a variable with some:

“ ? The PHP
$ text = "World Hello!" ” ;
$ quantity = 16;
? “


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

PHP is a loosely-spoken language
Variables in PHP do not need to be announced before the establishment.

In the example above, you see, you don't have to tell PHP about the variables of the data type.

PHP automatically converts variables to the correct data type, depending on how they are determined.

In a strongly typed programming language, you want to declare (define) the type and name of the variable in use of it.

Variables in PHP are automatically used when declaring them.


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

Variable naming rules
A variable name must begin with a letter or underscore "_"
The name of a variable can only contain alphanumeric characters and underscores (Arizona, State, 0-9, and _)
The name of a variable should not contain spaces. If the name of a variable is more than one word, the separation should be emphasized ($ my_string), or with capital ($ myString)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.