PHP MySQL Configuration

Source: Internet
Author: User
Tags mysql host mysql manual php mysql sapi administrator password
Reference: http://www.phpwind.net/read-htm-tid-79533.html

PHP with a more mature and stable php4.3.9 download address: http://bbs.uushop.net/read.php?fid=3&tid=158361
mysql4.0.24 Download Address: Http://www.uushop.net/book/mysql4.rar
Zend Download address See this post attachment
phpMyAdmin Download Address http://down.chinaz.com/s/5637.asp
PHP acceleration software eaccelerator Download Address See this post attachment

OK, the tools are ready, let's start our configuration environment below.




One: Let IIS6.0 support the installation configuration of PHP-=> php4.3.9

We do not recommend the use of the installation version here php4.3.9 's decompression version

The first step is to untie the Php-4.3.9-win32.zip compression pack you can put it under C:\PHP.

The second step is to copy the C:\PHP below the php.ini-dist file into the C:\WINDOWS directory and rename it to php.ini depending on the situation you can modify some parameters by yourself first we need to tell PHP where to find its extension function module file under modify C + + The Windows\php.ini file needs to be noted as follows

Find Extension_dir string modified to extensions path in your PHP directory:

; Directory in which the loadable Extensions (modules) reside
Extension_dir = "C:\php\extensions"
This example can be set to "extension_dir=" C:\php\extensions "" as the directory where the PHP file is located.

The third step is to copy the C:\php\php4ts.dll to the C:\windows (WINNT) \system32 directory

Fourth Step Control Panel version?? "Management tool?" "Internet Service Manager??" "Click on Web service extensions??" In the right window, click "Add a new Web service extension"?? The extension is "PHP"?? and click "Add"?? "In the window that appears, fill in the" C:\PHP\sapi\php4isapi.dll "and then click on the Web service extension PHP and select Allow








Fifth step in the "Default Web Site Properties" window, press the "Home directory" tab point "Configure" button in the pop-up window to click the "Add" button, in the pop-up "Add/Edit Application Extension Image" dialog box in the Executable text box, enter "C:\PHP\sapi\ Php4isapi.dll ". php" in the "Extension" text box (be sure to have that point) and tick the "check if file exists" entry to determine




The sixth step is to click on the "ISAPI filter" tab on the "Default Web Site Properties" window, tap the "Add" button, and in the "Filter Name" of the pop-up Filter Properties window, enter "PHP" in "executable" to browse the selected "C:\PHP\sapi\php4isapi.dll" And then determine


A: Stop IIS 6.0 from running and then restart IIS 6.0 to start loading the PHP view


B: On the Default Web Site Properties window, click the ISAPI Filter tab if you see PHP's Arrow Green and up to prove that PHP has been successfully loaded by IIS 6.0, see figure


Seventh step in the Default Web Site Properties window on the Home Directory tab modify if PHP is configured in IIS6.0 as the CGI runtime mode, which is all loaded PHP.exe Execute permissions to "scripts and executables" and run in ISAPI mode, load all PHP4isapi.dll to remain The default "script only" can further enhance the security of the system application pool for "DefaultAppPool" OK

In this step, the configuration of the PHP environment is complete.

After the configuration is complete, if you want to test whether PHP is installed successfully, you can create a file in the space Reagan directory, such as test.php, and then write the following statement

Phpinfo ();
?>

Use IE to access this file after saving


/HTTP Address/test.php



If you can see this familiar page to configure the PHP environment is really successful


Of course you can also configure PHP to run in CGI mode


The specific method is to change the original set path "C:\PHP\sapi\php4isapi.dll" to "C:\php\php.exe"%s "%s" and then "check for the existence of files" cancel and then determine the basic settings are complete

Final Test ...

Phpinfo ();
?>

If CGI error occurs

The specified CGI application misbehaved by isn't returning a complete set of HTTP headers ...

This is to represent that PHP is a CGI mode test run in php.ini find Gi.force_redirect put the front semicolon minus the value to 0 on the line

It's running again. This is another way to configure PHP run mode





Next to configure Eaccelerator

Make the Forum faster PHP acceleration set PHP Acceleration: eaccelerator (with Turck MMCache will appear some inexplicable error, so we still use Eaccelerator bar)

Download the Eaccelerator_win_4[1].3.9.rar in the attachment below
Unzip him and put him in the C:\php\extensions\.
Then open C:\windows\php.ini.
Search; Extension=php_zip.dll
Add the following
[Eaccelerator]
Zend_extension_ts= "C:\php\extensions\eaccelerator.dll"
Eaccelerator.shm_size= "64"
Eaccelerator.cache_dir= "F:\tem\"

Note that the above F:\tem\ is used to slow down the place of storage ~ do not recommend that you put the TEM in the system disk, this can be defined by you.


Next to configure Zend, download the address to see the attachment

Zend Optimizer uses optimized code to improve the execution speed of PHP 4.0 applications. The principle of implementation is to optimize the code that is generated by running the compiler (Run-time Compiler) before it is finally executed. In general, PHP programs that use Zend Optimizer are 40% to 100% faster than unused. This means that visitors to the site can browse the Web more quickly, completing more transactions and creating better customer satisfaction. A faster response also means that you can save on hardware investment and enhance the services offered by the site. Therefore, the use of Zend Optimizer, is tantamount to improve the profitability of e-commerce. Zend Optimizer can bring a lot of benefits to PHP users, especially those who run the site. Running a PHP program quickly can significantly reduce the CPU load on the server and can reduce the response time by half, that is, the time between when a visitor clicks the link to the server to start reading the page.




Installing Zend Optimizer optimizing PHP programs

Zend Optimizer is a free PHP optimization software opened by the PHP core engine "Zend" http://www.zend.com creator Zend technology company. According to Zend Company disclosed that using this software in some cases can at least improve performance by more than 30%! Now let's take a look at how to configure this set of software.



The installation of Zend optimizer is simple

1, run the installation files, first prompts you to select the installation directory, select a directory you like, click "Next".
2. The installation Wizard will ask you to select the currently used Web server (Apache, IIS, or other), select a good server and click "Next"
3. The installation Wizard prompts you to confirm the location of the php.ini (by default, C:\WINDOWS\) click "Next" and Prompt "backup php.ini to C:\WINDOWS\php.ini-Optimizer-bak, When uninstalling the software, you can revert to the original php.ini) and click "Next".
4. The installation Wizard prompts "to restart the IIS service in order to continue Setup", click Yes, Setup starts restarting the IIS service, and the installer prompts "The IIS service has successfully restarted" Click OK, and then click Finish to complete the installation.
5, after the installation process will automatically according to your choice to modify PHP.ini help you start the engine. Let's introduce the configuration options for Zend Optimizer to help you maximize your custom and reasonable configuration.

[Zend]
Zend_optimizer.optimization_level=15
zend_extension_ts= "C:\Program Files\zend\lib\zendextensionmanager.dll"
zend_extension_manager.optimizer_ts= "C:\Program files\zend\lib\optimizer-2.5.5"

※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※

[Zend]
zend_optimizer.optimization_level=1023
Zend_optimizer.encoder_loader=0
zend_extension_ts= "C:\Program Files\zend\lib\zendoptimizer.dll"

(The content that is seen in the online material may be different depending on the version.)

※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※

Now let's cover the implications of the above in these configuration files:
Zend_optimizer.optimization_level "= = Optimization degree, here defines how many optimization processes to start.
Zend_optimizer.encoder_loader "= = whether to allow processing of PHP files encrypted by Zend Encoder.
Zend_extension_ts the directory where the = = Optimizer resides.
Zend_extension_manager.optimizer_ts the = = Optimizer manages the directory.

Zend_optimizer.optimization_level detailed explanation of the optimization process

Here is the most important part, look carefully! Zend opt has a total of 10 optimization processes, the more theoretically the more performance the better. Of course, there is always a gap between theory and practice. The more the optimization process opens, the more the performance is consumed, and the 10 optimization processes of Zend opt are not the same, which means that the effect is not average. The highest value defined by the Zend Company (high mode) is 15, and here 15 refers to the 1-4 optimization process. Of course, many friends are not satisfied with this, after all, the highest only open 4 optimization process even half of the total is not. The corresponding numeric codes (values) for each optimization process are as follows:

Do not use 0 <= if this is not installed, but also save a bit of memory to say!
Optimization Process 1 (PASS1) 1
Optimization Process 2 (PASS2) 2
Optimization Process 3 (PASS3) 4
Optimization Process 4 (PASS4) 8
Optimization Process 5 (PASS5) 16
Optimization Process 6 (PASS6) 32
Optimization Process 7 (PASS7) 64
Optimization Process 8 (PASS8) 128
Optimization Process 9 (PASS9) 256
Optimization process (PASS10) 512

The way in which the optimization process is turned on is controlled by the addition of these numeric codes (values) and by the parameter values of the parameters. As in my config file Zend_optimizer.optimization_level = 1023, here's 1023 is the optimization process 1 to the optimization process 10 all the numerical code (value) is added to the sum, indicating the opening of all 10 optimization process. The Zend Company-defined high mode value mentioned earlier is 15,15, which also opens the optimization process 1-4.

Cryptographic code support Zend_optimizer.encoder_loader detailed explanation

For this parameter, I think most of the friends who have not seen the Zend Opt FAQ document do not know. This parameter is used to tell Zend opt to support code that has been Zend Encoder encrypted. By default, Zend Opt will support encrypted code. I recommend that you turn off this option if you do not use code that has been encrypted. This function involves the process of unpacking the anti-code, which can lead to the aggravation of the system load. My friend has developed the corresponding anti-compilation tool, which is expected to be launched after the Spring Festival.

The value of this parameter is only two 0 off, 1 is turned on. The default is 1 and the recommended setting is 0.

Module positioning zend_extension_ts, Zend_extension_manager.optimizer_ts without explanation, these parameters are Zend Optimizer related modules on the hard disk installation path.

6, how to know Zend Optimizer is running?
The answer is simple, just use PHP's function phpinfo () to detect the knowledge, as follows:

Phpinfo ();
?>

The part of the displayed results about Zend Optimizer is like this:

Makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.3, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.3, Copyright (c) 1998-2004, by Zend Technologies

Indicates that Zend Optimizer for PHP has been optimized successfully.


Next to install MySQL
Unzip the MYSQL4.024 compressed file package Mysql-4.0.24-win.zip and then run the Setup program all the time by pressing the next step on OK to install to the C drive and save some setup trouble. Then find the MySQL folder under C disk run Bin\winmysqladmin.exe start MySQL first time will pop up a need to enter the account number and password interface name and password as you happy to fill in (this is the local security code will be stored in the operating system My.ini file is only allowed in the The machine logs on to MySQL to improve security) OK it's over. mysql installation is complete.

PS: For the forum installation?? Key to the MySQL database connection success or failure so note that the MySQL Super Administrator password is empty account name root is not fill in the first time after the installation of MySQL set up the account and password (this is similar to OICQ Local security code) otherwise the connection failed.



"Set up MYSQL to run automatically with the system"


Start-to-run and enter the following commands individually and determine

net start MySQL

Services.msc

net stop IISAdmin

net start w3svc

C:\mysql\bin\mysqld-nt--install

If the following prompt is present, it is typical that the database does not start failure can be performed at Mysql\bin Winmysqladmin.exe startup MySQL runs normally.


Connect (0) to MySQL (Localhost,root) failed

The URL is:
Http://www.motianlong.com/bbs/index.php?

MySQL Server Error:
Can ' t connect to MySQL server on ' localhost ' (10061) (2003)

You Can Get Help in:
Http://www.phpwind.net




Attached: Advanced Configuration MySQL Database
For the security of the data some default values you have to make changes such as passwords
(a) Connect MySQL:
Format: mysql-h host address-u user name-P user Password
1. Example 1: Connect to MySQL on this machine
First open the DOS window, and then enter the directory C:\mysql\bin, and then type the command mysql-uroot-p, enter after the prompt you to lose the password, if just installed MySQL, superuser root is no password, so directly enter into MySQL, The prompt for MySQL is:mysql>
2. Example 2: Connect to MySQL on a remote host
Assume the remote host IP is: 110.110.110.110, the user name is root, the password is abcd123. Type the following command:
Mysql-h110.110.110.110-uroot-pabcd123
(Note: You and root can be used without spaces, others are the same)
3. Quit MySQL Command
Exit (Enter)
(b) Change the password:
Format: Mysqladmin-u username-P Old password password new password
1, Example 1: Add a password to root ab12. First enter directory C:\mysql\bin under DOS, and then type the following command:
Mysqladmin-uroot-password AB12
Note: Because Root does not have a password at the beginning, the-p old password can be omitted.
2, Example 2: Then change the root password to djg345
MYSQLADMIN-UROOT-PAB12 Password djg345
(c) Add new users: (Note: Unlike the above, because it is a command in the MySQL environment, it is followed by a semicolon as a command terminator)
Format: Grant Select on database. * To User name @ login host identified by "password"
Example 1, add a user test1 password for ABC, so that he can log on any host, and all databases have query, insert, modify, delete permissions. First, use the root user to connect to MySQL, and then type the following command:
Grant Select,insert,update,delete on *. * to test1@ "%" identified by "ABC";
But example 1 increases the user is very dangerous, you want to like someone to know test1 password, then he can be on any computer on the Internet to log on your MySQL database and to your data can do whatever, workaround see Example 2.
Example 2, add a user test2 password for ABC, so that he can only login on localhost, and the database mydb can query, insert, modify, delete operations (localhost refers to the local host, that is, the MySQL database host), This allows the user to use a password that knows test2, and he cannot access the database directly from the Internet, but only through a Web page on the MySQL host.
Grant Select,insert,update,delete on mydb.* to Test2@localhost identified by "ABC";
If you do not want to test2 have a password, you can call another command to erase the password.
Grant Select,insert,update,delete on mydb.* to Test2@localhost identified by "";
(iv) Display of commands
1. Display the database list:
show databases;
Just started with two databases: MySQL and test. MySQL Library is very important it has the MySQL system information, we change the password and the new user, is actually using this library to operate.
2. Display the data table in the library:
use MySQL;//Open the library, learn foxbase must not be unfamiliar with it
Show tables;
3, display the structure of the data table:
describe table name;
4, build the library:
Create database name;
5, build the table:
Use library name;
CREATE TABLE table name (field settings list);
6. Deleting the library and deleting the table:
drop database name;
drop table name;
7. Empty the records in the table:
Delete from table name;
8. Display the records in the table:
SELECT * from table name;



=================================
=================================
MySQL installation needs to be optimized configuration, open the C:\windows\my.ini file
Carefully compare the My.ini I have optimized below to see where nothing is added.

Copy Code

#This File is made using the Winmysqladmin 1.4 Tool #2005 -12-4 15:37:01 #Uncomment or ADD only the keys so you know Ho W works. #Read the MySQL Manual for instructions [mysqld] basedir=c:/mysql #bind-address=192.168.1.1 Datadir=c:/mysql/data # Language=c:/mysql/share/your language directory #slow query log#= #tmpdir #= #port =3306 set-variable = max_connections= 2500 skip-locking #skip-networking set-variable = key_buffer=384m set-variable = max_allowed_packet=1m set-variable = tab le_cache=512 set-variable = sort_buffer=2m set-variable = record_buffer=2m set-variable = thread_cache=8 # Try number of C PU ' s*2 for thread_concurrency set-variable = thread_concurrency=8 set-variable = myisam_sort_buffer_size=64m # set-variable = connect_timeout=5 #set-variable = wait_timeout=5 Server-id = 1 [isamchk] set-variable = Key_buffer=128M Set -variable = sort_buffer=128m Set-variable = read_buffer=2m set-variable = write_buffer=2m [Myisamchk] set-variable = Key_b uffer=128m set-variable = sort_buffer=128M set-variable = read_buffer=2m set-variable = write_buffer=2m #set-variable=key_buffer=16m [WinMySQLadmin] Server=C :/mysql/bin/mysqld-nt.exe user=root password=********



================ Good, the code is also optimized, Zend also installed, basically the server configuration is OK ~

Enter in Start-run
net stop IISAdmin
After you run and then enter
net start w3svc
And then restart the server is OK ~ ~


Note: This tutorial mainly refers to the original throwing knives, but after my test, found that he introduced the acceleration software often error, so I changed the accelerator software, wrote this post.
In addition I installed the complete php.ini file in the attachment there, we can take to compare

As for the configuration of the phpMyAdmin I will not say, there are many tutorials ~:)

PS: If you need to optimize the application pool for system stability/multi-site (virtual host Class), you can contact my qq:14093481, stating: Windows Optimization Service

[This post was edited by Showxiu on 2007-03-22 21:51]

Attachment: WIN2003 upgrade patch. RAR (1 K) Download number of times: 3311

Attachment: Eaccelerator_win_4[1].3.9.rar (K) Download number of times: 4732

Accessories: Php.ini.txt (K) Download number of times: 4312

Accessories: Zend Optimizer V2.5.5 for Windows.part1.rar (447 K) Download number of times: 5256

Accessories: Zend Optimizer V2.5.5 for Windows.part2.rar (447 K) Download number of times: 4475

Accessories: Zend Optimizer V2.5.5 for Windows.part3.rar (447 K) Download number of times: 3746

Accessories: Zend Optimizer V2.5.5 for Windows.part4.rar (447 K) Download number of times: 3692

Accessories: Zend Optimizer V2.5.5 for Windows.part5.rar (447 K) Download number of times: 3765

Accessories: Zend Optimizer V2.5.5 for Windows.part6.rar (447 K) Download number of times: 3724

Accessories: Zend Optimizer V2.5.5 for Windows.part7.rar (K) Download count: 3651

  • 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.