win2k下Apache2 + PHP4 + MySql配置_PHP
Apache
win2k下Apache2+PHP4+MySql配置加入日期:2004年03月14日 07:40:03 AM 作者:shg918(原作) 中国软件
本文声明:
1、凡说明之行号多为近似值,在该行找不到则在上下就近即可以找到。
2、本文写作时,参考了狠多资料来自于中文PHPhttp://www.21php.com 大本营www.csdn.net的资料以及[旖旎导软硬]http://ddj88.myrice.com的资料,在此对三网站网友表示感谢。
3、电子版转载自由。
正文:
网上配置php资料多艾!近泛滥~~~今作一个简要介绍版本,适用于PHP4.2.X APAche2 Mysql4.0.X以上。
调试软硬件环境:
硬件:CR2.2 +256M +845GL
软件:win2000 pro +sp4+ N多补丁+Apache2.0.47 +PHP4.3.3 +Mysql4.0.16+phpmyadmin2.5.4
均下载于www.newhua.com
1、安装php:将下载的php压缩文件解压,文件夹改名为php复制到c盘根目录下。
2、 打开刚才解压的PHP目录,你会发现有一个叫做"php.ini-dist"的文件,这就是PHP的配置文件了,你需要把它改名成"php.ini",然后复制到系统目录winnt下。
3、 PHP安装目录下的"php4ts.dll"必须要复制到windows系统的system32目录下
4、dlls和extensions目录里的所有文件拷到system32 里
修改php.ini其中有必要注意的是
270行error_reporting = E_ALL & ~E_NOTICE
277行display_errors = On
另:365行register_globals 默认 Off,改成on的意思是打开全局变量,以后编程方便。
; cgi.force_redirect = 1改成 cgi.force_redirect = 0这样做是强迫不运行在cgi模式下
Apache2安装
首先停止你的iis或pws服务。
1 运行你下载的Apache2安装文件,安装Apache,安装过程中会提示你输入主机名,管理员信箱等信箱,这些信息在你安装完以后是可以修改的,所以可以放心的输入。
(*为了以后操作方便起见,强烈建议将此处的安装路径用"Change"改变到"X:"下(注X为你的硬盘盘符)或者符合8.3文件名格式的其他名称,以后每次输入Apache安装路径时,都不必为其添加引号。系统安装成功后将自动在此建立一个名为"Apache2"的目录,也就是说,安装之后的实际Apache系统文件所在路径将为"X:Apache2"目录。*)
安装完后,在apache2confhttpd.conf 下查找ServerAdmin,即可修改管理员信箱,(199行附近);213行则是ServerName 我改为localhost
以后我都是把程序放在了apache2的htdocs下的子目录zimulu,用http://localhost:81/zimulu/xxx.php 测试。
2 编辑apache2/conf/httpd.conf
120行Listen 80改为81端口,这是因为当你的win2k重起后,iis将会重占80端口,为避免冲突,所以apache使用81端口。
下面的134-170行左右为加载模块的部分。在这部分下面的加上两句:
LoadModule php4_module c:/php/sapi/php4apache2.dll
//注释:如果你的php目录不是C:/php,请按实际来写。
AddType application/x-httpd-php .php .php3 .php4
(这一句有人说也可以加到768行左右的AddType application/x-tar .tgz之后,不过我有一次这么作了以后没弄成)意思是:加载php4模块, 其中第2句如果仅仅是AddType application/x-httpd-php .php则只能解析php扩展名的文件,php3扩展名的程序解析不了。
注意:我们一般是模块化运行php,所以仅仅这样即可,有的文章说如此添加:
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"
或者
LoadModule php4_module c:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php4
ScriptAlias /php4/ "c:/php/"
Action application/x-httpd-php4 "/php4/php.exe"
AddType application/x-httpd-php4 .php
其实是以cgi方式运行php,没有那个必要。
找到DirectoryIndex * 这行,可以这样修改,添加默认的文件名:
DirectoryIndex index.php default.php index.htm index.html default.htm default.html
否则不能自动识别index.php。
使之支持中文
最好的解决办法是:修改了Apache中conf/httpd.conf文件,查找 AddDefaultCharset ISO-8859-1
并且改成
#AddDefaultCharset ISO-8859-1
AddDefaultCharset GB2312
注意使用dreamweaver做出的文件多有:

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

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.

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

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

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

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.

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

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
