Apache + PHP installation log

Source: Internet
Author: User
Tags mcrypt

Background: If you want to use Drupal to get a forum, the system requirement is Apache + PHP + MySQL (recommended). Because you are playing Linux recently, so...

The host is Windows2003.

 

First of all: install Apache (installed with a apache_2.2.11-win32-x86-openssl-0.9.8i.msi), the installation path "Next ".

YesArticle"During the installation process, do not use spaces in any directory or file name ". However, I installed it in "D: \ Program Files" and it runs properly ......

Because the local IIS has occupied port 80, the port 1080 is configured for Apache (it is strange that the configuration of port 8080 does not work, it may be caused by otherProgramOccupied, not detailed ).

However, input: http: // localhost: 1080/has not been reflected. Check logs \ error. log as follows:

[Error] (OS 10038) tried an operation on a non-socket. : Child 816: encountered too assumerrors accepting client connections. Possible causes: Dynamic Address renewal, or incompatible VPN or firewall software. Try using the win32disableacceptex directive.

In addition, httpd.exe occupies high CPU resources.

Some online practices are as follows: (Windows Apache win32disableacceptex issues)

Add the win32disableacceptex tag to the httpd. conf file as follows:
< Ifmodule Mpm_winnt.c >
Threadsperchild 1000
Maxrequestsperchild 10000
Win32disableacceptex

</Ifmodule>

This allows more concurrent connections. At the same time, the performance will not be significantly reduced.

In general, this configuration can be basically done, But I encountered a situation where I wanted to disable acceptex as above, and a similar problem would occur. Apache still cannot run normally, error. A large number of log entries are generated: The network name specified by SAT Dec 24 17:21:28 2006] [warn] (OS 64) is no longer available. : Winnt_accept: asynchronous acceptex failed .. I found the following solution. I tried it, and I tried it on multiple servers. As long as the acceptex problem occurs, the specific settings are as follows: 1. Network neighbors-> Local Connection-> properties-> Internet Protocol (TCP/IP) -> properties-> advanced-> wins tag-> remove the check box before enabling LmHosts query. 2. Select "Control Panel"> "Windows Firewall"> "Advanced tab"> "local connection settings"> "service", and select "Secure Web Server (https ). 3. log out of Apache and start Apache again. At first, I did not quit. I restarted it directly. That is, I cannot. I must stop it before enabling it.

The above is a case. In my case, the CPU usage is reduced, but an error occurs. Logs \ error. log is as follows:

[Mon Dec 24 16:48:06 2007] [Error] (OS 10038) tried an operation on a non-socket. : Too assumerrors in select loop. Child process exiting.
[Mon Dec 24 16:48:06 2007] [Notice] child 1916: Exit event signaled. Child process is ending.
[Mon Dec 24 16:48:07 2007] [Notice] child 1916: released the start mutex
[Mon Dec 24 16:48:07 2007] [Notice] child 1916: Waiting for 250 worker threads to exit.
[Mon Dec 24 16:48:07 2007] [Notice] child 1916: All worker threads have exited.
[Mon Dec 24 16:48:07 2007] [Notice] child 1916: child process is exiting
[Mon Dec 24 16:48:07 2007] [Notice] parent: child process exited with status 0 -- restarting.
[Mon Dec 24 16:48:07 2007] [Notice] Apache/2.0.55 (win32) configured -- resuming normal operations
[Mon Dec 24 16:48:07 2007] [Notice] server built: Oct 9 2005 19:16:56
[Mon Dec 24 16:48:07 2007] [Notice] parent: created child process 3028
[Mon Dec 24 16:48:07 2007] [Notice] Disabled use of acceptex () Winsock2 API
[Mon Dec 24 16:48:07 2007] [Notice] child 3028: child process is running
[Mon Dec 24 16:48:07 2007] [Notice] child 3028: acquired the start mutex.
[Mon Dec 24 16:48:07 2007] [Notice] child 3028: Starting 250 worker threads.
[Mon Dec 24 16:48:08 2007] [Notice] child 3028: listening on port 80.

Solution: Apache error: [Error] (OS 10038) attempted an operation on a non-socket

CMD

Netnetsh Winsock rereset

Restart the instance, and do not set win32disableacceptex.

In fact, the above errors occur because some software in Windows has changed Winsock.

In addition, when querying information, find this: apache2.2.11 detailed configuration optimization

 

 

Next, install PHP (first get a PHP 5.0.0 and then the latest PHP 5.2.9-2 zip package.

First, many articles say it is best to download the decompressed version. The installer version seems to have restrictions... (never try ).

second, after PHP decompress the package, "Put php5ts. dll in the Windows path. The best location is the Windows System directory" (according to an article ). If not, copy all DLL files in the PHP Directory to C:/Windows/system32/(another article says ,-_-!). Copy php5ts. dll under the Directory D: \ phpserver \ PhP5, and libmysql. DLL to c: \ windows \ system32 ". (Another article said )(@_@). Finally, I followed the article's 4th point: add the PHP Directory to the environment variable path (but it can run even if no environment variable is set during PHP 5.2.9-2 installation, maybe I haven't used the extension mentioned in this Article ). install phpMyAdmin to verify that the corresponding lib *** must be used when extension is used ***. copy the DLL file to C:/Windows/system32/. Setting environment variables does not work. For example, extiension php_mysql.dll needs to set libmysql under the PHP Directory. copy the DLL file to C:/Windows/system32/. Otherwise, the system prompts that MySQL extension cannot be loaded. . Libmcrypt. the dll must also be copied to system32/. Otherwise, phpMyAdmin will prompt access denied for user' (garbled) '@ 'localhos t' (using password: Yes) None login method, phpMyAdmin should use extiension php_mcrypt for encryption and decryption .

Third, configure PHP and set "php. copy the ini-recommended file to "C:/Windows" and rename it "php. ini "(I also did not copy it in the past) (in many articles, PHP is used. ini-recommended instead of PHP. ini-Dist, an article explains "php. ini-recommended optimizes the default settings in terms of performance and security ").

Fourth, modify PHP. ini:

(1) Search for the "extension_dir" field and assign it to the ext directory in the PHP decompression path, for example, "d: \ PhP5 \ Ext"

(2) Search for the CGI. force_redirect string. The default value is 1. Change it to 0. and cancel the previous number.

 

Extensions used to remove the previous ";"

Extension = php_mbstring.dll (wide character, used to support phpMyAdmin to avoid character display problems)
Extension = php_mcrypt.dll (used to support phpMyAdmin)
Extension = php_mysql.dll (MySQL module, which can be used to access the MySQL database)

Extension = php_mysqli.dll (MySQL module)

Extension = php_curl.dll
Extension = php_gd2.dll

Fifth, configure Apache to support PhP5:

Set the PHP start page:

< Ifmodule Dir_module >
Directoryindex index. php index.html default. php default.html index.htm

</Ifmodule>

You can add the required start page file name. Note that the file names are separated by spaces instead of commas.

There are two ways to make PHP work on Apache in windows. One is to use CGI binary files, and the other is to use Apache module DLL (this method is better ).

1. install PHP to Apache in CGI Mode

Insert the following command into the httpd. conf configuration file of Apache:

ScriptAlias/PHP /" D: /PHP /"
Addtype application/X-httpd-PHP. php # (PhP extension supported)
Action application/X-httpd-PHP "/PHP/ Php-cgi.exe "# (Note: Php-cgi.exe , No Php.exe. Otherwise, the following error occurs: )

The following error occurs in logs \ error. log when Apache is installed as CGI.

[Error] [client 127.0.0.1] premature end of script headers: php.exe

The reason is:Php-cgi.exe or php.exe.

2. install PHP in modules to Apache

Find the # loadmodule ssl_module modules/mod_ssl.so line, and add

Phpinidir "D:/PhP5 /"

Loadmodule php5_module "D:/PhP5/php5apache2_2.dll"

# (D:/PhP5/php5apache2_2.dll is the corresponding path for installing PHP. do not set php5apache2_2.dll and php5apache2. DLL and php5apache. DLL obfuscation. php5apache. DLL is only applicable to apache version 1. php5apache2 in the PhP5 compressed package. DLL is only applicable to apache2.0. *, if it is 2. 2. * For the above version, php5apache2_2.dll must be used. otherwise, the following problems may occur)

There are many articles in the following sentence: "adding PHP extension support"

Addtype application/X-httpd-PHP. php # (this sentence is required, otherwise the PHP file cannot be recognized)

When installing Apache in a module, the following error occurs:

"Cannot load C:/PHP/php5apache2. DLL into server: the specified module cocould not be found ."

Or:

"The requested operation has failed"

Solution can refer to: http://www.phpfans.net/bbs/viewthread.php? Tid = 857 & extra = Page % 3d1 (but this is for PHP 5.1)

Or: download the latest development version at http://snaps.php.net/index.php and replace it with php5apache2_2.dll( it seems it is also for PHP 5.1)

PHP 5.0.0 and above cannot be used on the local machine. no solution has been found yet (who knows, thank you for telling me). The latest PHP version has been downloaded, so we finally used PHP 5.2.9-2 ...... the installation was successful, probably because it was too wrong. Ha ~

Note: If you don't have permission to access/on this server appears after installation.

The changes are as follows:

< Directory />
Options followsymlinks
AllowOverride none
Order deny, allow
Allow from all # deny from all (modify here)
</ Directory >

The following error occurs because PHP 5.0.0 is run after installation (I run it in CGI Mode ).

"Unable to load dynamic library 'C: \ appserv \ PHP \ extension \ php_mcrypt.dll '-the specified module cannot be found"

In fact, this file and path are both correct.

Solution: "The specified module cannot be found" When appserv enables php_mycrypt.dll in Win2k

Php_mcrypt.dll must be supported by libmcrypt. dll, which is not provided by default by PHP. (PhP 5.2.9-2 is provided)

Note that libmcrypt. dll has multiple versions. You can find libmcrypt. dll that is compatible with your PHP version through experiments.

LatestHttp://files.edin.dk/php/win32/mcrypt/163 K

 

But PHP 5.0.0 needs to go to the http://files.edin.dk/php/win32/mcrypt/old/ for the next 247k.

 

 

The PHP manual is attached.

 

By the way, after logging on to phpMyAdmin, "the configuration file now requires a top secret phrase password (blowfish_secret)" appears )"

Solution: Find config in the phpMyAdmin \ libraries directory. default. in the PHP file, find $ cfg ['blowfish _ secret']. The value is null or the value is too small. You can add a value as needed.

In earlier versions, it seems that the config. Inc. php file in the root directory is set.

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.