Practical PHP5+Apache2.2+MySQL5.1 configuration experience_PHP tutorial

WBOY
Release: 2016-07-15 13:26:04
Original
741 people have browsed it

Yesterday, I suddenly wanted to get some PHP, so I started configuring it on my notebook. I have configured it before. The main problem was that the connection to MySqL failed, and it prompted Fatal error: Call to undefined function mysql_connect(). I searched for information on the Internet, whether it was setting environment variables or copying php.ini and libmysql.dll to the system32 directory. I tried everything but failed, and finally gave up. I encountered the same problem this time, but I made up my mind: If I don't succeed, I will smash my notebook! Finally, I still feel sorry for my notebook, and the configuration was successful just now. Yichen Joy^o^......

Configuration environment: Windows Xp Professional Sp2 + Apache 2.2.4 + PHP 5.2.5 + Mysql 5.1.33

Now share the experience as follows:

Key directory representation: PHP installation directory—PHP_Dir, Apache installation directory—Apache_Dir. Note that there is no "/" or "" at the end of the directory string

1. Install MySql, PHP, and Apache. There is generally no problem with the installation. The key lies in configuration.

2.Configure php.ini:

(1) Copy php.ini-dist in the PHP_Dir directory and rename it to php.ini.

(2) Open php.ini, locate extension_dir, and set extension_dir = "PHP_Dir". Note that the end of PHP_Dir does not include the slash "/", and the backslash "" is changed to a slash "/".

(3) In php.ini, locate extension=php_mysql.dll, delete the ";" sign in front of this line, and change it to extension=ext/php_mysql.dll. If you want to load mysqli or other modules, modify it in the same way.

When configuring extension_dir, there are many on the Internet, but they basically keep the default "./", and copy files and set environment variables, which is too troublesome. It has never been successful on my laptop (I have only successfully configured it on a company desktop). In my current configuration, the total path of the MYSQL module is "PHP_Dir/ext/php_mysql.dll", otherwise Apache cannot load the Mysql module when it starts.

3. Configure httpd.conf

(1) Open httpd.conf in the Apache_Dirconf directory (a novice like me is best to make a copy, haha) .

(2) Locate Listen, the default is Listen 80. If there are multiple servers, you can make appropriate modifications. My IIS occupies port 80, so I changed it to Listen 81.

(3) Add LoadModule. For the convenience of reading, locate it behind a large list of LoadModules and add

LoadModule php5_module "PHP_Dir/php5apache2_2.dll"

AddType application/ x-httpd-php .php

PHPIniDir "PHP_Dir" If you use php5apache2_2.dll, it may also be php5apache2.dll. According to your own environment settings

(4) Set the root directory appropriately, I put DocumentRoot "Apache_Dir/htdocs" is changed to another directory, and the is also modified accordingly.

At this point, the configuration is complete. I excitedly opened the browser and entered

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446639.htmlTechArticleYesterday I suddenly wanted to do some PHP, so I started configuring it on my notebook. I have configured it before. The main problem is The connection to MySqL failed, prompting Fatal error: Call to undefined function mysql_con...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template