Apache 1.33 and PHP 4.4.0 configuration notes

Source: Internet
Author: User
Tags manual error handling file upload log mysql pear php and sql injection

The recent state is not good, just such a thing, a few minutes should solve the problem, the night unexpectedly toss two hours, it is really uncomfortable, it seems necessary to record, so that every time when the configuration always look at those notes ... Today is really a bad line.

  1) PHP Configuration

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

This part is error handling and log error_reporting

By a combination of bits to manage the type of logging errors, if it is with Php.ini-disc, the default option is E_all & ~e_notice, which can be set up for your purposes, and I like e_all when writing debug scripts, whenever, It is advantageous to treat some warnings as error handling.

Display_errors

The default is on, which means that the error that conforms to the error_reporting option is printed to the page, but it is set to off after the publication is run, which is also a recommendation in the annotation of this option. The original text is as follows:

;  Print out errors (as a part of the output). For production Web sites,
; You ' re strongly encouraged to turn this feature off, with use error logging
;  instead (below). Keeping Display_errors enabled on a production Web site
; May reveal security information to end users, such as file paths on your Web
; Server, your database schema or other information.

Log_errors

The default is off, which is to log errors that match the error_reporting option to the file (verbose, log files), and it is strongly recommended that you open this option to log errors to the file rather than to the page.

"You ' re strongly advised to use error logging in place of error displaying on production Web sites."

Log_errors_max_len

The maximum length of the log file, which defaults to 1024,0 means there is no limit.

Error_log

The default is commented out, this option has two values, one is filename, which indicates the log to record the file; one is syslog, which means logging to the system's log (Note: This option works on NT-only systems, and 9x does not work)

;;;;;;;;;;;;;;;;;
; Data handling;
;;;;;;;;;;;;;;;;;

This section describes some of the options for data processing in PHP, and many are also related to security issues.

Register_globals

The default is off, the role of this option is an old topic of discussion, specific to see personal habits, convenience is not false, but how much will be some test of the program.

Magic_quotes_gpc

The default is on, but I like to be off, open on the SQL injection will have some hindrance, but only certainly, not completely. Specific can see http://www.4ngel.net related articles.

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and directories;
;;;;;;;;;;;;;;;;;;;;;;;;;

Some path settings (here assume your PHP path is c:\php)

Include_path

I set it to c:\php\pear, whether it is used or not, but the function of pear is still very powerful. About pear specific See http://pear.php.net

Extension_dir

Do not have to say anything more, set into c:\php\extensions will not have anything wrong.

Cgi.force_redirect

The default is to comment out, what is the use of this option, I do not understand now, but the use of Apache, keep the default can be; for the IIS description to turn off this option (set to 0). That's what the authorities say.

;;;;;;;;;;;;;;;;
; File uploads;
;;;;;;;;;;;;;;;;

File Upload Related Settings

File_uploads

The default is on, which means that the file upload feature is enabled. Can be customized according to their own needs.

Upload_tmp_dir

The temporary directory of uploaded files, which is annotated by default, indicates that using the temporary directory specified by the system, I like to specify a separate directory, at least one write permission.

Upload_max_filesize

The size of the upload file, the default is 2M. Look at a personal preference.

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions;
;;;;;;;;;;;;;;;;;;;;;;

Expansion, expansion, expansion is a good thing, flexible and convenient.

The format is: extension=modulename.extension, such as Extension=msql.dll (under Windows), Extension=msql.so (under *nix)

PHP with a lot of extensions, as needed to customize it ... By the right, generating the captcha sometimes requires calling gd2 this extension, and removing the previous comment is always true, and these extensions specific features refer to the PHP manual (http://www.php.net/docs.php). (Note: 4.4.0 inside does not contain GD library, only GD2)

;;;;;;;;;;;;;;;;;;;
; Module Settings;
;;;;;;;;;;;;;;;;;;;

Module settings
[MySQL]

Most people like to use MySQL, which can be set if needed, but most of the situation depends on how your program is.

[Session]

Cookies and session-related settings are here ... Security issues will not be less, but still the same, depending on how the program is written.
Session.save_path

The save path for the session in the server, and the default setting is NULL. NOTE: If you do not create this directory, PHP will not automatically create this directory, so, let's do it ourselves ... Otherwise, you always have to pop out some warning messages.
There are still some options for session effective time, look at the manual or note, according to their own needs to customize.
To this end, PHP configuration is completed, the following is Apache 1.33.

2 Apache Configuration

This article says a lot about it, and the Apache manual is detailed enough to make people look lazy. Here's just a little bit of configuration for PHP and some basic options. Here assume that the installation path for Apache and PHP is C:\Apache and c:\php,web paths are d:\ Wwwroot

ServerName

As a program to write and debug I like to set for localhost

ServerRoot

Apache installation path, of course, for C:\Apache

DocumentRoot

The home directory of the Web, D:\wwwroot

Serversignature off
Servertokens Prod

These two options can be combined to cancel an error in the Apache display of Banner.apache 1.33 no servertokens comments, but can be found in the manual, detailed explanation please refer to the manual, here is not much to say.

Here's what you'll say about PHP configuration:

Basically is to add, find the corresponding position, add in can.
LoadModule php4_module "C:/php/sapi/php4apache.dll"
Addmodule mod_php4.c
DirectoryIndex index.php index.php3 index.htm index.html
AddType application/x-httpd-php. php
The configuration above is to run PHP as the Apache module, and if you need to run it in a CGI way, remove the LoadModule and addmodule above and add it to the configuration file at the appropriate location:
scriptalias/php/"c:/php/"
Action application/x-httpd-php "/php/php.exe"

This is the end of Apache configuration, which can be used later. PHP phpinfo ();?> to test.
Apache is a powerful Web server, only the basic configuration, for performance optimization and other features, please refer to other relevant articles. Please advise me if there is any mistake.



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.