Solved

Secure php.ini file

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PEN and Issuance policy for 2 tier Windows 2012 PKI 3 86
How can I send attachment with mail 5 26
Problem to setting 16 50
Why is my select returning NaN 23 46
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

710 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