PHP环境搭建
现在做网站很流行用织梦和帝国啊,所以想学习这两个建站模板。上网查了下这两个都是用 php 写的,生成的网站是 php+mysql ;无耐先学 php 吧,在学习这两个模板。 php 环境搭建; 1 、需要下载几个东西: Apachehttpd-2.2.22-win32-x86-openssl-0.9.8t.msi P
现在做网站很流行用织梦和帝国啊,所以想学习这两个建站模板。上网查了下这两个都是用php写的,生成的网站是php+mysql;无耐先学php吧,在学习这两个模板。
php环境搭建;
1、 需要下载几个东西:
Apache httpd-2.2.22-win32-x86-openssl-0.9.8t.msi
PHP php-5.3.10-Win32-VC9-x86.zip
Mysql http://www.mysql.com/downloads/
点击下载;
PHPEclipse Php的IDE 因为我电脑上已安装了eclipse 为了方便我选择了PHPEclipse ,网上下载的地址也较多 ;
http://www.oschina.net/p/phpeclipse
Mysql 的图形管理工具,我选择了,phpmyadmin
2、PHPEclipse 解压下载的文件,复制解压出的文件覆盖到Eclipse 的安装目录下,重新启支Eclipse 在新建project时就有了php工程。
3、apache 安装;
4、Php只要解压到一个目录下就可以(与apache在同级目录下好些)。
5、Mysql安装可参考(http://www.jb51.net/article/23876.htm)。
6、这三个安装好之后要进行各种配置了。
A、Apache :
首先修改Apache的配置文件,让Apache支持解析PHP文件。Apache配置文件在Apache安装目录的conf目录下的httpd.conf。也可从开始-程序-Apache http server打开。该文件内的“#”为注释符。
1. 让Apache可以解析php文件,在配置文件中找到
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
在下一行添加 (红色的位置是根据PHP的所在目录而定的,即php-5.3.10-Win32-VC9-x86.zip
文件解压的目录)
LoadModule php5_module "D:/Develop/PHP/php5apache2_2.dll"
PHPIniDir "D:/Develop/PHP"
AddType application/x-httpd-php .php .html .htm
2. 在配置文件中找到
DirectoryIndex index.html改为
DirectoryIndex index.php index.html
3. 修改Apache站点目录,在配置文件中找到(Apache安装的目录不同,显示的值不一样)
DocumentRoot "D:/Develop/Apache2.2/htdocs"改为 (D:/Develop/Apache2.2)apach安装目录
DocumentRoot "D:/Workspace/PHP"
再找到
注释:如果安装后apache不能正常启动可查看“应用程序日志”,一般是80端口号被占用。
确定谁占用了我们的80端口
1、Windows平台
在windows命令行窗口下执行:
C:\>netstat -aon|findstr "80"
TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 2448
看到了吗,端口被进程号为2448的进程占用,继续执行下面命令:
C:\>tasklist|findstr "2448"
thread.exe 2016 Console 0 16,064 K
很清楚吧,thread占用了你的端口,Kill it
如果你不想杀掉这个占用80端口的进程可以修改apache的默认端口。
也是在 Apache安装目录的conf目录下的httpd.conf这个文件中修改,
找到“Listen80”,紧接着Listen的数字就是端口号,我们改为“Listen 8088”,可以用上面的方法查看修改的端口号是否也被占用。保存后重新启动Apache。
B、php配置
找到php-5.3.10-Win32-VC9-x86.zip 文件解压的目录,把php.ini-development改名为php.ini,作为PHP的配置文件。修改php.ini。“;”分号(在此文件中为注释符)
(红色的位置是根据PHP的所在目录而定的,即php-5.3.10-Win32-VC9-x86.zip 文件解压的目录)
1. 设置PHP扩展包的具体目录,找到
; On windows:
; extension_dir = "ext"
改为 (值是ext文件夹是phpk中的的目录,内包含php重要的dll文件。)
; On windows:
extension_dir = "D:/Develop/PHP/ext"
(注意前面的“;”去掉)
2. 开启相应的库功能,找到需要开启的库的所在行
;extension=php_curl.dll
;extension=php_gd2.dll
;extension=php_mbstring.dll
;extension=php_mysql.dll
;extension=php_xmlrpc.dll
去掉前面的分号(注释),即改为
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_xmlrpc.dll
3. 设置时区,找到
;date.timezone =改为
date.timezone = Asia/Shanghai
注释;在这些配置后,要重启动apache .。在查找时可以用肇事本中 的查找功能查找。
测试配置成功不成功。
建站点目录。D:/Workspace/PHP 在目录下新建文本文档后缀名改为.php 打开添加以下内容:
phpinfo();
//可以写自己的第一个php的holle word!了。
//echo "Hello World";
?>
打开浏览器输入:http://localhost(:8088),如果是默认端口号80可以不加端口号,修改默认端口号的话要加上端口号。若显示以下内容则配置成功。
C、phpMyAdmin的配置。
准备工作:
在站点目录中建个文件夹“phpmyadmin”把phpMyAdmin-2.7.0-pl2.tar.gz 文件解压到刚才建的文件夹下。
加mysql的环境变量:把mysql的安装目录bin加入到环境变量中,E:\mysql\MySQL Server 5.6\bin
Cmd 打开dos窗口,输入 mysql -u root -p 加车,提示输入密码 输入后即可进入了。查看mysql中的数据库。用 show databases 命令。Exit退出。
在“D:/Workspace/PHP/phpmyadmin”目录中找到config.default.php文件。然后用记事本打开;
找到$cfg['blowfish_secret'] = '',将其值改为你自己想要的任意字符,如$cfg['blowfish_secret'] = 'suiyi';
找到$cfg['Servers'][$i]['auth_type'] = 'config',改为$cfg['Servers'][$i]['auth_type'] = 'cookie';
找到$cfg['DefaultLang'] = 'en-iso-8859-1',改为$cfg['DefaultLang'] = 'zh-utf-8';
找到$cfg['DefaultCharset'] = 'iso-8859-1',改为$cfg['DefaultCharset'] = 'zh-utf-8';
$cfg['PmaAbsoluteUri'] = 'http://您的域名(localhost:8088)/phpmyadmin/'; (phpmyadmin为phpmyadmin角压的文件夹。)
$cfg['Servers'][$i]['host'] = '数据库主机地址'; 本机localhost
$cfg['Servers'][$i]['user'] = '站点ID'; root
$cfg['Servers'][$i]['password'] = '密码'; 安装mysql数据库时设置的root密码
$cfg['Servers'][$i]['only_db'] = '数据库名(站点ID)'; mysql 查询到存在的数据。
保存。可以测试了。Mysql的服务要启动。
在浏览器中输入地址:http://local:8088/phpmyadmin 回车看到如下页面。
则配置成功。
输入密码登录进去就可以对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

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 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

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,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

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.

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.
