PHP搭建(windows64+apache2.4.7+mysql-5.6+php5.5+phpMyAdmin)
以下文章参考的3个来源,在加上本人搭建过程中遇到的问题的修复完善笔记: 《PHP环境的搭建和Discuz! 安装 》 http://www.myxzy.com/post-386.html http://www.discuz.net/thread-3258186-1-1.html 现在大部分一键 安装 包多是32位的,并不支持64位,直接在6
以下文章参考的3个来源,在加上本人搭建过程中遇到的问题的修复完善笔记:
《PHP环境的搭建和Discuz!安装》
http://www.myxzy.com/post-386.html
http://www.discuz.net/thread-3258186-1-1.html
现在大部分一键安装包多是32位的,并不支持64位,直接在64位的系统上使用会报错的,所以我这里就来说说windows 64位系统如何建立Apache+PHP+MySQL环境的!
我这里演示用的windows 2008 64位简体中文版,apache,php,mysql多用的是64位的版本。建立的是本地环境,所以我用的是默认设置。
1、下载PHP、Apache和Mysql软件以及VC库。
下面分别是PHP、Apache和Mysql的官网地址。
PHP:http://windows.php.net/qa/
Mysql:http://www.mysql.com/downloads/mysql/
Apache:http://www.apachelounge.com/download/win64/
本教程要用到的php,apache,mysql以及vc库,下载地址:百度网盘
2、安装前注意事项。
你注意下下载PHP,Apache的网站,上面有提示要安装Visual C++库的。
Apache2.4.4需要VC10库支持,Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)
PHP5.6需要VC11库支持,Visual C++ Redistributable for Visual Studio 2012 Update 1
注1:如果Apache2.4.4没有安装VC10库,会出现如下提示的错误。
错误提示:“无法启动此程序,因为计算机中丢失MSVCR100.dll。尝试重新安装该程序以解决此问题。”
注2:如果PHP5.5.0beta2没有安装VC11库,会出现如下提示的错误。
3、安装Apache(D盘根目录下)
(1)打开D:\discuz\Apache24\conf下httpd.conf 文件,用记事本打开编辑作如下修改并保存。
第37行ServerRoot "c:/Apache24"改为ServerRoot “D:/discus/Apache24”;//Apache程序的位置。
第204行的ServerAdmin改不改无所谓;
第213行ServerName前面的“#”号去掉;
第237行DocumentRoot "c:/Apache24/htdocs"改为DocumentRoot " D:/discus/Apache24/htdocs ";//网站的根目录
第238行
第271行DirectoryIndex index.html改为DirectoryIndex index.html index.php index.htm //支持更多的默认页
第354行 ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"改为ScriptAlias /cgi-bin/ " D:/discus/Apache24cgi-bin/"
第370行
(2)启动Apache。
开始 --- 运行,输入cmd,打开命令提示符。分别输入如下命令(每行回车)
d:
cd Apache24\bin
httpd
如果httpd.conf配置正确的话,输入httpd回车后是没有任何提示的。不要关闭命令窗口(关闭命令窗口就是关闭Apache),本地浏览器访问。出现“It works”那么就说明apache已经正确安装了。
(3)把Apache加入系统服务
关闭httpd命令窗口,不然会报错的。
开始 --- 运行,输入cmd,再打开一个命令提示符。分别输入如下命令(每行回车)
d:
cd Apache24\bin
httpd.exe -k install -n "servicename" \\加入服务。servicename是服务里面的名字,可以自定义。
如果要卸载这个服务的话,先要停止这个服务,然后输入httpd.exe -k uninstall -n "servicename"卸载这个服务。
4、安装PHP(D盘根目录下)
这里PHP5.5.0用php5apache2_4.dll来配置的。也不用PHP.ini文件了,用PHP默认的了。
(1)打开Apache24\conf下httpd.conf,在最后加上
# php5 support
LoadModule php5_module "d:/discuz/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "d: /discuz /php"
(2)重启 Apache 服务器。
网站文件夹D:/discuz/Apache24/htdocs新建一个index.php,内容为保存,访问出现php的信息就说明php已经成功安装。如下图。
5、MySQL安装
MySQL安装我简单说了下也就是通过cmd命令即可。(每行回车)
d:
cd mysql\bin
MySQLd --install MySQL
net start MySQL
在php目录下
第730行; extension_dir = "ext",去掉前面的“;”,并改为extension_dir ="d:\discuz\php\ext"
找到extension 添加下面两行
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_mbstring.dll (这里主要用于phpMyAdmin支持中文)
重启httpd即可测试
;D:\discuz\php\ext
phpMyAdmin 4.1.2安装
http://www.phpmyadmin.net/home_page/downloads.php 官网下载
解压到你网站跟目录下并重命名phpMyAdmin(我的网站根目录为:D:\discuz\Apache24\htdocs)
在phpMyAdmin目录下找到 libraries /config.default.php文件
查找password 找到两行,填入mysql的用户和密码
$cfg['Servers'][$i]['password'] = '*****';
$cfg['Servers'][$i]['user'] = 'root';
设置$cfg['PmaAbsoluteUri'] = ''; 为phpMyAdmin目录路径(如:http://localhost/phpMyAdmin/)
$cfg['DefaultLang'] = 'en'; 这里可以设置编码 zh
$cfg['DefaultConnectionCollation'] = 'utf8_general_ci'; 设置数据库编码
测试(apache和mysql均已经启动)打开http://localhost/phpMyAdmin/ 出现以下页面则安装成功
填入之前设置的用户名和密码,登陆即可
Discuz 论坛搭建
在D盘下新建网站跟目录文件夹web,
把原来D:\discuz\Apache24\htdocs 下的phpMyAdmin复制到web里面
修改apache下conf/ httpd.conf文件里的DocumentRoot 改为 DocumentRoot "D:/web"
重启apache
在D:/web文件下编辑测试文件web.php ,编辑
在浏览器打开http://localhost/web.php 成功出现以下图片
Discuz! X3 安装图文教程
下载x3.1
http://www.comsenz.com/downloads/install/discuzx
|
(1)输入http://localhost/install/ 则会出现安装目录
|

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











JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

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.
