Home  >  Article  >  Backend Development  >  How to install mysql driver in php5

How to install mysql driver in php5

藏色散人
藏色散人Original
2022-11-21 09:49:222100browse

How to install the mysql driver in php5: 1. Download the "mysql-5.1.49-win32" version; 2. Find php.ini in the php installation directory; 3. Change ";extension=php_mysql.dll" Remove the semicolon before ";"; 4. Load the mysql module; 5. Restart apache.

How to install mysql driver in php5

#The operating environment of this tutorial: Windows7 system, PHP5 version, Dell G3 computer.

php5 How to install mysql driver?

apache php5 mysql installation method

The entire installation process is as follows:

1, first install apache: the version I installed is: httpd-2.2.16-win32 -x86-openssl-0.9.8o.msi

Website: http://www.apache.org/dist/httpd/binaries/win32/

apache installation and configuration went smoothly, nothing wrong Easy to say.

How to change the file path:

In the installation directory of the file, mine is: D:\Program Files\Apache Software Foundation\Apache2.2\conf, open httpd.conf search :DocumentRoot "C:/web/apache/htdocs" change the value to the publishing path you want, for example:

DocumentRoot "D:/WWW"

Then there is another place that is also needed Modify

Search: Directory "C:/web/apache/htdocs"

Modify to: Directory "D:/WWW"

This changes the release path of the file Go to d:www.

2, install PHP: Version: php-5.3.3-Win32-VC6-x86

Website: http://windows.php.net/download/

Unzip the downloaded compressed package to D:php, and rename php.ini-development in this directory to php.ini

Open php.ini and modify it as follows:

Search: error_reporting = E_ALL

Modification: error_reporting =E_ALL & ~E_NOTICE

This is to modify the error reporting level, E_ALL is to report all errors, and E_NOTICE is to report messages that should be paid attention to during runtime, such as initialized variables.

Search: extension_dir = "./"

Modify: extension_dir = "D:\php5\ext", configure the path of the extension library

Search:;extension=PHP_MySQL .dll, remove the preceding semicolon: extension=PHP_MySQL.dll

Search: ;extension=PHP_mysqli.dll Remove the preceding semicolon: extension=PHP_mysqli.dll

Search;session.save_path = "/tmp", change it to an existing path, session.save_path = "D:/mysql/session", or create a tmp folder in the release directory.

The basic settings of PHP are completed

3, configure apache to load PHP

Open the installation directory of apachede, mine is: D:\Program Files\Apache Software Foundation\Apache2. 2\conf\extra, create a new text file named: httpd-php5.conf, open it and add the following content

view sourceprint?LoadModule php5_module "C:\web\php\php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php
PHPIniDir "C:\web\php"

Then open: C:\web\apache\conf\httpd.conf, at the end of the file Add a line:

Include conf/extra/httpd-php5.conf

Restart Apache, open the directory: D:\WWW, create a new file: index.php, enter the content:

phpinfo();
?>

Use a browser to open http://localhost, test Whether the installation is successful

Step 4: Install mysql: version mysql-5.1.49-win32

Website: http://dev.mysql.com/downloads/mysql/#downloads

There is a configuration wizard after installation. There is no strict set of options. You can just set them according to your own needs. It will have little impact.

Combined with Apache and php, as mentioned before, let me talk about it again, find php.ini in the php installation directory, remove the ";" before ";extension=php_mysql.dll", and load mysql module. Save, close, and restart apache.

Step 5: Install phpMyAdmin

I downloaded it from Huajun Software: http://www.onlinedown.net/soft/2616.htm

Unzip and publish directory, which is the D:\WWW set up earlier; change config.default.php

under the \libraries folder and make the following modifications:

1 Find the password and have the following two lines

$cfg['Servers'][$i]['user'] = 'root';

$cfg['Servers'][$i]['password'] = '' ;

Fill your mysql password into $cfg['Servers'][$i]['password'] = ''; inside the single quotes

2 Search $cfg['PmaAbsoluteUri '], set it to the phpMyAdmin directory path, such as: http://localhost/phpMyAdmin/

I don’t know if the above method is necessary, because it can run after I changed it back later.

Summary of problems encountered during the configuration process:

1. The installation of mysql failed.

The general situation is that the previous Mysql uninstallation was incomplete. How can I cleanly uninstall mysql? In a DOS environment

1, first stop the mysql service: Stop Mysql: net stop mysql, or you can right-click "My Computer" - Management - Services - Find the mysql service , and then stop.

2, uninstall c:\mysql\bin\mysqld-nt under DOS --remove

//c:\mysql\bin\ is the specific path. If you want to completely delete mysql, first End the mysql process and then uninstall mysql.

The two additional DOS instructions are:

Start Mysql: net start mysql

Installation: c:\mysql\bin\mysqld --install //Pay attention to modifications Specific path

3, delete the remaining mysql files directly.

If you accidentally deleted all mysql files and did not perform the above uninstall function before, you can use the following method:

1, stop the mysql service, the same as above 1.

2, manual deletion requires refreshing to execute if you need to introduce external Js]

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to install mysql driver in php5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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