Home php教程 php手册 WAMP学习日记之:Apache发布php网站

WAMP学习日记之:Apache发布php网站

Jun 06, 2016 pm 07:36 PM
apache php wamp Revise release study journal website

1.修改httpd.conf 文件,以便让Apache和php模块建立关联 2.配置php.ini文件 修改httpd.conf 文件,以便让Apache和php模块建立关联 如何让apache和php建立关联?通过apache内的配置文件httpd.conf来配置php模块。 添加模块:LoadModule php5_module "php的路

1.修改httpd.conf 文件,以便让Apache和php模块建立关联

2.配置php.ini文件

 

修改httpd.conf 文件,以便让Apache和php模块建立关联


如何让apache和php建立关联?通过apache内的配置文件httpd.conf来配置php模块。
 添加模块:LoadModule php5_module "php的路径/php5apache2_2.dll" 
 建立文件关联:AddType application/x-httpd-php .php
 建立默认索引:DirectoryIndex index.php default.php index.htm

建立新站点。
 
     DocumentRoot "需要发布网站的位置" 
     ServerName IP地址

 

 

修改php.ini文件

1、在记事本中查找“extension_dir”,然后把 extension_dir = "./"
修改为 extension_dir = "C:/php/ext"        //这里是php的路径

2、在记事本中查找“;extension=php_mysql.dll”和“;extension=php_gd2.dll”,然后把前面的“;”去掉,即把 ;extension=php_mysql.dll 改为 extension=php_mysql.dll
   把 ;extension=php_gd2.dll 改为 extension=php_gd2.dll

 重启wamp即可用IP访问

如何让php支持mysql模块?修改php.ini文件,暂时我也没有亲收试过,以后还是得多看看用户手册。以后再开发过程中用户手册和开发文档都同样的重要,文档的交流在一定时期还是占很大的空间

在windows系统必须把php目录下的libmysql.dll拷贝到windows目录下才可以让php支持mysql。

 进入 X:/Server/PHP …… 将 PHP.ini-recommend 更名为 PHP.ini 并用文本编辑器打开……
 修改错误报告级别…… 运行一些书写不规范的程序…… 你会发现满屏的‘错误’……
 搜索:
 error_reporting = E_ALL
 修改为:
 error_reporting = error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
 由于是本地调试,我当然希望错误被输出供我调试……
 搜索:
 display_errors = Off
 修改为:
 display_errors = On
 对于本地开发者,记录错误似乎没有必要……
 搜索:
 log_errors = On
 修改为:
 log_errors = Off
 设置扩展库的路径是很必要的……
 搜索:
 extension_dir = “./”
 修改为:
 extension_dir = “X:/Server/PHP/ext”
 PHP 5 默认是不开启对 MySQL 的支持的……
 搜索:
 ;extension=PHP_MySQL.dll
 去掉前面的分号:
 extension=PHP_MySQL.dll
 另外,vBulletin 早已启用了对 Mysqli 的支持…… 所以这里我们引入 MySQL 扩展库……
 搜索:
 extension=PHP_MySQL.dll
 在下方加入:
 extension=PHP_mysqli.dll
 当然,为了更好的使用 vBulletin 的一些图象相关功能,我们需要启用 GD2 库……
 搜索:
 ;extension=PHP_gd2.dll
 去掉前面的分号:
 extension=PHP_gd2.dll
 我们还希望对一些较常用的库进行调用,比如 PHP_mbstring.dll 、 PHP_curl.dll 、 PHP_sockets.dll 、 PHP_xmlrpc.dll 等等…… 开启方法同上……
 (这里仅启用了常用扩展…… 其它的扩展请自行根据需要定夺……)
 虽然 vBulletin 使用了其内建 Session 机制,但 PHP 的 Session 机制在很多程序中是必备的……
 搜索:
 ;session.save_path = “/tmp”
 修改为一个存在的路径里……
 或者到发布目录下建立一个 tmp 目录……
 这里我们选用前一种方法…… 先建立这样一个目录 X:/Session ……
 然后修改为:
 session.save_path = “X:/Session”

Statement of this Website
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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

How to start apache How to start apache Apr 13, 2025 pm 01:06 PM

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

How to delete more than server names of apache How to delete more than server names of apache Apr 13, 2025 pm 01:09 PM

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

PHP: Handling Databases and Server-Side Logic PHP: Handling Databases and Server-Side Logic Apr 15, 2025 am 12:15 AM

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.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to view your apache version How to view your apache version Apr 13, 2025 pm 01:15 PM

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).

See all articles