ini-set

How to change the way PHP writes errors in the error log file?

允我心安 提交于 2019-12-22 09:18:30
问题 I have been working on my website for over a year now, and I am very anxious to finally put it out there for people to use. It has gotten quite large however - I almost want to say out of my control - and on top of that I am really just an self taught amateur programmer. So I want to be sure, that any errors that php produces are logged in a file, so I can than access this file and track errors down. Currently my settings are the following: <?php error_reporting(E_ALL); ini_set('display

How do I check if ini_set() is enabled either in the global PHP.INI or in my PHP script?

随声附和 提交于 2019-12-22 07:56:47
问题 I have an app that is failing on the install. The vendor says I probably have ini_set() disabled. How can I check this? 回答1: I did some research on this, and it turns out that sometimes ini_set will not return FALSE, but an empty string. This is mentioned in the URL pointed out by gabriel1836. The best way to check if it works is to first check the disable_functions flag in php.ini to see if it is disabled, and then (if it is not disabled), change a value with it, and echo phpinfo()

why ini_set('session.gc_maxlifetime',60) doesn't work?

流过昼夜 提交于 2019-12-13 17:07:22
问题 the default expire time of session is 1440,i want to reduce this time to 60 second,but when i use ini_set('session.gc_maxlifetime','60') in the first page it work,but it doesn't work in an other page, please tell me what is my wrong? ----------index.php----------- <?php ini_set('session.gc_maxlifetime','60'); session_start(); $_SESSION['id']='123'; print('<br/><a href="link.php">link<a/>'); ?> ----------link.php---------- <?php session_start(); if(isset($_SESSION['id'])){ ini_set('session.gc

php session and path setting

早过忘川 提交于 2019-12-13 03:42:17
问题 I would like to separate my source folders into two: The folders that contain the code that you type into the address bar and those that make up parts of the page (tiles) and other code (classes, etc). So at the start of every php file I added: <?php // index.php include("config.php"); include("session.php"); ?> Config contains just this so far, but allows me to expand if I need other directories (logs, etc.) <?php // config.php $_PATHS["base"] = dirname(dirname(__FILE__)) . "\\"; $_PATHS[

ini_set('mbstring.internal_encoding','UTF-8')

余生颓废 提交于 2019-12-11 00:17:20
问题 ini_set('mbstring.internal_encoding','UTF-8') what does this signify at the beginning of a php file and what is it used for ? I know that a php manual exists but it does not explain it in plain common man's language. 回答1: It defines the default internal character encoding to UTF-8 character set type. This is used to make a site multilingual by changing the mbstring.internal_encoding value. encoding is the character encoding name used for the HTTP input character encoding conversion, HTTP

Can't use ini_set because session is active

 ̄綄美尐妖づ 提交于 2019-12-10 15:46:57
问题 How can I fix this? Warning: ini_set() [function.ini-set]: A session is active. You cannot change the session module's ini settings at this time in C:\xampp\htdocs** * * ** .php on line 3 I already tried using session_destroy(); but I still get the error. Thanks. 回答1: use session_start(); after ini_set or @ sign before ini_set : @ini_set 回答2: if you server is configured to auto start sessions, you can try also: php_flag session.auto_start 0 in your .htaccess file 来源: https://stackoverflow.com

Can't disable error reporting in OpenCart (PHP)

自古美人都是妖i 提交于 2019-12-09 04:55:07
问题 I can't seem to disable error reporting in PHP - I have tried everything but "Notice" errors are still displayed. My php.ini has display_errors = Off; error_reporting = 0; My .htaccess has php_value error_reporting 0 And my script has ini_set('display_errors', 'Off'); ini_set('log_errors', 1); ini_set('error_reporting', 0); ini_set('display_startup_errors', 'Off'); php_info(); echo $my_undefined_var; The php_info() output confirms that display_errors and error_reporting are indeed off and 0,

Php CLI script ignoring memory_limit, crashing at much lower number than limit

六眼飞鱼酱① 提交于 2019-12-07 02:27:05
问题 for some reason, my one of my php scripts are ignoring the php.ini memory limit or ini_set. When i do a print_r(ini_get_all) it shows the global memory limit set to 100M (and local for that matter), when my script dies at Fatal error: Out of memory (allocated 24714304) (tried to allocate 571 bytes) Any tips on diagnosing this? The server has 8gigs of memory and never had problems running this script before. Any tips on debugging this? Thanks! 回答1: The single most common cause of this is that

PHP: mail() function with runtime ini_set() for SMTP and SMTP_PORT not working on Linux

白昼怎懂夜的黑 提交于 2019-12-06 08:20:43
问题 I have used a PHP code for Mailing using a SMTP HOST as given below: ini_set('SMTP','myserver'); ini_set('smtp_port',25); $to = $email; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "From: NO-REPLY<no-reply@mydomain.com>" . "\r\n"; $subject = "Confirmation For Request"; $message = '<html> <body> <p>Hi '.$firstname.' '.$lastname.'</p> <p> We recieved below details from you. Please use given Request/Ticket ID for future

How to change the way PHP writes errors in the error log file?

霸气de小男生 提交于 2019-12-05 16:23:35
I have been working on my website for over a year now, and I am very anxious to finally put it out there for people to use. It has gotten quite large however - I almost want to say out of my control - and on top of that I am really just an self taught amateur programmer. So I want to be sure, that any errors that php produces are logged in a file, so I can than access this file and track errors down. Currently my settings are the following: <?php error_reporting(E_ALL); ini_set('display_errors', '0'); ini_set('log_errors', 1); ini_set('error_log', 'errors.log'); ?> Works pretty good so far, my