PHP移动互联网开发笔记(1)环境搭建及配置
开篇说明:记得我上大二的时候第一次听到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
二、软件下载
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安装
安装成功
(2)解压PHP5.4
(3)配置Apache的httpd.conf文件
Apache安装目录
ServerRoot "D:/Apache Software Foundation"监听端口
#Listen 12.34.56.78:80Listen 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
配置解析phpAddType 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的配置文件,我们在apache配置文件中指定一下php的配置文件目录
PHPIniDir "D:/php54"
五、配置多站点访问
# 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"; ?>注意:要修改权限文件夹目录
访问结果:
说明:关于mysql的安装在这里我就不做介绍了。

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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
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 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
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment