Blogger Information
Blog 14
fans 0
comment 0
visits 15075
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php开发独立环境安装
krasenChen的博客
Original
934 people have browsed it
1.安装Apache服务器
 (1)下载与安装
 (2)验证:
  在浏览器的地址栏输入:
  localhost | 127.0.0.1  |本地局域网的IP
  浏览器上显示: It works!时,说明安装成功!并且服务正常启动
  以前常修改配置(DocumentRoot directory)
  eg:
  1:DocumentRoot "C:/phpedu/Apache2.2/htdocs" 改 DocumentRoot "C:/phpedu/www"
  2:<Directory "C:/phpedu/Apache2.2/htdocs"> 改 <Directory "C:/phpedu/Apache2.2/www">
  重启Apache服务让修改后的配置生效
  
2.PHP的安装与配置(PHP与Apache整合)
在httpd.conf中
#1:加载PHP模块
LoadModu php7_module 'C:\phpedu\php7.0\php7apache2_2.dll'
#2:配置php.ini文件的正确路径
PHPiniDir "C:\phpedu\php7.0"
#3:添加PHP类型文件到Apache服务器中
AddType application/x-htppd-php .php
#4添加默认主页文件(DirectoryIndex index.html index.php)
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

3.MySQL与PHP整合
MySQL是作为PHP的扩展来安装和使用的
在php.ini中
(1)修改扩展类的路径
;extension_dir = "ext"  改
 extension_dir = "C;\phpedu\php7.0\ext"
(2)去掉三个;分号,把三个有关MySQL的扩展应用开启
extension = php_mysql.dll
extension = php_mysqli.dll
extension = php_pdo_mysql.dll
保存配置,重启Apache
测试:
<?php
    $mysqli = new mysqli("localhost", "root" ,"123456", "test");
    if($mysqli->connect_errno) {
        die('数据库连接失败'.$mysqli->connect_error);
    }
    echo '<h1 style="color:#f00;">数据库连接成功</h1>';
?>


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post