Solved

Secure php.ini file

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

Watch Anatomy of a Wi-Fi Hack On-Demand

In less than a weekend, anyone with Internet access and some free time can become a Wi-Fi MitM to wreak havoc on your network. View our Wi-Fi Expert in an on-demand episode of our Secure Wi-Fi mini-series as he explores the motives, execution, and anatomy of a Wi-Fi hack.

Question has a verified solution.

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

Suggested Solutions

February 24, 2017 — On February 23, Travis Ormandy, a vulnerability researcher at Google, reported on Twitter (https://twitter.com/taviso/status/834900838837411840) that massive stores of data have been leaked by CloudFlare, a company that provide…
Most MSPs worth their salt are already offering cybersecurity to their customers. But cybersecurity as a service is wide encompassing and can mean many things.  So where are MSPs falling in this spectrum?
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

740 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