search
HomeBackend DevelopmentPHP TutorialPHP&MYSQL服务器配置说明_php基础


Apache 1.3.22 for Win32+PHP 4.0.6+Active Perl 5.006001+Zend Optimizer v1.1.0+mod_gzip 1.3.19.1a+MySQL 4.0.0 Alpha 
Apache 1.X for win32虽然**能差(和IIS比起来差太远了,希望2.X for win32早点出),但是它的bug比较少,资源占用也少,而且它的模块式更方便功能的增加。PHP-4具有执行快速,**能效率高的特点,PERL提供了perl-cgi的支持,Zend Optimizer是加速php程序的,mod_zip用来压缩web server输出数据,MySql为数据库。以下是以win2k/xp作为蓝本,win9x运行这些服务软件太麻烦了,没办法作为service来运行。 

一、 
各软件下载地点: 
Apache: http://www.apache.org/dist/httpd/binaries/win32/ 
PHP: http://www.php.net/downloads.php (下载.zip版本) 
Active Perl: http://www.activestate.com/Products...l/download.plex (下载win32) 
Zend Optimizer: http://www.zend.com/store/getfreefi...pid=13&zbid=198 
mod_gzip: http://www.remotecommunications.com/apache/mod_gzip/ (下载.dll) 
MySQL: http://www.mysql.com/downloads/index.html 
其他软件: 
phpMyAdmin: http://sourceforge.net/project/show...elease_id=44593 (用于对数据库的控制操作) 

二、 
安装路径(以下是范例,可以随便安装,但是最好不要安装在带有长名字的路径) 
Apache :d:\apache 
PHP :d:\php 
Perl :d:\perl 
MySQL :d:\mysql 
mod_gzip :解压在d:\apache\modules 
Zend Optimizer :解压在d:\php 
网站文件放置 :d:\myweb 
phpMyAdmin :解压在d:\myweb\phpmyadmin 
Windows : d:\windows 

三、配置mysql 
安装后会自动运行winmysqladmin,并且提示输入用户名密码,输入用户名,密码,默认情况下已经安装为NT的Service,如果需要更安全点,那么在winmysqladmin 的my.ini Setup那一页 port=端口 那里修改默认的端口,在下面还有用户名密码的修改。修改完了,点击左边的Save Modiffication保存设置,然后右键点击控制台窗体,选WinNT->Stop The Service->Start The Service,这样新设置就生效了。 

四、配置php 
将php.ini-dist改名为php.ini,并且打开修改。 
在[php]的下一行添加 
zend_optimizer.optimization_level=15 
zend_extension_ts="d:\php\ZendOptimizer.dll" 
zendoptimizer.dll的路径一定要符合 

接着查找extension_dir,在后面=加上你的windir\system32\目录全称,例如:extension_dir = d:\windows\system32\ (最后的\一定不能省略!) 
查找extension=php_exif.dll、extension=php_imap.dll、extension=php_ldap.dll、extension=php_zlib.dll,将前面的分号注释去掉 
查找mysql.default_port,在等号后面添加你的 mysql 端口,例如:mysql.default_port = 3306 (3306是mysql的默认端口) 
查找mysql.default_host,在等号后面添加localhost,例如:mysql.default_host = localhost 
保存 
将php.ini php.exe复制到windows目录,将php里面php4ts.dll、dlls以及extensions目录下面的全部.dll文件复制到windows\system32下面(不要覆盖已有文件) 

五、配置Apache 
打开apache\conf\httpd.conf文件,以下为主要设置 
ServerType standalone 

ServerRoot "d:/Apache" 
# Apache安装的目录 

PidFile logs/httpd.pid 
ScoreBoardFile logs/apache_runtime_status 
Timeout 300 
KeepAlive On 
MaxKeepAliveRequests 100 
KeepAliveTimeout 15 
MaxRequestsPerChild 1024 
ThreadsPerChild 50 
SendBufferSize 65536 
MaxClients 150 
Listen 80 
# 监听80端口,默认web server端口 
BindAddress * 
# 在任何ip均可以使用web server 

LoadModule vhost_alias_module modules/mod_vhost_alias.so 
AddModule mod_vhost_alias.c 
# 去掉这两行前面的#,开启虚拟域名的支持 

Port 80 
ServerAdmin me@localhost 
ServerName localhost 
# 端口、管理员email,服务器域名,按实际修改 

DocumentRoot "d:/myweb/" 
# web文件保存地址,这里是以d:/myweb作为例子 
 
Options FollowSymLinks MultiViews 
AllowOverride all 
Order allow,deny 
Allow from all 
 
# 设置d:/myweb的访问选项 
ScriptAlias /cgi-bin "e:/myweb/cgi" 
 
AllowOverride None 
Options None 
Order allow,deny 
Allow from all 
 
# 设置cgi-bin目录权限 

#!/perl/bin/perl 
# 这一行配置perl-cgi的运行环境,由于Active Perl安装在d:\perl,所以这里直接使用相对路径 
# 注意,要运行的cgi、pl文件的头一行要和这里相同,否则不能运行。这里也可以写成 
# #!d:/perl/bin/perl 
# 另外这个配置第一个#不代表注释的意思,所以不能省略!! 

查找DirectoryIndex index.html,在下面添加 
DirectoryIndex index.htm 
DirectoryIndex default.htm 
DirectoryIndex default.html 
DirectoryIndex index.php 
DirectoryIndex index.php3 
DirectoryIndex index.cgi 

查找AddType application/x-httpd-php 
修改为AddType application/x-httpd-php .php .phtml .php3 

查找AddHandler cgi-script 
修改为AddHandler cgi-script .cgi .pl 

LoadModule php4_module d:/php/sapi/php4apache.dll 
LoadModule gzip_module d:/apache/modules/ApacheModuleGzip.dll 
# 加载php4,gzip模块 

### 以下为gzip模块设置 
mod_gzip_on Yes 
mod_gzip_minimum_file_size 300 
mod_gzip_maximum_file_size 0 
mod_gzip_maximum_inmem_size 100000 
mod_gzip_keep_workfiles No 
mod_gzip_dechunk Yes 
mod_gzip_can_negotiate Yes 
mod_gzip_temp_dir d:/apache/temp 
# 必须在apache目录下面有一个temp目录,没有就新建一个 
mod_gzip_item_include file \.html$ 
mod_gzip_item_include file \.htm$ 
mod_gzip_item_include file \.shtml$ 
mod_gzip_item_include file \.shtm$ 
mod_gzip_item_include file \.pl$ 
mod_gzip_item_include file \.cgi$ 
mod_gzip_item_include mime ^text/.* 
mod_gzip_item_include handler ^perl-script$ 
mod_gzip_item_include mime ^httpd/unix-directory$ 
mod_gzip_item_include handler ^server-status$ 
mod_gzip_item_include handler ^server-info$ 
mod_gzip_item_include mime ^application/x-httpd-php 
mod_gzip_item_include file \.php$ 
mod_gzip_item_include file \.php3$ 
mod_gzip_item_include file \.mht$ 
mod_gzip_item_exclude file \.css$ 
mod_gzip_item_exclude file \.js$ 
mod_gzip_item_exclude mime ^image/.* 
mod_gzip_item_exclude reqheader Content-Type:multipart/form-data 
mod_gzip_item_exclude reqheader Content-Type:application/x-www-form-urlencoded 

mod_gzip_item_exclude file \attachment.php$ 
#上面这个是VBB必须要的 
### End of mod_gzip sample config 
LogFormat "%h %l %u %t \"%r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct." mod_gzip_info 
# 记录gzip运行情况 
# 以上为httpd.conf需要添加或者修改的地方,其他不用修改可以了 

六、配置phpmyadmin 
打开config.inc.php文件修改 
$cfgServers[1]['host'] = 'localhost'; //mysql地址 
$cfgServers[1]['port'] = '3306'; //mysql端口 
$cfgServers[1]['user'] = 'username'; //mysql用户名 
$cfgServers[1]['password'] = 'passwd'; //mysql密码 
$cfgDefaultLang = 'zh'; //配置phpmyadmin为简体中文界面 

由于phpmyadmin这个是mysql配置,所以需要将他放在一个别人猜不到的目录或者该目录需要用户权限验证 

七、测试 
如果按照默认的d:\myweb\phpmyadmin,那么用浏览器打开以下地址http://localhost/phpmyadmin/ 
如果测试成功会出现phpmyadmin的mysql管理页面,点击Show PHP information ,或者去http://localhost/phpmyadmin/phpinfo.php,这个显示出web php mysql的配置情况以及运行情况......... 
只要配置没问题,那么上面Apache 1.3.22 for Win32+PHP 4.0.6+Active Perl 5.006001+Zend Optimizer v1.1.0+mod_gzip 1.3.19.1a+MySQL 4.0.0 Alpha配置完毕 
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 vs. Python: Understanding the DifferencesPHP vs. Python: Understanding the DifferencesApr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP: Is It Dying or Simply Adapting?PHP: Is It Dying or Simply Adapting?Apr 11, 2025 am 12:13 AM

PHP is not dying, but constantly adapting and evolving. 1) PHP has undergone multiple version iterations since 1994 to adapt to new technology trends. 2) It is currently widely used in e-commerce, content management systems and other fields. 3) PHP8 introduces JIT compiler and other functions to improve performance and modernization. 4) Use OPcache and follow PSR-12 standards to optimize performance and code quality.

The Future of PHP: Adaptations and InnovationsThe Future of PHP: Adaptations and InnovationsApr 11, 2025 am 12:01 AM

The future of PHP will be achieved by adapting to new technology trends and introducing innovative features: 1) Adapting to cloud computing, containerization and microservice architectures, supporting Docker and Kubernetes; 2) introducing JIT compilers and enumeration types to improve performance and data processing efficiency; 3) Continuously optimize performance and promote best practices.

When would you use a trait versus an abstract class or interface in PHP?When would you use a trait versus an abstract class or interface in PHP?Apr 10, 2025 am 09:39 AM

In PHP, trait is suitable for situations where method reuse is required but not suitable for inheritance. 1) Trait allows multiplexing methods in classes to avoid multiple inheritance complexity. 2) When using trait, you need to pay attention to method conflicts, which can be resolved through the alternative and as keywords. 3) Overuse of trait should be avoided and its single responsibility should be maintained to optimize performance and improve code maintainability.

What is a Dependency Injection Container (DIC) and why use one in PHP?What is a Dependency Injection Container (DIC) and why use one in PHP?Apr 10, 2025 am 09:38 AM

Dependency Injection Container (DIC) is a tool that manages and provides object dependencies for use in PHP projects. The main benefits of DIC include: 1. Decoupling, making components independent, and the code is easy to maintain and test; 2. Flexibility, easy to replace or modify dependencies; 3. Testability, convenient for injecting mock objects for unit testing.

Explain the SPL SplFixedArray and its performance characteristics compared to regular PHP arrays.Explain the SPL SplFixedArray and its performance characteristics compared to regular PHP arrays.Apr 10, 2025 am 09:37 AM

SplFixedArray is a fixed-size array in PHP, suitable for scenarios where high performance and low memory usage are required. 1) It needs to specify the size when creating to avoid the overhead caused by dynamic adjustment. 2) Based on C language array, directly operates memory and fast access speed. 3) Suitable for large-scale data processing and memory-sensitive environments, but it needs to be used with caution because its size is fixed.

How does PHP handle file uploads securely?How does PHP handle file uploads securely?Apr 10, 2025 am 09:37 AM

PHP handles file uploads through the $\_FILES variable. The methods to ensure security include: 1. Check upload errors, 2. Verify file type and size, 3. Prevent file overwriting, 4. Move files to a permanent storage location.

What is the Null Coalescing Operator (??) and Null Coalescing Assignment Operator (??=)?What is the Null Coalescing Operator (??) and Null Coalescing Assignment Operator (??=)?Apr 10, 2025 am 09:33 AM

In JavaScript, you can use NullCoalescingOperator(??) and NullCoalescingAssignmentOperator(??=). 1.??Returns the first non-null or non-undefined operand. 2.??= Assign the variable to the value of the right operand, but only if the variable is null or undefined. These operators simplify code logic, improve readability and performance.

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 Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Safe Exam Browser

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.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use