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

PHP installation guide: Install and configure PHP_PHP tutorial

Jul 13, 2016 pm 05:19 PM
apache php web two Install I Strategy server Configuration

二、安装并配置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...
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP's Purpose: Building Dynamic Websites PHP's Purpose: Building Dynamic Websites Apr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

How to start apache How to start apache Apr 13, 2025 pm 01:06 PM

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

See all articles