Solved

Secure php.ini file

Posted on 2008-10-28
3
1,011 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here's a look at newsworthy articles and community happenings during the last month.
Make the most of your online learning experience.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

630 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