PHP installation tips: install and configure PHP

Source: Internet
Author: User
II. install and configure PHP: I want to use Apache as my Web server: a note: This article mainly to install and configure the php-3_0_15-win32 version of PHP as an example, and further explain, the installation and configuration of the php-4.0b4-Win32 version of PHP were also added. Step 1: extract SyntaxHighli 2. install and configure PHP:

  • I want to use Apache as my WebServer:
    One note: This article mainly to install and configure the php-3_0_15-win32 version of PHP for example, and further explain, during which also added to the php-4.0b4-Win32 version of PHP installation and configuration instructions.

      Step 1:Decompress the php-3_0_15-win32 you downloaded and store all of its php files in the directory you need, for example, "D: php3 ".

      Step 2:Rename the php3.ini-dist file under D: php3 to php3.ini. If it is the source code package of php4.x, the decompressed file is php. ini-dist. we also need to rename it php. ini. If you want to use Apache as your Web server friend, please install php-3_0_15-win32 version of PHP, if you want to use PWS as your Web server, you can install either of them.

      Step 3:Open your php3.ini file with NotePad and start editing:

    1. remove the; upload_tmp_dir line annotator, that is, the semicolon ";" in front, so that this line plays a role in the php. ini document. Upload_tmp_dir is used to define the temporary PATH for storing the uploaded file. here you can also define an absolute path for it, for example, upload_tmp_dir = d: phptest. of course, your d: the phptest directory must have the write and executable permissions.
    If you have defined the upload path in your. php3 program, the path of the file to be uploaded is based on the path defined in. php3 program.
    Upload_max_filesize is used to limit the maximum size of uploaded files processed by PHP. it is calculated in bytes. the default value is 2097152 = 2*1024*1024 bytes (2 MB ), you can modify the default value to define the maximum size of uploaded files.

    2. modify extension_dir =./to your PHP3 installation directory, for example, extension_dir = d: php3.

    3. What database support do you need? Find here:
    Windows Extensions
    ; Extension = php3_mysql.dll
    ; Extension = php3_calendar.dll
    ; Extension = php3_dbase.dll
    ; Extension = php3_gd.dll
    ; Extension = php3_dbm.dll
    ; Extension = php3_mssql.dll
    ; Extension = php3_zlib.dll
    ; Extension = php3_filepro.dll
    ; Extension = php3_imap4r1.dll
    ; Extension = php3_ldap.dll
    ; Extension = php3_crypt.dll
    ; Extension = php3_msql2.dll
    ; Extension = php3_odbc.dll
    Then, according to your own needs, what Database do you need? DLL file line in front of the annotator, that is, the semicolon ";" removed. For example, if you need MySQL support, you only need to remove the semicolon before extension = php3_mysql.dll. If the DLL file of the database you are using is not listed here, it doesn't matter. you can add it yourself.

    4. if you want to use PHP to send an email, please find it here:
    SMTP = localhost
    Sendmail_from = me@localhost.com
    Set SMTP server for SMTP, preferably your local SMTP server. here I will use the SMTP server of 21cn as an example, and then fill in your E-MAIL address in sendmail_from, for example, you can change to this:
    SMTP = smtp.21cn.com
    Sendmail_from = pert@21cn.com

    5. set the following items in the [mysql] column as follows:
    Mysql. default_port = 3306
    Mysql. default_host = localhost
    Mysql. default_user = root
    The mysql_connect () function is used to establish a connection to the mysql database on the specified host. the Function syntax is as follows:
    Mysql_connect (string [hostname] [: port], string [username], string [password]);
    Here, we set the default port for connecting to the mysql database to 3306. the host that establishes the connection is the local host localhost and the user is root. the parameter password is not set at the same time, the password parameter is blank, that is, there is no password. If the mysql database to be connected is on a different port, we must add the colon and port number after the host name, as shown below:
    $ Db = mysql_connect (localhost: 3306, root, password );

    6. skip this step if your Web server is Omni Httpd. if you use Apache as your Web server, you can set doc_root as the root directory of the Apache server, for example, "D: apachehtdocs" in this example (the installation and configuration of Apache are described in detail in the next section). If you use PWS as your Web server, you can set the doc_root directory to the default root directory pointing to the PWS server, for example, "D: inetpubwwwroot "(the installation and settings of PWS are described in detail in the next section ). Of course, you can leave it empty without having to do anything.

    7. an insignificant setting:
    If you use PWS for your Web Server, you can also set browscap. ini and modify it; browscap = extra/browscap. ini to browscap = c: windowssysteminetsrvrowscap. ini.

      Step 5:At this point, php3.ini has been basically edited. you can set other php3.ini items based on your own needs. Now you need to add the compiled php3.ini folder to your Windows system directory.

  • I want to use PWS as my Web server:
    I. I installed PHP of PHP3.X.
    When we use PWS as a Web server, we must compile the php3.ini file as described above, and modify the Registry of the system so that PWS can support PHP files. Because the setup step involves modifying the system registry, any incorrect modification to the registry may cause instability of your system, I strongly recommend that you back up your registry data before making the following changes.
    1. first, run regedit in the Start menu to go to registry editor ".
    2. enter the following location in the registry: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesw3svcparametersScript Map
    3. in the right window of registry editor, right-click and choose new -- $ # @ 62; string value.
    4. enter the extension name of your desired PHP Script, for example,. php3.
    5. double-click the new string and enter "d:" In the "Edit string" dialog box: php3php.exe % s. Note that "% s" is very important. if it is missing, PHP cannot be correctly executed. If necessary, change the path of php.exe on the d: php3php.exe.exe machine.
    6. Repeat steps 3, 4, and 5 to create extension names for other PHP scripts, such as. php and phtml.
    7. now let's create and open commands for PHP scripts.
    8. log out of Regedit and restart your computer.


    2. I installed PHP of PHP4.X.
    If you are installing PHP 4.x, for example: Php-4.0b4-Win32, in addition to compiling the php3.ini file as described above, you have to make the following modifications.
    1. copy all dll files in the PHP directory to your system directory, for example, C: windowssystem
    2. Open and modify your pws-php4.reg in your favorite text editor.
    Change ". php "=" [put path here] \ php4isapi. dll "is ". php "=" d: \ php \ php4isapi. dll "at the same time, add ". php3 "=" d: \ php \ php4isapi. dll "line, this is to ensure that it is common to the original file ending with PHP3.
    3. double-click the pws-php4.reg file and select merge to add PHP4 to the registry.
    4. OK. restart your computer.

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.