PHP installation settings PHP can be run under a variety of operating systems, the current operating system is divided into two categories, one is the Windows series, one is the UNIX series. There are a lot of differences between installing and setting PHP in these two series operating systems, as described below. # #2 (i) Unix-like operating system installation settings currently popular in the market two categories of free Unix-like operating system FreeBSD and Linux,linux system is more popular, but also quite a variety of types, such as Redflag,redhat system. FreeBSD has only one type, currently its release version is 3.5, here in FreeBSD as an example of the Unix-like operating system to introduce the installation of the PHP setup process, Linux and FreeBSD are similar. 1. Install first to www.php.net to download the PHP installation files and http://www.apache.org to download the Apache Web server. Generally put the download file into the/usr/directory. The next step is to install the settings, and if the reader does not understand the meaning of these parameters, please do not change them. Install Apache and PHP first. TAR-VZXF apache_1.3.x--x represents the version number such as 12 or 13 tar-vzxf php-4.0.x or TAR-VZXF php-3.0.x cd apache_1.3.x./configure--prefix=/www- -/WWW represents the installation directory at the root directory www under CD. /php-4.0.x or CD. /php-3.0.x./configure--with-mysql--with-apache=. /apache_1.3.x--enable-track-vars make do install CD. /apache_1.3.x php3:./configure--activate-module=src/modules/php3/libphp3.a php4:./configure--activate-module=src /modules/php4/libphp4.a make makes install first to second command use tar to extract the downloaded compressed file files in the same name directory, and then in the directory of Apache Extract environment settings,--prefix option represents Apache The installation directory path. Then into the PHP decompression directory, PHP environment settings, if not using MySQL database, you can omit--with-mysqL option, but be sure to add the--with-apache option, and Apache extract directory name must be correct. After you have set up PHP, compile and install to the specified directory in Apache. Then after the Apache unzip the directory to complete the PHP Schema Library installation, and then compile and install Apache after the initial installation work completed. The next thing to do is to set up Apache for the Web Server to run smoothly. 2. Set the php.ini file first, CD: /php-4.0.x or CD. /php-3.0.x PHP3:CP Php3.ini-dist/usr/local/lib/php3.ini PHP4:CP Php.ini-dist/usr/local/lib/php.ini Readers can edit the INI file to meet their own requirements, of course, if not clearly set, then use the default settings, the reader can also specify another directory, but need to set the conditions in the sixth step--with-config-file-path=/path then set the Apache server, You need to add the following string to the Apache settings file httpd. conf or srm.conf. PHP 3:addtype application/x-httpd-php3. php3 php 4:addtype application/x-httpd-php. PHP readers can also set additional suffix names as php file names. # #2 (b) Install under Windows download PHP installer, ready to install, because the Windows family installation is not very different, this article under Windows 98 installation as an example. You should have the PWS 4.0 installed before installation. 1. Install release compressed files to the specified directory such as C:\PHP\, and then copy the Php.ini-dist or php.ini-optimized into the C:\Windows directory (Windows NT and Windows 2000 should be C:\Winnt), and renamed to PHP.ini. Edit your php.ini file, you can change the Extension_dir settings for your PHP installation path, as described above "c:\php", select the PHP extension you want to add, in the INI file after the extension= add Php_*.dll line , you can also load dynamically in scripts. PHP also provides additional modules that can provide additional functionality that can be downloaded from the relevant website. 2. After setting the above steps, be sure to check that the DCO is installedM98, if not, install DCOM98, which can be found in the full version of VB6. You will also need to set up the registry, which typically contains a registry file named Pws-php4.reg in the downloaded PHP compression package. You need to use Notepad to modify this file, the "[Put PATH here]" to replace the PHP extract directory, you need to be aware of the directory separation to use the double slash "\ \". Save it in the right-click menu and merge it into the registry. 3.PHP additional libraries (extensions) in order to extend the functionality of PHP, PHP provides a number of additional libraries, these additional libraries are provided in the form of DLL files, you need to modify the php.ini file before use, with extention to set the required additional libraries. The following table is a common additional library, additional libraries can be downloaded to the Internet. Php_calendar.dll Calendar Conversion php_crypt.dll Cryptographic Module Php_dbase.dll dbase function module Php_imap4r2.dll IMAP 4 function Php_ldap.dll LDAP function PHP_MSQL1. DLL MSQL 1 customer php_msql2.dll MSQL 2 customer php_mssql.dll MSSQL customer Php3_mysql.dll (PHP 4 built-in) MySQL function module php_nsmail.dll Netscape Mail function Php_oci73.dll Oracle Function Module Php_zlib.dll zlib function Module # #1 Second, PHP language introduction PHP scripting language is not difficult to use, if there are other programming language Foundation, can be mastered quickly, Even if there is no other language basis after a little more learning can easily grasp it. PHP has a more convenient dedicated editor Phpeditor available, you can also use UltraEdit, editplus such as the editor, according to your preferences. # #2 (i) Syntax Basics 1. How to embed PHP code in a page PHP can be embedded in the middle of the HTML code, that is, the HTML and PHP code can be mixed together to use, so write code will be very comfortable. Of course, there are ways to distinguish between PHP code and HTML, you can use the following 4 ways: (1) (2) (3) (4) <% echo ("You can also write like an ASP style"); %> (1) type (4) is required to be set separately under Windows 98 for use. 2. Notes of the program and how to conclude the sentence in the PHP program, the comments have the following three types of annotation: (1)/* The second line of the first row of multiple lines of comments */(2)//single-line Comments (3) # Single-line comments above these three kinds of comments can be mixed, readers can choose according to the habit Release. PHP statements are separated by ";", which is also a statement terminator. 3. A small sample we have learned about PHP's simple coding specifications and can now write a simple example of the following: <title>The first PHP program</title> The above example is actually a standard HTML page, because PHP is interpreted to execute, so just put this file as we set up the PHP environment, you can see in the browser "Hello, this is my first PHP program." # #2 (ii) constants and variables first look at the following example example: test2_1.php As can be seen from the above example, when writing PHP files, you can omit the HTML header. 1. In the above example, the "_file_" is a constant, and this constant is the PHP system default, that is, the current file name of PHP, and of course there are many constants, such as "TRUE", "FALSE" and so on, if necessary, readers can go to the official PHP website query If you feel that the constants are not enough, you can define the constants yourself, just like the define ("Constant name", "Constant value") of the previous example defines a constant. 2. Variable PHP variable is very interesting, the above example, "$StrOutput" is a variable, you can see the variable is preceded by a "$" (dollar) symbol, it is very good to distinguish between variables and programs in the other statements, while the variables in PHP can not be pre-defined and directly in the Code reference, And the use of "$" such a symbol, you can make our program more freedom, not only can refer to the variable as usual, but also can be written directly in a string, and PHP can automatically get the value of the variable, but PHP is very strict case sensitivity, in the above example is clearly explained this point. (1) The scope of the variable can be directly referenced in PHP, we define a page-level variable, and what is the relationship between the variable with the same name in the function? This is the scope of the variable, as in the following example: Example test2_2.php As can be seen from the example above, if PHP directly refers to a variable with the same name as the page variable in the function, it will assume that the function's variable is a new variable, of course nothing, but if we add a "global" in front of it, you can get the value of the variable of the same name on the page, another way is $ globals["Strtest"]; (2) variable variables in PHP the biggest difference between variables and many commonly used languages is the addition of a ' $ ' prefix, why alone to come to terms? Because of this prefix, it also adds a unique way of handling PHP, where a prefix represents a common variable, but what about two prefixes? This is the variable variable, so that people may not understand, please look at the following example. Example: test2_3.php Everyone from the above example can basically understand the $ $name, PHP standard definition is ${$name}. It's amazing that we have variable variables to dynamically add variables. (3) Types of variables the readers of other languages will find that the PHP-defined variables do not have a defined type? In fact, the variables defined by PHP are not typed by default, and the variables are automatically determined by PHP automatically when they are used. As shown in the following example. Example test2_4.php:
http://www.bkjia.com/PHPjc/532192.html www.bkjia.com true http://www.bkjia.com/PHPjc/532192.html techarticle PHP installation settings PHP can be run under a variety of operating systems, the current operating system is divided into two categories, one is the Windows series, one is the UNIX series. In these two series of operating systems ...