search
HomeBackend DevelopmentPHP TutorialInstallation and configuration method of Windows Apache2.2.11 and Php5.2.9-1_PHP tutorial

Because pharmar uses Mcafee’s anti-virus software, all programs are required to be installed in Program Files, so these files are placed under D:Program Files for easy management. Mcafee is easy to use when writing protection rules.
Apache installation and configuration

Open apache official website http://archive.apache.org/dist/httpd/binaries/win32/ or mirror website http://apache.mirror.phpchina.com /httpd/binaries/win32/, download the apache_2.2.11-win32-x86-no_ssl.msi installation file inside. Among them, there are two types of the same version: no_ssl and openssl. Openssl has an additional SSL security authentication mode. Its protocol is HTTPS instead of HTTP. This is the difference between a server with SSL and a general web server. Under normal circumstances, it will be ok if we download the no_ssl version.

After downloading the apache installation file, click Install. After three consecutive times of next, you will enter the server information configuration interface, which requires you to enter the network domain, server domain and website administrator’s email address. Ordinary users can follow Just fill in the format. After pressing Next again, an interface for selecting the installation path appears. The default path is relatively long. Pharmar changes the installation path to: "D:Program FilesApache" and continues the installation until it is completed.

After the installation is completed, apache will start automatically. You can test whether apache starts successfully. Enter: http://localhost/ or http://127.0.0.1/ in the browser address bar. If "It works." appears, congratulations, apache has been successfully installed; at the same time, click on the taskbar in the lower right corner of the computer. There is a green apache server running icon.

Apache also has a configuration file: httpd:conf that needs to be configured in order for php to run. The location is: D:Program FilesApacheconf directory. Open httpd:conf:
1), search for "DocumentRoot", this is the directory where the specified homepage is placed. The default is: "D:Program FilesApachehtdocs". You can use the default directory or define one yourself, such as: "D:/PHP". Note: Do not add "/" at the end of the directory.
2) Search for "DirectoryIndex", which is the default home page file name. You can add index.php, etc. after index.html. Leave a space between each type.
3), find

Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all

Modify to:

Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all

If you don’t change this If so, an error message like You don't have permission to access / on this server. may appear, especially after changing the path of the default homepage.

Note: Every time you modify the httpd:conf file, you must restart the apache server. In addition, if your win32 system is also running an iis server, you must first stop the iis server and then start apache, otherwise the apache server cannot start.

How to install and configure Php

First download the windows version from the official website of php http://www.php.net/downloads.php. There are two Versions: PHP 5.2.9 zip package and PHP 5.2.9 installer. The latest version is 5.3.0. Pharmar uses version 5.2.9. PHP 5.2.9 installer is an automatic installation method. Although it is relatively automated, it is limited in many aspects. Therefore, pharmar does not recommend this method. The following describes the manual installation of PHP 5.2.9 zip package.

1) Unzip the PHP compressed package zip to a directory. Recommended: "C:/PHP", the pharmar is D:Program FilesPhp.
2) Rename the php.ini-dist file in the PHP directory (D:Program FilesPhp) to php.ini. This is the configuration file of PHP. Modify the following places. After modification, change php.ini Copy the file to the C: WINDOWS directory:
extension_dir="D:Program FilesPhpext", pointing to the path where the "php_*.dll" file is placed in the php folder. The paths for PHP4 and PHP5 are different here.
doc_root="D:PHP", points to the homepage location set by apache previously;
default_charset="gb2312", modifies the default character set. Here, if there is a semicolon ";" in front of it, remove the semicolon;
register_globals=Off changed to register_globals=On to make passing global variables valid;
extension=php_dba.dll If there is a semicolon in front, cancel the semicolon, the same as below;
extension=php_dbase.dll
extension =php_gd2.dll GD library for drawing, generally used for graphical verification codes;
extension=php_mysql.dll is used to connect to MYSQL database;
3) Copy the php5ts.dll file in the PHP directory to C:WINDOWSsystem32 Table of contents.
4), finally modify Apache’s httpd.conf file. Add the following 2 lines at the end of the file to install PHP into Apache in module mode:
LoadModule php5_module D:/Program Files/Php/php5apache2_2.dll
AddType application/x-httpd-php .php

Note: The directory path in the first line must be updated to the current version of the apache dynamic link library. For example, here I am using the apache2.2.11 version and php5.2.9, then this file must be php5apache2_2.dll, not php5apache2_2.dll. php5apache.dll, php5apache2.dll, etc. The second line is the suffix of the php script.
In the php4 version, you need to add a line AddType mod_php4.c, but in php5, there is no need for such a line AddType mod_php5.c. php5 has been integrated, otherwise apache cannot start.

The above completes the configuration process of apache and php, restart apache. Create a new file index.php in the server's default directory "D:Program FilesApachehtdocs" and write the following code:
phpinfo();
?>
In the browser address Enter http://127.0.0.1/ or http://localhost/ in the column, and you will see the php version information. So far, php and apache have been successfully installed.

Here is a detail: the directory delimiter in Apache's configuration file httpd.conf is "/", while the directory in PHP's configuration file php.ini requires a backslash " ", don't do it Mixed up.

The installation of MYSQL is simple. Go to the official website http://dev.mysql.com/downloads/mysql/5.0.html, download mysql under the windows platform, select Windows ZIP/Setup.EXE (x86), the latest version is 5.0.77, and download it. Install directly. After the installation is completed, you can enter the configuration wizard and set the mysql database password. Everything is OK.
For the installation and configuration of mysql, please see: phpMyAdmin installation configuration method and problem solving

Errors encountered during the pharmar installation process:
Apache appears after installing PHP under Windows The main reason for the error LoadModule takes two arguments is this sentence in httpd.conf:
LoadModule php5_module D:Program FilesPHPphp5apache2_2.dll
The interpreter treats the spaces in Program Files as the separator of the two parameters. Therefore, spaces cannot appear in the statement.I searched online for a long time and couldn't find a solution. Finally, I solved the problem by using the first-level directory symbol and changed it to the following:
LoadModule php5_module ../php/php5apache2_2.dll
Because apache is installed in the D:Program FilesApache directory Next, PHP is installed in D:Program Filesphp, so ../ means the D:Program Files directory. This is finally solved. I hope everyone will use their brains during the installation and configuration process to find a way.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320246.htmlTechArticleBecause pharmar uses Mcafee’s anti-virus software, all programs are required to be installed in Program Files, so these files are Place it under D:Program Files for easy management. Mcafee is good when writing protection rules...
Statement
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
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment