PHP environment configuration php5 MySQL5 apache2 phpmyadmin Installation and configuration Graphics Tutorial _php Tutorial

Source: Internet
Author: User
Tags echo date php and mysql phpinfo blank page mysql command line
So deliberately write this configuration document, I believe that the following steps you will be successful. I hope you'll correct me in the wrong place.
This example is under Wiondws XP
php5.2.1 (Zip)
The installation and configuration
installation of Apache

1 Click Apahce Install package

2 Acceptance Agreement

3 The following 3 items can be filled in
Apache listens on port 80. If IIS uses 80 ports, modify the IIS port or Apache port to avoid conflicts

4 Here The default is typical, click Next.

5 The installation path can be modified here, note that the installation path cannot contain Chinese.

6 Click Install to start the installation

7 Enter http://localhost or in the browser after installation is complete.
If you can see this page to prove that Apache installation is successful, you can already explain the static page

installation of MySQL

1 Click the MySQL installation package

2 default is typical, if you want to modify the installation path, you can also choose Custom.
Note: The path to the installation of MySQL cannot contain Chinese!

3 Click Intall to start the installation

4 Skip Registration

5 Whether to configure MySQL now. You can also configure it later in the Configuration Wizard on the Start menu.
Here is the configuration now

6 Select detailed configuration (detailed settings), click Next to continue

7 The next option is to choose which type of MySQL to apply to, and the first is to develop Server,
will only use as little memory as possible, the second is a normal Web server, will use a medium amount of memory,
The last one is that this server only runs the MySQL database and consumes all of the memory.
Users can choose the option according to their own needs. Just select the development server here, click Next to continue

8 The following is the choice of database purposes, the first is multi-purpose,
The database is optimized to be a good InnoDB (transactional) storage type and a high-efficiency myisam (non-transactional) storage type.
The second is for transaction type only, best optimized innodb, but also supports MyISAM, only MyISAM supports full-text indexing
The last one is simple network development, suitable for simple applications, only myisam types that do not support transactions are supported.
Generally choose the first multifunctional.

9 The following is the choice of INNODDB data storage location, the general default is good, no need to change
(You can also modify the value of the My.ini datadir after installation if you want to modify the data save path)

10 The following is the maximum number of connections allowed for MySQL, the first of which is the maximum number of 20 connection concurrency,
The second is the maximum number of 500 concurrent connections, and the last is custom, you can choose according to your own needs.
Choose the first one here

11 below is whether the network link is running. Select the check box here. The database listens to the port, the general default is 3306,
If you change to another port, you should remember the modified port when you connect to the database, or you cannot connect to the MySQL database.
More trouble, do not modify here, with mysq default port: 3306

12 This step sets MySQL's default encoding, which defaults to Latin1, which is also the standard encoding. The second type is UTF8, and the third is manual setup.
The encoding is introduced in version 4.1. If you want to use the original database data, it is best to determine the original database with what encoding, if the encoding set here
and the original database data encoding inconsistent, in use may appear garbled. Latin1 Standard encoding is recommended

Of course, if we need to, we can also modify its code (not recommended).

13 This step is whether to set up MySQL as a Windows service, the general choice to set up services,
You can then start and close the MySQL database from the service. Recommended: The following check boxes are also checked,
This way, in the cmd mode, you do not have to execute the command under the bin directory of MySQL. Consulting at the command line can execute files

14 This step is to set the MySQL super user password, this super user is very important,
For MySQL with full permissions, please set up and remember the password of the super user,
A check box below indicates that an anonymous account is created, which makes the database system unsafe.
If you have this requirement, please check it.

15 Click Execute to install

16 Click Finish to complete the installation

17 We can start using MySQL, open the Start menu All Programs MySQL Command line Client, enter the password
This interface shows that MySQL is already installed.

Problems that may occur:

If the prompt appears in step 15th

It's because you've had MySQL before. Some configuration files are also retained during uninstallation.

Click Retry to see if it can be passed. Otherwise click Cancel to exit. Then click on the Start menu of MySQL Server Instance Config Wizard
Reconfigure MySQL

Repeat the previous action. The 14th step will appear the interface is like this

There are three places where you can enter a password, and you have already installed MySQL.
You enter the original root password in the first text box, the next two text boxes enter the root of the new password can be

If not, then reload MySQL once.
Reloading precautions: It is best to delete all the original files, if necessary, you can clear the registry,
If you don't have any other MySQL-related programs on your machine. And you must remember not to keep the original My.ini file.
Also, delete the file under the original installation path and delete the Ibdata1 file below the data directory.

More articles PHP enthusiasts station

installation of PHP

Because PHP is a zip file (not installed version), the installation is relatively simple
Unzip the line. Rename the extracted Php-5.2.1-win32 to PHP5. and copy it to the C drive directory. That is, the installation path is C:\PHP5

1 Locate the php.ini.recommended (or php.ini-dist) file in the PHP directory and rename it to PHP.ini
and copy to the Windows directory of the system disk (take C:\Windows as an example).

2 Copy the Php5ts.dll,libmysql.dll under the PHP directory to the directory C:\Windows\System32.

3 Copy the Php_gd2.dll,php_mysql.dll,php_mbstring.dll file under the Php5\ext directory to C:\Windows\System32
Note: Do not confuse Php_mysql.dll and Php_mssql.dll
If the Php_gd2.dll is not loaded, PHP will not be able to process the image. No load Php_mysql.dll PHP will not support MySQL function library
Php_mbstring.dll supports wide characters when using phpMyAdmin in the back
More articles PHP enthusiasts station

installation of Zendoptimizer

Zend Optimizer uses optimized code to improve the execution speed of PHP applications. Executing PHP programs that use Zend Optimizer is 40% to 100% faster than unused. And some Zend SafeGuard encrypted files, must be installed Zend Optimizer to run.
Note: The installation of Zend Optimizer does not affect the normal operation of PHP, if you feel trouble, this step can be omitted.

1 Click to install Zend Optimizer

2 Accept the agreement, click Next

3 Select the installation path

4 Select Apache This version, we use apache2.2.4, so here choose apache2.x

5 Select the location of the php.ini. We're under C:\WINDOWS\.

6 Select the Apache installation path. Our is C:\Program Files\apache software foundation\apache2.2. So change it over.

7 Click Install for installation

8 Click Yes. Setup automatically completes configuration and server restarts.

9 Click Finish to complete the installation

We'll configure everything after the installation is complete.

configuring PHP and associating MySQL

Open C:\windows\php.ini File

The following needs to be answered to see

1 Setting the extension path
Find Extension_dir have this line
Extension_dir = "./"
Change this line to
Extension_dir = "C:\php5\ext"
Where C:\PHP5 is the path to your installation of PHP. Incorrect path will not load DLL
(Note: some PHP versions are; extension_dir = "./" To remove the preceding semicolon)

2 Find separately
; Extension=php_mbstring.dll
; Extension=php_gd2.dll
; Extension=php_mysql.dll
Remove the semicolon from the preceding 3 items so that the Apache can load the DLLs when it is started.
Be careful not to confuse, Extension=php_mysql.dl and EXTENSION=PHP_MSSQL.DL.
Of course, we also copied these DLLs to System32. (Everyone in the installation process noticed how to load some DLLs into the.)
Later to load some DLLs, such as Php_mysqli.dll, also know how to load the

3 Setting the session save path
Find Session.save_path have this line
; Session.save_path = "N;/path"
Add a line after this line (note that it is added to a row, not added to the back)
Session.save_path = "C:\WINDOWS\Temp"
Saved to your temp directory, it can be saved to the Windows Temp directory Temp

4 There are more notable is the Short_open_tag. Some PHP versions are off by default.
This means that PHP cannot use short tags such as Must use
Because the short mark is easy to use, and many programs are written with just a few marks, such as discuz, etc.
If you do not change the Short_open_tag to on will appear the symptoms will be difficult to judge is the above reasons, it is recommended to modify
Short_open_tag = Off
Short_open_tag = On

5 Display Error Display_errors
For security reasons, some versions of Display_errors are also Off by default.
That is, when debugging, if the PHP code is wrong, only a blank page appears. Instead of displaying the cause of the error and the number of rows that were faulted.
This will be very inconvenient to debug, it is recommended to modify according to your needs
Display_errors = off (note not;-display_errors = off [Security])
Change into
Display_errors = On

6 Display Notice Warning notice
The fifth step opens the error prompt, but the error report is also controlled by error_reporting.
PHP5 default off notice warning prompt, if it is debugging locally, it is recommended to open the notice warning prompt.
error_reporting = E_all & ~e_notice
Change into
error_reporting = E_all

Another hint, in the program can also be controlled by error_reporting () Error report output, how to use everyone to refer to the manual.

7 register_globals
It is also off by default for security reasons
When Register_globals=off, the next program should receive the $_post[' user_name ' and $_post[' User_pass ']
When Register_globals=on, the next program can accept values directly using $user_name and $user_pass.
For more detailed instructions, please refer to
Suggestions should be modified according to their own needs. Here is not recommended to modify, after all, there are security risks.

8 php5 Time difference problem
Time difference Eight hours
Why is it? The PHP5 series has a new time zone setting, which defaults to GMT, which is 8 hours from the East 8 district in China.
Find Date.timezone have this line
;d Ate.timezone =
To remove, change, or convert to
Date.timezone = PRC
of which Prc:people's Republic of China,
For a more detailed solution, please refer to this forum

Please refer to this forum for the configuration of file upload
More articles PHP enthusiasts station

Apache Integrated PHP

1 Open the Apache configuration document from the Start menu,

2 Modifying the Web site root directory
Find DocumentRoot have this line
DocumentRoot "C:/Program Files/apache software Foundation/apache2.2/htdocs"
This is the root of your site, you can modify, you can also use the default. If you change it, change the following, or you may get a 403 error
Find this should is changed to whatever you set DocumentRoot to
There are two lines below it

Change the above two C:/Program Files/apache Group/apache2/htdocs to the directory you want.

3 Find DirectoryIndex index.html
Modified into
DirectoryIndex index.html Index.html.var index.php
This allows the index.php to act as a default page.

4 PHP Modular installation in Apache
Find # LoadModule Foo_module modules/
Add a row after this line
LoadModule Php5_module C:/php5/php5apache2_2.dll

(where C:/php5/php5apache2_2.dll is the appropriate path for you to install PHP.)
Be careful not to confuse Php5apache2_2.dll,php5apache2.dll with Php5apache.dll. Php5apache.dll is only available for Apache version 1.
The Php5apache2.dll in the PHP5 compression package is only available for apache2.0.* versions, and Php5apache2_2.dll is required if the version is 2.2.* or above. Otherwise, it could happen.
"Cannot load C:/php/php5apache2.dll into server:the specified module could isn't be found."
"The requested operation has failed"
. The solution to this problem can be referred to in this forum
Http:// ... &extra=page%3d1
But after the php5apache2_2.dll out there is not much reference value)

5 Find AddType application/x-gzip. gz. tgz
Add a row after this line
AddType application/x-httpd-php. php
So Apache can explain PHP files.
The configuration is basically done here.

####### #重启apache., click restart#########

Create a phpinfo.php file in the root directory of the Web site

Phpinfo ();

Open in Browser
If the following message appears, PHP is already configured

Then test the correlation between PHP and MySQL database
Create a test.php file in the root directory of the Web site

[Copy to Clipboard] CODE: PHP
//php Enthusiasts Station series [Url][/url]
$host= "localhost";
$user= "Root";
$password= "12345";//12345 changed to your MySQL password
if (!$link) echo"


else Echo"



Open http://localhost/test.php in Browser
If the output is successful, you are done.

More articles PHP enthusiasts station

Installing PhpMyAdmin

Download get, unzip it to your website root directory and rename it to PhpMyAdmin,
Locate and open libraries/config.default.php (some versions are or config.defaut.php of the current directory)
Make the following changes:

1 Find password like next two lines
$cfg [' Servers '] [$i] [' user '] = ' root ';
$cfg [' Servers '] [$i] [' password '] = ';

Fill in your MySQL password to $cfg[' Servers ' [$i] [' password '] = '; Single quotes Inside

2 Search $cfg [' Pmaabsoluteuri '], set the value of the single quotation mark behind it to the PhpMyAdmin directory path, such as: http://localhost/phpMyAdmin/;

3 Search $cfg [' Defaultlang '], set the value of the single quotation mark behind it to zh-gb2312;

The following is a code modification based on your needs (if you are not familiar with database coding, do not modify it)
4 Search $cfg [' Defaultcharset '] and set it to the encoding you want.

Open the browser, enter: Http://localhost/phpMyAdmin/,Apache and MySQL are all started,
If the following page appears, the phpMyAdmin installation is complete and you can use the

PhpMyAdmin the specific function, please slowly familiar, here no longer repeat. true techarticle so deliberately write this configuration document, I believe that follow the following steps you will be successful. I hope you can correct me in the wrong place. This example is under Wiondws XP php5.2.1 (Zip) apache2.2.4 MySQL5 ....

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.