筹建windows下php环境(一)
搭建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();?>
然后在浏览器中的输入http://localhost/demo.php,大功告成.

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

Deploying Hadoop Distributed File System (HDFS) on a CentOS system requires several steps, and the following guide briefly describes the configuration process in stand-alone mode. Full cluster deployment is more complex. 1. Java environment configuration First, make sure that the system has Java installed. Install OpenJDK with the following command: yumininstall-yjava-1.8.0-openjdk-devel Configure Java environment variables: echo "exportJAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk">>/etc/profileecho"ex

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.
