Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Secure php.ini file

Posted on 2008-10-28
3
Medium Priority
?
1,015 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 2000 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 2000 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 VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A look at what happened in the Verizon cloud breach.
This article is written by John Gates, CISSP. Gates, the SNUG President-Elect, currently holds the position of Manager of Information Systems at Lake Park High School in Roselle, Illinois.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

719 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