Creating your own php.ini

http://php.net/manual/en/function.error-reporting.php

 

Creating your own php.ini

 

In your home directory you need to create (if you don't already have it) a php-fastcgi folder. Within this folder create two files (php5-fcgi and php4-fcgi) with the following contents:

php5-fcgi


#!/bin/sh
PHPRC="/usr/local/etc"
export PHPRC
exec /usr/local/www/cgi-bin/php5-fcgi

php4-fcgi


#!/bin/sh
PHPRC="/usr/local/etc/php4"
export PHPRC
exec /usr/local/www/cgi-bin/php4-fcgi

The line PHPRC="/usr/local/etc" in each file is the folder that is scanned for a php.ini file.

So, if you want your own php.ini, do the following via a shell account or SFTP (and substitute all instances of yourusername with your user name):

  1. Create a php4 folder: /user/home/yourusername/etc/php4
  2. Download the php4.ini file here, rename it to php.ini and upload it to the new folder: /users/home/yourusername/etc/php4
  3. Create a php5 folder yourusername/etc/php5
  4. Download the php5.ini file here, rename it to php.ini and upload it to the new folder: /users/home/yourusername/etc/php5
  5. Make php-fastcgi/php4-fcgi writeable by you (rwx-r-x-x or chmod 751)
  6. Make php-fastcgi/php5-fcgi writeable by you (rwx-r-x-x or chmod 751)
  7. For php4-fcgi, change PHPRC="/usr/local/etc/php4" to PHPRC="/home/yourusername/etc/php4" and save.
  8. For php5-fcgi, change the PHPRC="/usr/local/etc" to PHPRC="/home/yourusername/etc/php5" and save

Note: When creating these files make sure they have the appropriate permissions (which would be 751 since they need to be executable) and that they don't contain any DOS line endings (CRLF). Line endings or line breaks are usually a option you can set in your text editor of choice. The preferred option is Unix line endings (LF).

So you now have a custom php.ini file for your account that you can use to change some common settings.

Note: Your account, by default, will run under PHP 5, so you should only need to adjust any settings in /users/home/yourusername/etc/php5/php.ini unless you've switched to PHP 4

To change error reporting, modify the following lines in your php.ini file:


error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off

to


#error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
#display_errors = Off
error_reporting = E_ALL
display_errors = On

Note: The above applies to your primary domain only. If you want a custom php.ini to work with your other domains as well, you need to repeat the above for each of your domains (the"home directory" referenced above will of course become the directory of the particular domain). If you want to have a single custom php.ini, just point all PHPRC variables to the same location.

PHP4.ini

=============================================================================================

[PHP]

[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision  =  14
y2k_compliance = On
output_buffering = 4096
; Transparent output compression using the zlib library-will have mod_deflate do it
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir = 
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
;open_basedir =
disable_functions = pack, imagefilltoborder
disable_classes =
expose_php = Off
max_execution_time = 60
max_input_time = 120
memory_limit = 128M
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = On
ignore_repeated_source = On
report_memleaks = On
track_errors = Off

;html_errors = Off
;docref_root = "/phpmanual/"
;docref_ext = .html 
;error_prepend_string = ""
;error_append_string = "
"
;error_log = filename
;error_log = syslog

;arg_separator.output = "&"
variables_order = "GPCS"
register_globals = Off
register_argc_argv = Off
post_max_size = 60M
gpc_order = "GPC"
magic_quotes_gpc = Off
magic_quotes_runtime = Off 
magic_quotes_sybase = Off

auto_prepend_file =
auto_append_file =

default_mimetype = "text/html"
default_charset = "UTF-8"
;always_populate_raw_post_data = On

include_path = ".:/usr/local/share/smarty:/usr/local/lib/php:/usr/local/lib/php/pear:/usr/local/share/adodb"
#doc_root =
user_dir =
extension_dir = /usr/local/lib/php/20020429
enable_dl = Off
#this little cgi.fix_pathinfo is the absolute key to having txp clean urls work under phpcgi
cgi.fix_pathinfo = 1
file_uploads = On
upload_tmp_dir = /usr/local/www/php/tmp
upload_max_filesize = 40M
allow_url_fopen = On
;from="john@doe.com"
user_agent="PHP"
default_socket_timeout = 60
; auto_detect_line_endings = Off

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

[mmcache]
#zend_extension="/usr/local/lib/php/20020429/mmcache.so"
#mmcache.shm_size="1000"
#mmcache.cache_dir="/usr/local/www/php/tmp/mmcache"
#mmcache.enable="1"
#mmcache.optimizer="1"
#mmcache.check_mtime="1"
#mmcache.debug="0"
#mmcache.filter=""
#mmcache.shm_max="0"
#mmcache.shm_ttl="0"
#mmcache.shm_prune_period="0"
#mmcache.shm_only="0"
#mmcache.compress="1"
#mmcache.keys="shm_and_disk"
#mmcache.sessions="shm_and_disk"
#mmcache.content="shm_and_disk"


[Syslog]
define_syslog_variables  = Off

[mail function]
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

[SQL]
sql.safe_mode = Off

[MySQL]
mysql.allow_persistent = Off
; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1
; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

[PostgresSQL]
; Allow or prevent persistent links.
pgsql.allow_persistent = Off
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[dbx]
dbx.colnames_case = "lowercase"

[bcmath]
bcmath.scale = 0

[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor  = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

[Sockets]
sockets.use_system_read = On

[mbstring]
; language for internal character representation.
mbstring.language = Neutral

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
mbstring.internal_encoding = UTF-8

; http input encoding.
mbstring.http_input = UTF-8

; http output encoding. mb_output_handler must be
; registered as output buffer to function
mbstring.http_output = UTF-8

; enable automatic encoding translation accoding to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
;  portable libs/applications.
mbstring.encoding_translation = Off

; automatic encoding detection order.
; auto means
mbstring.detect_order = UTF-8

; substitute_character used when character cannot be converted
; one from another
mbstring.substitute_character = none;

; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
mbstring.func_overload = 0

[exif]
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
; With mbstring support this will automatically be converted into the encoding
; given by corresponding encode setting. When empty mbstring.internal_encoding
; is used. For the decode settings you can distinguish between motorola and
; intel byte order. A decode setting cannot be empty.
;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel  = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel  = JIS

; Local Variables:
; tab-width: 4
; End:

=============================================================================================

PHP5.ini

=============================================================================================

[PHP]
engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision  =  14
y2k_compliance = On
output_buffering = 4096
;output_handler =
zlib.output_compression = Off
;zlib.output_handler =
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = Off
disable_functions =
disable_classes =
expose_php = Off
max_execution_time = 60  ; Maximum execution time of each script, in seconds
max_input_time = 120  ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M  ; Maximum amount of memory a script may consume (8MB)
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
arg_separator.output = "&"
variables_order = "GPCS"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
post_max_size = 40M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
include_path = ".:/usr/local/share/smarty:/usr/local/lib/php/pear"
doc_root =
user_dir =
extension_dir = /usr/local/lib/php/20050922
enable_dl = Off
cgi.force_redirect = 1
; cgi.nph = 1
; cgi.redirect_status_env = ;
; fastcgi.impersonate = 1;
;cgi.rfc2616_headers = 1
file_uploads = On
upload_tmp_dir = /usr/local/www/php/tmp
upload_max_filesize = 40M
allow_url_fopen = On
user_agent="PHP"
default_socket_timeout = 60

[Syslog]
define_syslog_variables  = Off

[mail function]
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
;mail.force_extra_parameters =

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On
mysql.max_persistent = 20
mysql.max_links = -1
mysql.default_port = 3306
mysql.default_socket =
mysql.default_host = localhost
mysql.connect_timeout = 60
mysql.trace_mode = Off

[MySQLI]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host = localhost
mysqli.reconnect = Off

[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = 20
pgsql.max_links = 40
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[dbx]
dbx.colnames_case = "lowercase"

[bcmath]
bcmath.scale = 0

[Session]
session.save_handler = files
session.save_path = "/tmp"
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor  = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 1
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"


[Sockets]
sockets.use_system_read = On

[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.typelib_file =
; allow Distributed-COM calls
;com.allow_dcom = true
; autoregister constants of a components typlib on com_load()
;com.autoregister_typelib = true
; register constants casesensitive
;com.autoregister_casesensitive = false
; show warnings on duplicate constat registrations
;com.autoregister_verbose = true

[mbstring]
;mbstring.language = Japanese
;mbstring.internal_encoding = EUC-JP
;mbstring.http_input = auto
;mbstring.http_output = SJIS
;mbstring.encoding_translation = Off
;mbstring.detect_order = auto
;mbstring.substitute_character = none;
;mbstring.func_overload = 0


[exif]
;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel  = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel  = JIS

[Tidy]
;tidy.default_config = /usr/local/lib/php/default.tcfg
tidy.clean_output = Off

[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400

; Local Variables:
; tab-width: 4
; End:

[Zend]
zend_extension_manager.optimizer=/usr/local/lib/php/20050922/Optimizer
zend_extension_manager.optimizer_ts=/usr/local/lib/php/20050922/Optimizer_TS
zend_optimizer.version=3.0.0
zend_extension=/usr/local/lib/php/20050922/ZendExtensionManager.so
zend_extension_ts=/usr/local/lib/php/20050922/ZendExtensionManager_TS.so

=============================================================================================

 

  • 18 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

PHP URL Redirect

header("location:http://www.domainName.com/index.html");exit;?>

Deprecated: Assigning the return value of new by reference is deprecated in PHP5.3

Fix – Deprecated: Assigning the return value of new by reference is deprecated in PHP5.3     I...

What is PHP?

  PHP is  generl-purpose server-side scripting lnguge originlly designed for web development to...

PHPMailer Tutorial

PHPMailer tutorial     Introduction    Requirements     About PHPMailer     PHPMailer Features...

Creating simple PHP contact form

In this tutorial create 2 files1. contact.php2. send_contact.phpStep1. Create file contact.php.2....