John Hoffman
John Hoffman

Reputation: 18607

Can I create my own php.ini file?

My shared hosting service denies the ability to view errors in PHP in php.ini.

Hence, I want to write my own php.ini file and place it in my own subdirectory. Is this possible?

I have tried this tutorial to no avail.
http://www.washington.edu/itconnect/web/publishing/php-ini.html#create

PHP just doesn't look for the php.ini file in my directory. It still adheres to the one at /etc/php5/cgi/php.ini.

Upvotes: 1

Views: 2349

Answers (3)

sikander
sikander

Reputation: 2286

You can use ini_set to set the value of a given configuration option.

Upvotes: 2

rlemon
rlemon

Reputation: 17666

You can try using a .htaccess file to enable the error logging/reporting.

.htaccess

# enable PHP error logging
php_flag  log_errors on
php_value error_log  /home/path/public_html/domain/PHP_errors.log

Upvotes: 4

anubhava
anubhava

Reputation: 784888

Make sure in the system php.ini following setting are there to enable user-defined INI files:

;;;;;;;;;;;;;;;;;;;;
; php.ini Options  ;
;;;;;;;;;;;;;;;;;;;;
; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"
user_ini.filename = ".user.ini"

; To disable this feature set this option to empty value
;user_ini.filename =

Upvotes: 1

Related Questions