Home Backend Development PHP Tutorial 筹建windows下php环境(一)

筹建windows下php环境(一)

Jun 13, 2016 pm 12:04 PM
apache nbsp oracle php windows

搭建windows下php环境(一)
第一次写,不知道如何开头,就把今天搭建php环境的流程梳理一下,以供参考.
先介绍一下运行环境:win7 + Apache 2.4.10 + php 5.5.15 + oracle 11g
先前从php.net和apache.org上下载了最新版本,但是由于都是需要自己编译的,所以还是直接用编译好的。下面是获取介质的地址,不用满处瞎找了。
http://www.apachelounge.com/download/
http://windows.php.net/

剩下的工作就是下载,安装.安装都是直接解压即可。我个人认为解压的东西最好放在某个盘的根目录下,不要太深入了。
剩下就是简单的配置:
1、将PHP的安装目录下的2个php.ini-*的文件,根据自身情况修改php.ini;
2、然后根据需要修改php.ini文件,目前我只搭建了一个基本环境,而且是连接oracle11g,所以现在只修改了一些相关的内容,其他的安全性的配置并没有弄:
添加  extension_dir = "E:/php/php5.5/ext"
将extension=php_oci8_11g.dll和extension=php_pdo_oci.dll前面的;去掉
修改一下时区为中国时区
date.timezone = Asia/Shanghai
3、修改Apache安装目录下的conf文件夹下的httpd.conf文件
  将ServerRoot的值修改为自己的Apache安装目录(例如:"E:/php/Apache24"),这个一定要在注册为windows服务前修改,不然注册时会报错.
  添加下面信息
      PHPIniDir "E:/php/php5.5"
     LoadModule php5_module "E:/php/php5.5/php5apache2_4.dll"
  修改下面的路径为自己网站的目录:
      DocumentRoot "E:/php/web"
    
  寻找AddType,在后面添加如下内容:
  AddType application/x-httpd-php .php .html .htm
4、将Apache注册为windows服务,这样启停比较方便。注意一点,在注册之前,先要
    使用cmd进入Apache的安装目录下的bin文件夹下,执行如下命令:
          httpd -k install  //还可以自定义服务名,这里就不介绍了
    上面基本上搭建完了php和apache环境,能否对外提供服务了,但是还有很多参数需要调整的,后面学习时,再给补充上.下面搭建oracle环境.
   我是在一台设备上安装了oracle数据库,同时安装了一个oracle Instance Client客户端,这个客户端主要是为了OCI等内容.网上的链接好多都不能下载,下面提供一个,目前下载没有问题:
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
oralce数据库的安装文件直接去oracle网站下就行了,这个挺好找的.
   这里略去oracle的安装过程,oracle Instance Client客户端直接解压就可以了,建议也是放在某个盘的根目录下,然后在PATH变量中添加该客户端的路径,而且要放在最前面.如果本机上没有安装oracle数据库,倒是无所谓了.
   安装完客户端,需要重启一下Apache服务.这块注意一下,我在重启的时候,是直接点击的"重启",但是发现Apache安装目录下的log文件夹下的httpd.pid文件的修改时间并没有更新,而且在使用phpinfo();测试的时候,OCI的模块也没有显示出来,很是奇怪,所以这块建议先停止,然后启动.这样就没有出现上面的问题.
   具体原因,我查找了Apache的技术文档中关于重启的集中方式。其中有一种重启,是apache父进程并没有停止,而是把子进程杀掉了.虽然也会重读配置文件和重新生成日志文件.但是模块只会重置状态为初始值,但是对于变化的内容却没有生效.(这块有一些我自己的理解,真正是不是这样还需要进一步确认).
    现在就可以测试了,写一个简单的demo.php页面:

<?php phpinfo();?>
Copy after login

然后在浏览器中的输入http://localhost/demo.php,大功告成.

Statement of this Website
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

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

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
How to handle high DPI display in C? How to handle high DPI display in C? Apr 28, 2025 pm 09:57 PM

Handling high DPI display in C can be achieved through the following steps: 1) Understand DPI and scaling, use the operating system API to obtain DPI information and adjust the graphics output; 2) Handle cross-platform compatibility, use cross-platform graphics libraries such as SDL or Qt; 3) Perform performance optimization, improve performance through cache, hardware acceleration, and dynamic adjustment of the details level; 4) Solve common problems, such as blurred text and interface elements are too small, and solve by correctly applying DPI scaling.

Composer: Aiding PHP Development Through AI Composer: Aiding PHP Development Through AI Apr 29, 2025 am 12:27 AM

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

What is the significance of the session_start() function? What is the significance of the session_start() function? May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

How to uninstall MySQL and clean residual files How to uninstall MySQL and clean residual files Apr 29, 2025 pm 04:03 PM

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

Apache in Action: Web Servers and Web Applications Apache in Action: Web Servers and Web Applications Apr 28, 2025 am 12:21 AM

The main functions of ApacheHTTPServer include modular design, virtual host configuration and performance optimization. 1. Modular design implements functions by loading different modules, such as SSL encryption and URL rewriting. 2. Virtual host configuration allows multiple websites to be run on one server. 3. Performance optimization improves performance by adjusting parameters such as ServerLimit and KeepAlive.

H5: Key Improvements in HTML5 H5: Key Improvements in HTML5 Apr 28, 2025 am 12:26 AM

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.

How to use MySQL functions for data processing and calculation How to use MySQL functions for data processing and calculation Apr 29, 2025 pm 04:21 PM

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Apache: Configuring and Managing a Web Server Apache: Configuring and Managing a Web Server Apr 29, 2025 am 12:18 AM

The steps to configure and manage ApacheHTTPServer include: 1. Basic configuration: Set the server name, listening port, and document root directory. 2. Advanced configuration: Set up virtual host, enable SSL encryption and URL rewriting. 3. Performance optimization: Adjust KeepAlive settings and use cache. 4. Solve FAQs: Check configuration file syntax and optimize server parameters. Through these steps, you can ensure that the Apache server runs stably and optimize its performance.

See all articles