search
Homephp教程php手册PHP移动互联网开发笔记(1)环境搭建及配置

PHP移动互联网开发笔记(1)环境搭建及配置

Jun 06, 2016 pm 07:45 PM
phpinternetdevelopbuildenvironmentmovenotesConfiguration

开篇说明:记得我上大二的时候第一次听到PHP,当时只知道这是一个开发网站的语言,并没有深入学习,在学了Java Web开发和Android开发之后我对互联网的发展方向有了一个我自己的认识,现在我们不能将互联网和移动开发分离开来,这两个东西已经融合为一体,移动

开篇说明:记得我上大二的时候第一次听到PHP,当时只知道这是一个开发网站的语言,并没有深入学习,在学了Java Web开发和Android开发之后我对互联网的发展方向有了一个我自己的认识,现在我们不能将互联网和移动开发分离开来,这两个东西已经融合为一体,移动端的b/s架构已经成为现在的趋势,所以需要使用一种轻量级的网站开发工具,在php5.x出来后更是对这一块有了很大的支持,我个人认为移动开发最少现在已经离不开php,如果有兴趣的朋友或者希望学习php的朋友我们可以一起来学习php,如果有php的大神希望能给出指导和建议.

一、PHP5.4环境搭配基本流程

Apache:Web服务提供者。官网:www.apache.org

PHP: 官网:www.php.net

Mysql:  官网:www.mysql.com

PHP移动互联网开发笔记(1)环境搭建及配置

二、软件下载

Apache下载地址:http://download.csdn.net/detail/lxq_xsyu/7057423

PHP下载地址:http://download.csdn.net/detail/lxq_xsyu/7057401

Mysql下载地址:http://download.csdn.net/detail/lxq_xsyu/6468461

三、环境搭建

(1)Apache安装

PHP移动互联网开发笔记(1)环境搭建及配置

安装成功

PHP移动互联网开发笔记(1)环境搭建及配置

(2)解压PHP5.4

PHP移动互联网开发笔记(1)环境搭建及配置

(3)配置Apache的httpd.conf文件

PHP移动互联网开发笔记(1)环境搭建及配置

Apache安装目录

ServerRoot "D:/Apache Software Foundation"

监听端口

#Listen 12.34.56.78:80
Listen 80

载入PHP组件

LoadModule php5_module "D:/php54/php5apache2_2.dll"
服务器名称
#ServerName www.meritit.com:80
文件根目录
DocumentRoot "D:/Apache Software Foundation/htdocs"
权限文件夹
<directory software foundation></directory>

索引(默认访问主页)
<ifmodule dir_module>
    DirectoryIndex index.html
</ifmodule>
错误日志
ErrorLog "logs/error.log"

访问日志
CustomLog "logs/access.log" common

配置解析php
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php

错误类型
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.meritit.com/subscription_

四、测试是否搭建成功

新建a.php

<?php phpinfo();
?>
PHP移动互联网开发笔记(1)环境搭建及配置

可以看到找不到php的配置文件,我们在apache配置文件中指定一下php的配置文件目录

PHPIniDir "D:/php54"
PHP移动互联网开发笔记(1)环境搭建及配置

五、配置多站点访问

# Virtual hosts
Include conf/extra/httpd-vhosts.conf
去掉上面注释(打开虚拟主机配置文件)

在httpd-vhosts.conf中配置了两个站点如下

<virtualhost>
    DocumentRoot "D:/Apache Software Foundation/a_com"
    ServerName 127.0.0.2
    ServerAlias www.dummy-host.meritit.com
    ErrorLog "logs/dummy-host.meritit.com-error.log"
    CustomLog "logs/dummy-host.meritit.com-access.log" common
</virtualhost>

<virtualhost>
    DocumentRoot "D:/Apache Software Foundation/b_com"
    ServerName 127.0.0.3
    ErrorLog "logs/dummy-host2.meritit.com-error.log"
    CustomLog "logs/dummy-host2.meritit.com-access.log" common
</virtualhost>

注意:一旦配置了虚拟主机,前面配置的DocumentRoot就无效了。

D:\Apache Software Foundation\a_com\a.php

<?php echo "aaaaaa";
?>
D:\Apache Software Foundation\b_com\b.php
<?php echo "bbbbbb";
?>

注意:要修改权限文件夹目录

访问结果:

PHP移动互联网开发笔记(1)环境搭建及配置

PHP移动互联网开发笔记(1)环境搭建及配置

PHP移动互联网开发笔记(1)环境搭建及配置

说明:关于mysql的安装在这里我就不做介绍了。



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

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)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

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.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment