In Windows: Configure PhP5 mysql5 apache2 phpMyAdmin zendoptimizer in PHP

Source: Internet
Author: User
Tags echo date php and mysql blank page mysql command line
The configuration of the PHP environment is definitely a headache for new users. There will always be such problems and many detours.
Therefore, I wrote this configuration document specially and believe that you will succeed by following the steps below. I hope you will correct the error.
More articles PHP enthusiast station http://www.phpfans.net

In this example, under wiondws XP
Php5.2.1 (ZIP)
Apache2.2.4
Mysql5.0.37
Phpmyadmin2.10.0.2
ZendOptimizer-3.2.6
Installation and configuration
You can also download the above resources at http://www.phpfans.net/download.php.

Apache installation

1. Click the apahce installation package.

2 accept agreement

3. Enter the following three items as needed.
Apache listens to port 80. If IIS uses port 80, modify the IIS port or Apache port to avoid conflict.

4. The default value is typical. click Next.

5. You can modify the installation path here. Note that the installation path cannot contain Chinese characters.

6. Click Install to start installation.

7. After the installation is complete, enter http: // localhost or http: // 127.0.0.1 in the browser.
If you can see this page, it proves that Apache is successfully installed, you can already explain the static page.

MySQL Installation

1. Click MySQL installation package

2. The default value is typical. If you want to modify the installation path, you can also select Custom.
Note: The Path for installing MySQL cannot contain Chinese characters!

3. Click intall to start installation.

4. Skip Registration

5. Do you want to configure MySQL now? You can also configure MySql in the Configuration Wizard in the Start Menu.
Configuration now

6. Select detailed configuration (detailed settings) and click Next to continue.

7. The following option selects the MySQL application type. The first option is the development server,
We will only use as little memory as possible, and the second is a normal Web server, which will use a moderate amount of memory,
The last one is that only MySQL databases are running on this server, which will occupy all the memory.
You can select an option based on your needs. Only the development server is selected here, and click Next to continue.

8. The following describes how to use the database. The first option is multi-function usage,
Optimize the database to a good InnoDB (transaction) storage type and an efficient MyISAM (non-transaction) storage type,
The second type is only used for transaction processing. InnoDB is the best optimized, but MyISAM is also supported. Only MyISAM supports full-text indexing.
The last is simple network development, which is suitable for simple applications. Only the MyISAM type that does not support transactions is supported.
Generally, select the first multi-function.

9 The following figure shows the data storage location of innoddb, which is usually good by default and does not need to be changed.
(If You Want To modify the data storage path, you can also modify the datadir value of my. ini after installation)

10. Select the maximum number of connections allowed by MySQL. The first is the maximum number of concurrent connections,
The second option is a maximum of 500 concurrent connections, and the last option is custom. You can choose one based on your needs.
Select the first one.

11 The following figure shows whether to run the network link. Select the check box here. The database listening port. The default value is 3306,
If it is changed to another port, remember the modified port when connecting to the database. Otherwise, you cannot connect to the MySQL database,
It is troublesome. Do not modify it here. Use the default port of mysq: 3306.

12 In this step, set the default MySQL encoding. The default encoding is Latin1, which is also the standard encoding. The second encoding is utf8, and the third encoding is manual.
Encoding is introduced in Versions later than 4.1. If you want to use the data of the original database, you 'd better determine the encoding used by the original database. If the encoding is set here
The encoding is inconsistent with that of the original database data. garbled characters may occur during use. We recommend that you use Latin1 standard encoding.

Of course, we can modify its encoding if necessary (not recommended ).

13. Whether to set MySQL to a Windows service in this step is generally set to a service,
In this way, you can enable and disable the MySQL database through the service. We recommend that you select the check box below,
In cmd mode, you do not have to execute commands in the bin directory of MySQL. You can run the command in command line mode to obtain the executable files.

14 this step sets the MySQL Super User Password, which is very important to the Super User,
You have all permissions for MySQL. Please set and remember the superuser password,
The check box below indicates creating an anonymous account, which will make the database system insecure.
If you have this requirement, check it.

15. Click execute to install

16. Click Finish to complete installation.

17. You can start using MySQL. Open the MySQL command line client of all programs in the Start menu and enter the password.
This interface indicates that MySQL has been installed.

Possible problems:

If you are prompted in step 1

Because you have installed MySQL before. Some configuration files are retained during uninstallation.

Click Retry to see if it works. Otherwise, click Cancel to exit. Then click MySQL server instance config wizard in the Start Menu.
Reconfigure MySQL

Repeat the previous operation. Step 1 will show the interface as shown below

There are three places to enter the password. You have installed MySQL.
Enter the original root password in the first text box, and enter the new root password in the next two text boxes.

If the problem persists, reinstall MySQL.
Note: It is best to delete all the original files. If necessary, clear the registry,
If there are no other mysql-related programs on your machine, do not keep the original my. ini file.
Delete the files in the original installation path and the ibdata1 files in the data directory.

More articles PHP enthusiast station http://www.phpfans.net

PHP installation

PHP is a zip file (non-Install Version), which is relatively simple to install.
Unzip it. Rename the extracted php-5.2.1-Win32 to php5. and copy it to the C directory. That is, the installation path is C:/PhP5.

1. Find the php. ini. Recommended (or PHP. ini-Dist) file in the PHP Directory and rename it to PhP. ini.
And copy it to the Windows directory of the system disk (take C:/Windows as an example ).

2. Copy php5ts. dll and libmysql. dll under the PHP Directory to the C:/Windows/system32 directory.

3. Copy the php_gd2.dll, php_mysql.dll, and php_mbstring.dll files in the PhP5/EXT directory to the C:/Windows/system32 directory.
Note: Do not confuse php_mysql.dll with php_mssql.dll.
PHP cannot process images if php_gd2.dll is not loaded. If php_mysql.dll is not loaded, PHP does not support MySQL function libraries.
Php_mbstring.dll supports wide characters when phpMyAdmin is followed.
More articles PHP enthusiast station http://www.phpfans.net

Install zendoptimizer (not available)

Zend optimizer improves the execution speed of PHP applications by optimizing code. The execution of the PHP program using Zend optimizer is 40% to 100% faster than that without Zend optimizer. In addition, Zend optimizer must be installed to run some files encrypted with Zend safeguard.
Note: The installation of Zend optimizer does not affect the normal operation of PHP. If you are in trouble, skip this step.

1. Click to install Zend optimizer.

2. Accept the protocol and click Next.

3. Select the installation path

4. Select the apache version. We use apache2.2.4. Therefore, select apache2.x.

5. Select the location of PHP. ini.

6. Select the Apache installation path. C:/program files/Apache Software Foundation/apache2.2.

7. Click Install to install

8. Click Yes. The installer automatically completes configuration and server restart.

9. Click Finish to complete the installation.

After everything is installed, We can configure it again.

Configure PHP and associate MySQL

Open the C:/Windows/PHP. ini file

You can see the following content only after replying to the post:
====================================

1. Set the extension path
Find the row in extension_dir
Extension_dir = "./"
Change this row
Extension_dir = "C:/PhP5/EXT"
C:/PhP5 is the path for installing PHP. dll cannot be loaded if the path is incorrect.
(Note: Some PHP versions are; extension_dir = "./" Remove the semicolon from the previous version)

2 search separately
; Extension = php_mbstring.dll
; Extension = php_gd2.dll
; Extension = php_mysql.dll
Remove the semicolon before the preceding three items so that these DLL files can be loaded at Apache startup.
Do not confuse extension = php_mysql.dl with extension = php_mssql.dl.
Of course, we copied these DLL files to system32. (We noticed how to load some DLL files during the installation process.
Some DLL files, such as php_mysqli.dll, will be loaded later)

3. Set the session storage path.
Find the row in session. save_path.
; Session. save_path = "N;/path"
Add a row after this line (note that adding a row is not followed)
Session. save_path = "C:/Windows/Temp"
Save it to your temporary directory, which can be saved to the Windows temporary directory temp.

4. Note the short_open_tag. Some PHP versions are off by default.
That is to say, PHP cannot use short tags, as shown in <? ?> Required <? PHP?>
Short tags are easy to use, and many programs use short tags for writing, such as discuz.
If you do not change short_open_tag to on, it will be difficult to determine the cause. We recommend that you modify it here.
Search
Short_open_tag = off
Change
Short_open_tag = on

5. Whether the error display_errors is displayed
For security reasons, some display_errors versions are also off by default.
That is to say, during debugging, if the PHP code is incorrect, only one blank page is displayed, and the error cause and number of lines are not displayed.
Therefore, debugging is inconvenient. You are advised to modify it as needed.
Search
Display_errors = off (note not;-display_errors = off [security])
Change
Display_errors = on

6 register_globals
It is also off by default for security reasons.
When register_globals = OFF, $ _ post ['user _ name'] and $ _ post ['user _ pass'] should be used for receiving the next program.
When register_globals = on, the next program can directly use $ user_name and $ user_pass to accept the value.
For more details, see
Http://www.phpfans.net/bbs/archiver? Tid-234.htm
We recommend that you modify the settings as needed. We do not recommend that you modify the settings here. After all, there are security risks.

7. PhP5 Time Difference
<? PHP echo date ("Y-m-d h: I: s");?> Time Difference: eight hours
Why? The Time Zone settings are added for the PhP5 series. The default value is Greenwich Mean Time, which is 8 hours different from the East 8 zone in China.
Find the row in date. timezone
; Date. timezone =
Replace;
Date. timezone = PRC
PRC: People's Republic of China,
For more detailed solutions, refer to
Http://www.phpfans.net/bbs/archiver? Tid-60.html

For more information about File Upload configurations, see
Http://www.phpfans.net/bbs/viewthread.php? Tid = 1663 & extra = Page % 3d1
More articles PHP enthusiast station http://www.phpfans.net

Integrate Apache with PHP

1. Open the Apache configuration document from the Start Menu,
CTRL + mouse wheel to zoom in/out "src =" http://www.phpfans.net/article/images_php/peizhi2/sshot-28.gif "width =" 716 "onLoad =" If (this. width> screen. width * 0.7) {This. resized = true; this. width = screen. width * 0.7; this. alt = 'click here to open new window/nctrl + mouse wheel to zoom in/out';} "border =" 0 "resized =" true ">

2. Modify the website root directory
Find that DocumentRoot has such a line
DocumentRoot "C:/program files/Apache Software Foundation/apache2.2/htdocs"
This is the root directory of your website. You can modify it or use the default one. If you change it, you must modify the following one. Otherwise, the 403 error may occur.
Find this shoshould be changed to whatever you set DocumentRoot
There are two rows below it:
<Directory "C:/program files/Apache Software Foundation/apache2.2/htdocs">
Change the C:/program files/Apache Group/apache2/htdocs of the preceding two items to the directory you want.

3. Find directoryindex index.html.
Modify
Directoryindex index.html. var index. php
In this way, index. php can act as the default page.

4. modular installation of PHP in Apache
Find # loadmodule foo_module modules/mod_foo.so
Add a line after this line
Loadmodule php5_module C:/PhP5/php5apache2_2.dll

(C:/PhP5/php5apache2_2.dll is the corresponding path for installing PHP.
Do not confuse php5apache2_2.dll, php5apache2. dll and php5apache. dll. php5apache. dll is only applicable to apache version 1.
Php5apache2. dll in the PhP5 compressed package is only applicable to apache2.0.*. If it is 2. 2. * or a later version, you must use php5apache2_2.dll. Otherwise, it may appear.
"Cannot load C:/PHP/php5apache2. DLL into server: the specified module cocould not be found ."
Or:
"The requested operation has failed"
For details about how to solve this problem, refer to
Http://www.phpfans.net/bbs/viewt... & extra = Page % 3d1
However, php5apache2_2.dll has little reference value)

5. Find addtype application/X-gzip. GZ. tgz.
Add a line after this line
Addtype application/X-httpd-PHP. php
In this way, Apache can explain the PHP file.
Now the configuration is complete.

######## Restart Apache. Click restart #########

Create a phpinfo. php file under the root directory of the website.

<? PHP
Phpinfo ();
?>

Open in a browser
Http: // localhost/phpinfo. php
If the following information appears, it indicates that PHP has been configured.

Next, we will test the association between PHP and MySQL databases.
Create a test. php file under the root directory of the website

[Copy to clipboard]

Code:

<? PHP
// PHP fans station series tutorial [url] http://www.phpfans.net [/url]
$ Host = "localhost ";
$ User = "root ";
$ Password = "12345"; // 12345 change to your MySQL password
$ Link = mysql_connect ($ host, $ user, $ password );
If (! $ Link) echo "Else echo "Mysql_close ();
?>

Open http: // localhost/test. php In the browser
If the output is successful, it means the result is complete.

More articles PHP enthusiast station http://www.phpfans.net

====================================

Install phpMyAdmin (MySQL management tool. Do not install it) 

Download the phpMyAdmin-2.10.0.2-all-languages.zip, decompress it to the root directory of your website, and rename it phpMyAdmin,
Find and open libraries/config. Default. php (some versions are config. Inc. php or config. defaut. php in the current directory)
Make the following changes:

1. There are two rows for searching for the password:
$ Cfg ['servers'] [$ I] ['user'] = 'root ';
$ Cfg ['servers'] [$ I] ['Password'] = '';

Enter your MySQL password in $ cfg ['servers'] [$ I] ['Password'] = ''.

2. Search for $ cfg ['pmaabsoluteuri '] and set the value in the single quotation marks to the phpMyAdmin directory path, for example, http: // localhost/PHPmyAdmin /;

3 search $ cfg ['defaultlang '] and set the value in the single quotation marks to zh-gb2312;

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

Open the browser and enter http: // localhost/PHPmyAdmin/. Apache and MySQL are started,
If the following page appears, phpMyAdmin is installed and can be used.
CTRL + mouse wheel to zoom in/out "src =" http://www.phpfans.net/article/images_php/peizhi2/sshot-40.gif "width =" 716 "onLoad =" If (this. width> screen. width * 0.7) {This. resized = true; this. width = screen. width * 0.7; this. alt = 'click here to open new window/nctrl + mouse wheel to zoom in/out';} "border =" 0 "resized =" true ">

Please familiarize yourself with the specific functions of phpMyAdmin.

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: info-contact@alibabacloud.com 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.