search
HomeBackend DevelopmentPHP TutorialDetailed explanation of PHP installation and configuration under win10 (taking php5.6 as an example)

PHP installation and configuration under window10

Download

First go to the official php website http://php.net/downloads.php Download, here we choose the 5.6 version Windows downloads

Detailed explanation of PHP installation and configuration under win10 (taking php5.6 as an example)

It depends on your own computer. If it is a 32-bit operating system, choose X86. If it is a 64-bit operating system, choose X64. Because it is a Windows system, we choose the Thread Safe version. Here we choose a compressed package file Zip download.

Installation

After downloading, it is a compressed package. Unzip it directly to the appropriate directory. Here I create a PHP folder on the D drive and unzip it. In other words, the installation directory is D:\PHP.

Detailed explanation of PHP installation and configuration under win10 (taking php5.6 as an example)

Configuration

Environment variables

The first step to install the php service is Add environment variables,

  • Right-click this computer=>Properties=>Advanced system settings=>Environment variables=>System variables=>path

  • If you are using Windows 10, click New and add the D:\PHP address. If it is Windows 7, just add English lowercase ";" at the end, and then add the path.

  • Click OK all the way to complete the configuration of environment variables.

The process of adding environment variables to Apache is the same as before, so that you can see php information on the command line,

Detailed explanation of PHP installation and configuration under win10 (taking php5.6 as an example)

Configuration file

Using php in a windows environment usually works with a WEB server. Here we use it with Apache. In this case, you need to modify the Apache configuration file first and find the Apache configuration. Open the file D:\Apache24\conf\httpd.conf.

//找到LoadModule的位置,为PHP环境添加模块,像下面这样
LoadModule php5_module "D:/PHP/php5apache2_4.dll"
PHPIniDir "D:/PHP/php.ini"
//找到AddType的位置,添加PHP支持
AddType application/x-httpd-php .php
//找到下面这里,添加文件类型支持,把index.php放到index.html前面
<IfModule dir_module>
    DirectoryIndex index.php index.html 
</IfModule>

Careful students have discovered that the above file D:/PHP/php.ini is not in the PHP installation directory. This requires us to do it ourselves. Revise. Rename the php.ini-development file under the root directory to php.ini, open it with an editing tool, find

; extension_dir = "./"

and change it to the following:

extension_dir = "D:/PHP/ext"

Note, change the previous Remove the semicolon; and write it in the top box without leaving any spaces. Then add database extensions, because we are using mysql, so just modify the relevant ones.

//把这里前面的分号去掉
extension=php_mysqli.dll
//这里也是去掉前面的分号
extension=php_pdo_mysql.dll

Note that every time you modify the configuration file, you need to restart the service. Steps to restart the service: Open the search cmd in the lower left corner, then run the command prompt as an administrator and enter the command

httpd -k restart

Next, create a new php file index.php in the Apache project path D:\Apache24\htdocs, write

<?php
    echo phpinfo();

in it, save it, and then open the address localhost/index.php in the browser. If you see The following screen proves that the PHP environment configuration is successful

Detailed explanation of PHP installation and configuration under win10 (taking php5.6 as an example)

Modify the project directory

If you want to customize the project address, you can modify it Project path, if I want to put the project in the D:/Projects directory, of course it can.

First open the Apache configuration file D:\Apache24\conf\httpd.conf and find it here:

DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">

Modify to your customized project address:

DocumentRoot "D:/Projects"
<Directory "D:/Projects">

Then Restart the service and the modification is completed. You can try writing your php file in D:/Projects, or open it through localhost and give it a try.

The above is the detailed content of Detailed explanation of PHP installation and configuration under win10 (taking php5.6 as an example). For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:myxxqy. If there is any infringement, please contact admin@php.cn delete
Optimize PHP Code: Reducing Memory Usage & Execution TimeOptimize PHP Code: Reducing Memory Usage & Execution TimeMay 10, 2025 am 12:04 AM

TooptimizePHPcodeforreducedmemoryusageandexecutiontime,followthesesteps:1)Usereferencesinsteadofcopyinglargedatastructurestoreducememoryconsumption.2)LeveragePHP'sbuilt-infunctionslikearray_mapforfasterexecution.3)Implementcachingmechanisms,suchasAPC

PHP Email: Step-by-Step Sending GuidePHP Email: Step-by-Step Sending GuideMay 09, 2025 am 12:14 AM

PHPisusedforsendingemailsduetoitsintegrationwithservermailservicesandexternalSMTPproviders,automatingnotificationsandmarketingcampaigns.1)SetupyourPHPenvironmentwithawebserverandPHP,ensuringthemailfunctionisenabled.2)UseabasicscriptwithPHP'smailfunct

How to Send Email via PHP: Examples & CodeHow to Send Email via PHP: Examples & CodeMay 09, 2025 am 12:13 AM

The best way to send emails is to use the PHPMailer library. 1) Using the mail() function is simple but unreliable, which may cause emails to enter spam or cannot be delivered. 2) PHPMailer provides better control and reliability, and supports HTML mail, attachments and SMTP authentication. 3) Make sure SMTP settings are configured correctly and encryption (such as STARTTLS or SSL/TLS) is used to enhance security. 4) For large amounts of emails, consider using a mail queue system to optimize performance.

Advanced PHP Email: Custom Headers & FeaturesAdvanced PHP Email: Custom Headers & FeaturesMay 09, 2025 am 12:13 AM

CustomheadersandadvancedfeaturesinPHPemailenhancefunctionalityandreliability.1)Customheadersaddmetadatafortrackingandcategorization.2)HTMLemailsallowformattingandinteractivity.3)AttachmentscanbesentusinglibrarieslikePHPMailer.4)SMTPauthenticationimpr

Guide to Sending Emails with PHP & SMTPGuide to Sending Emails with PHP & SMTPMay 09, 2025 am 12:06 AM

Sending mail using PHP and SMTP can be achieved through the PHPMailer library. 1) Install and configure PHPMailer, 2) Set SMTP server details, 3) Define the email content, 4) Send emails and handle errors. Use this method to ensure the reliability and security of emails.

What is the best way to send an email using PHP?What is the best way to send an email using PHP?May 08, 2025 am 12:21 AM

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

Best Practices for Dependency Injection in PHPBest Practices for Dependency Injection in PHPMay 08, 2025 am 12:21 AM

The reason for using Dependency Injection (DI) is that it promotes loose coupling, testability, and maintainability of the code. 1) Use constructor to inject dependencies, 2) Avoid using service locators, 3) Use dependency injection containers to manage dependencies, 4) Improve testability through injecting dependencies, 5) Avoid over-injection dependencies, 6) Consider the impact of DI on performance.

PHP performance tuning tips and tricksPHP performance tuning tips and tricksMay 08, 2025 am 12:20 AM

PHPperformancetuningiscrucialbecauseitenhancesspeedandefficiency,whicharevitalforwebapplications.1)CachingwithAPCureducesdatabaseloadandimprovesresponsetimes.2)Optimizingdatabasequeriesbyselectingnecessarycolumnsandusingindexingspeedsupdataretrieval.

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

Video Face Swap

Video Face Swap

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

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools