中篇:安装及配置PHP
Apache装好了,终于可以弄开始弄PHP了,那么我们就开始吧。首先将先前下载好的php-5.2.0-Win32.zip解压缩,目录的话随你喜欢咯,我这里为了方便讲解,就解压缩到D:\php5好了。如果你要改路径的话,下面所有的路径都要记得改哦。由于这篇教程涉及的内容比较简单,我就不做图片咯。
接下来要做的是把PHP和Apache服务器连接上,具体步骤如下:
1、将D:\php5目录下的“php.ini-recommended”重命名为“php.ini”;
2、将“php.ini”文件拷贝到Windows或WinNT目录下,看操作系统是什么而定,如WindowXP和Windows2003是C:\Windows,Windows2000则是C:\Winnt。
3、打开“php.ini”文件,修改以下几个重要的关键字(小技巧:按键盘Ctrl + F 进行关键字查找):
•找到extension_dir = “./” 把它修改成你PHP目录里的ext路径,修改后为extension_dir = “D:\php5\ext”
•如果以后显示中文的时候出现乱码,可以将
;default_charset = “iso-8859-1” 改为
dfault_charset = “gbk”(去掉前面的分号,表示设置生效,以下都是如此)
•我们以后将用session对象来存储数据,这个非常重要,将
;session.save_path = “/tmp” 该为
session.save_path = “D:/php5/session” (当然你要自己去建个session文件夹)
•找到display_errors和cgi.force_redirect,把它们改成
display_errors = ON
cgi.force_redirect = 0
(千万要注意分号的修改,有分号还是没有分号,以后我就不再提醒咯)
•把下面几句的分号全部去掉:
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_imap.dll
;extension=php_mysql.dll
;extension=php_mysqli.dll (如果没有这行的话,自己手动添加上去,也去掉分号)
接下来修改了一些文件上传以及内存使用最大限制:
memory_limit = 20M
post_max_size = 20M
upload_max_filesize = 20M
基本上改这些就够用了,如果你需要用到其他扩展功能,可以继续进行相关修改,由于篇幅关系我,这里就不再介绍了。修改后一定要记得重新启动(Restart)Apache服务器哦,否则不会生效。
OK,现在我们来测试下安装是否成功吧。建立一个新文件info.php,保存在D:\PHProot文件夹下,输入以下代码并保存:
Phpinfo();
?>
打开浏览器输入http://localhost/info.php 如果能打开下面的网页,则代表安装成功了,否则,再好好检查下哪里弄错了吧,祝你好运哦:
点击下载此教程的world文档

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 is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.
