search
HomeBackend DevelopmentPHP TutorialPart 2: Installation and Configuration of PHP_PHP Tutorial

With Apache installed, we can finally start working on PHP, so let's get started. First, unzip the previously downloaded php-5.2.0-Win32.zip. You can choose the directory as you like. For the convenience of explanation, I will unzip it to D:php5. If you want to change the path, remember to change all the paths below. Since the content involved in this tutorial is relatively simple, I will not make pictures.

The next thing to do is to connect PHP and the Apache server. The specific steps are as follows:

1. Rename "php.ini-recommended" in the D:php5 directory to " php.ini";
2. Copy the "php.ini" file to the Windows or WinNT directory, depending on the operating system. For example, WindowXP and Windows2003 are C:Windows, and Windows2000 is C:Winnt.
3. Open the "php.ini" file and modify the following important keywords (tip: press Ctrl + F on the keyboard to search for keywords):
•Find extension_dir = "./" and modify it into the ext path in your PHP directory, and modify it to extension_dir = “D:php5ext”

• If garbled characters appear when displaying Chinese in the future, you can change
;default_charset = “iso-8859-1” Change to
dfault_charset = “gbk” (remove the semicolon in front to indicate that the setting takes effect, as is the case below)

• We will use the session object to store data in the future. This is very important and will be
;session.save_path = “/tmp” should be
session.save_path = “D:/php5/session” (of course you have to create a session folder yourself)

•Find display_errors and cgi .force_redirect, change them to
display_errors = ON
cgi.force_redirect = 0
(Be sure to pay attention to the modification of the semicolon, whether there is a semicolon or not, I will not remind you again in the future)

•Remove all semicolons in the following sentences:
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_filepro.dll
;extension= php_gd2.dll
;extension=php_imap.dll
;extension=php_mysql.dll
;extension=php_mysqli.dll (If this line does not exist, add it manually and remove the semicolon)

Next, some file upload and maximum memory usage limits were modified:
memory_limit = 20M
post_max_size = 20M
upload_max_filesize = 20M

Basically changing these is enough, if If you need to use other extended functions, you can continue to make relevant modifications. Due to space constraints, I will not introduce them here. Be sure to remember to restart the Apache server after modification, otherwise it will not take effect.

OK, now let’s test whether the installation is successful. Create a new file info.php, save it in the D:PHProot folder, enter the following code and save:

程序代码 Program code

Phpinfo();
?>


Open the browser and enter http://localhost/info. php If you can open the following web page, it means the installation is successful. Otherwise, please check again to see where you made the mistake. I wish you good luck:




——Haiting (Hetty)


下载文件 Click to download the world document of this tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317432.htmlTechArticleApache is installed, and we can finally start working on PHP, so let’s get started. First, unzip the previously downloaded php-5.2.0-Win32.zip. You can choose the directory as you like. I am here for convenience...
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
PHP Performance Tuning for High Traffic WebsitesPHP Performance Tuning for High Traffic WebsitesMay 14, 2025 am 12:13 AM

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

Dependency Injection in PHP: Code Examples for BeginnersDependency Injection in PHP: Code Examples for BeginnersMay 14, 2025 am 12:08 AM

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

PHP Performance: is it possible to optimize the application?PHP Performance: is it possible to optimize the application?May 14, 2025 am 12:04 AM

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

PHP Performance Optimization: The Ultimate GuidePHP Performance Optimization: The Ultimate GuideMay 14, 2025 am 12:02 AM

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

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 Article

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

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

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

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