Home > Backend Development > PHP Tutorial > PHP installation guide: Install and configure PHP_PHP tutorial

PHP installation guide: Install and configure PHP_PHP tutorial

WBOY
Release: 2016-07-13 17:19:50
Original
852 people have browsed it

二、安装并配置PHP:

  • I want to use Apache as my Webserver:
    A little explanation: This article mainly focuses on installation and configuration The php-3_0_15-win32 version of PHP is taken as an example and explained step by step. Instructions on the installation and configuration of the php-4.0b4-Win32 version of PHP are also included.

     Step 1:Unzip the php-3_0_15-win32 you downloaded, and store all 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 the php4.x version, the corresponding file decompressed is php.ini-dist, and we also need to rename it to php.ini. If you want to use Apache as your personal Web server, please install the php-3_0_15-win32 version of PHP. If you want to use PWS as your personal Web server, you can install either of the two.

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

     1. Change the comment character of the upload_tmp_dir line, that is, the preceding semicolon Remove ";" to make this line work in the php.ini document. upload_tmp_dir is used to define the temporary path where uploaded files are stored. Here you can also define an absolute path for it, for example: upload_tmp_dir = d:phptest. Of course, at this time, your d:phptest directory must have writable and executable permissions.
    If you have defined the upload path in your .php3 program, the path of the uploaded file will be based on the path defined in the .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 megabytes). You can modify the default value to Defines the maximum upload file size.

    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
    =php3_dbm.dll
    ; extension=php3_mssql.dll
    ; extension=php3_zlib.dll
    ; extension=php3_filepro.dll
    🎜> ;extension=php3_crypt.dll
     ;extension=php3_msql2.dll
     ;extension=php3_odbc.dll
     Then, according to your own needs, put the DLL file of the database you want to use? in front of one line The comment character, that is, the preceding semicolon ";" is removed. For example: If I need MySQL support, I just need to remove the semicolon in front of ;extension=php3_mysql.dll. If the DLL file of the database you use is not listed here, it doesn't matter, you can add it yourself.

    4. If you want to use PHP to send emails, please find here:
    SMTP = localhost
    sendmail_from = me@localhost.com
    It is best to set up an SMTP server for SMTP It is your local SMTP server. I am taking the SMTP server of 21cn as an example. Then, fill in your E-MAIL address in sendmail_from. For example, it can be changed 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 with 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 to establish the connection is the local host localhost, the user is root, and the parameter password is not set. The password parameter is empty, that is There is no password. If the mysql database to be connected is located on a different port, we must add a colon and the port number after the host name, as shown below:
    $db = mysql_connect(localhost:3306,root,password);

    6. If the Web server you are using is Omni Httpd, please skip this step; if you are using Apache as your Web server, you can set doc_root as the root directory of the Apache server, such as this example "D:apachehtdocs" (the installation and settings of Apache are detailed in the next section); if you use PWS as your Web server, you can set the doc_root directory to point to the default directory of the PWS server. The root directory, such as "D:Inetpubwwwroot" in this example (the installation and settings of PWS are detailed in the next section). Of course, the easiest thing is that you can set nothing and still leave it blank.

    7. A less important setting:
    If you are using PWS as your Web Server, you can also set browscap.ini and modify; browscap = extra/browscap. ini changed to browscap = c:windowssysteminetsrv rowscap.ini.

     
    Step 5:
    At this point, php3.ini has been basically edited. You can also set other items of php3.ini according to different needs, so I won’t go into details here. What you have to do now is to copy the compiled php3.ini to your Windows system directory.

I want to use PWS as my Web server:
  • 1. I installed the PHP3.X version of PHP When we use PWS as the Web server, we except In addition to compiling the php3.ini file as described above, you must also modify the system registry so that PWS can support PHP files.Because the setup steps involve modifying the system registry, and any incorrect modification to the registry may cause instability in your system, therefore, I strongly recommend that you back up your registry information first, and then make the following modifications. set up.
    1. First, please run "regedit" under the start menu to enter the "Registry Editor".
    2. Enter the following location in the registry: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesw3svcparametersScript Map
    3. Right-click the blank space in the right window of the "Registry Editor" and select: New--$#@62;String value.
    4. Enter the extension name of the PHP Script you want, for example: .php3.
    5. Double-click the new string and enter: "d:php3php.exe %s %s" in the pop-up "Edit String" dialog box. Please note that "%s %s" is very important. If Without it, PHP will not execute correctly. If necessary, please change d:php3php.exe to the path of php.exe on your machine.
    6. Repeat steps 3, 4, and 5 to create other PHP Script extensions, such as links to .php, phtml, etc.
    7. Now let’s create an open command for PHP Script.
    8. Exit Regedit and restart your computer.


    2. I installed the PHP4. In addition to compiling the php3.ini file, you must also make the following modification settings.
    1. Copy all the dll files in the PHP directory to your system directory, such as C:windowssystem
    2. Open and modify pws-php4.reg with your favorite text editor.
    Change ".php"="[PUT PATH HERE]php4isapi.dll" to ".php"="d:phpphp4isapi.dll" At the same time, add the line ".php3"="d:phpphp4isapi.dll", this This is to ensure compatibility with the original files ending with PHP3.
    3. Double-click the pws-php4.reg file, select Merge, and add PHP4 to the registry.
    4. OK, please restart your computer now.

http://www.bkjia.com/PHPjc/532647.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532647.htmlTechArticle2. Install and configure PHP: I want to use Apache as my Web server: A little explanation: This article mainly uses Installing and configuring php-3_0_15-win32 version of PHP as an example, and explaining it step by step, during which...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template