Solved

Secure php.ini file

Posted on 2008-10-28
3
993 Views
Last Modified: 2013-12-13
Hi,

I'm new to PHP and I've been asked to do a 'secure' install on Windows 2003/IIS 6.0.  Does anyone have an example of a secure php.ini file that they would be willing to share?  Right now, I'm unsure of what all of the various settings in the php.ini-recommended file mean. Also, not sure if this matters, but I'm going to be using fastcgi.
0
Comment
Question by:Finlay11
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 22827053
expose_php       = Off
error_reporting  = E_ALL
display_errors   = Off
display_startup_errors = Off
log_errors       = On
error_log        = /path/to/logs/php/php_error.log
ignore_repeated_errors = Off
memory_limit     = 42M
mx_execution_time= 9
report_memleaks  = On
track_errors     = Off
html_errors      = Off
doc_root         = /path/to/DocumentRoot/PHP-Scripts
allow_url_fopen  = Off
open_basedir     = /path/to/DocumentRoot/PHP-Scripts/
register_globals = Off
variables_order  = "ESGP"
;gpc_order       =
magic_quotes_gpc = On
safe_mode        = On
safe_mode_include_dir        = /path/to/private/include
safe_mode_exec_dir           = /path/to /private/executable
safe_mode_allowed_env_vars   = PHP_
safe_mode_protected_env_vars = SHELL, IFS, PATH, HOME, USER, TZ, TMP, TEMP, TMPDIR, LANG, LD_LIBRARY_PATH, LD_PRELOAD, SHLIB_PATH, LIBPATH
file_uploads     = Off
upload_tmp_dir   = /tmp/PHP/
upload_max_filesize=1M   # NOTE: more or less useless as first handled by the web server
enable_dl        = On
disable_functions= system, exec, shell_exec, passthru, phpinfo, show_source, popen, proc_open
disable_functions= fopen_with_path, dbmopen, dbase_open, putenv, move_uploaded_file
disable_functions= chdir, mkdir, rmdir, chmod, rename
#? disable_functions=filepro, filepro_rowcount, filepro_retrieve, posix_mkfifo
# see also: http://de3.php.net/features.safe-mode
session.save_path= /path/to//temp-dir/
session.name     = yourPHPSESSID
session.cookie_path    = /
default_socket_timeout = 60
session.use_trans_sid  = 0
session.cookie_lifetime = 0


## to be improved in many ways
0
 

Author Comment

by:Finlay11
ID: 22831752
three questions, if you don't mind:

1) my path to document root/php-scripts -  is that a directory that I define myself or is that my root php directory? C:/php

2) For session.name: I don't understand what PHPsessID means?

3) If I'm running it under CGI do I need to put my php folder under the cgi folder on my server or do I leave it under the C:/php file that I extracted it to?  Note:  I'm not running it on a production server right now.

thank you very much for all your help.  It is much appreciated.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 500 total points
ID: 22835587
1) the path to your scripts, but it should not be the same as the web servers DocumentRoot

2) it's the name of the cookie send by php if the php's enfgine is used to handle sessions

3) it's the folder you define in your php.ini, see 1)

0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now