Re: [PHP] ini_set('memory_limit', '16M')
On Nov 28, 2007 4:05 PM, George Pitcher <[EMAIL PROTECTED]> wrote: > Hi, > > > On one script (pulling large amount of data from mysql) I'm getting error: > > "Fatal error: Allowed memory size of 16777216 bytes exhausted..." > > I put on the beginning of the page > > ini_set('memory_limit', '64M'); > > but I'm still getting the same error message?!? > > > > ini_set() returns the old value, so it might work if you assign the return > value: > > $x = ini_set('memory_limit', '64M'); > > George > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > http://php.he.net/manual/en/ini.core.php#ini.memory-limit Prior to PHP 5.2.1, in order to use this directive it had to be enabled at compile time by using -enable-memory-limit in the configure line. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('memory_limit', '16M')
afan pasalic wrote: Hi, On one script (pulling large amount of data from mysql) I'm getting error: "Fatal error: Allowed memory size of 16777216 bytes exhausted..." I put on the beginning of the page ini_set('memory_limit', '64M'); but I'm still getting the same error message?!? Any idea? Thanks for any help. -afan if this is for your receiving upload script, you will find that PHP does not parse/use any of your script until the upload is completed with your web server and then passed off to PHP. So, the only way to change the amount is via the php.ini/.htaccess/vhosts entry If you are using apache and can use .htaccess files, I would suggest that method. Next I would configure my vhosts if all else fails, I would change the setting in the php.ini file -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set('memory_limit', '16M')
Hi, > On one script (pulling large amount of data from mysql) I'm getting error: > "Fatal error: Allowed memory size of 16777216 bytes exhausted..." > I put on the beginning of the page > ini_set('memory_limit', '64M'); > but I'm still getting the same error message?!? > ini_set() returns the old value, so it might work if you assign the return value: $x = ini_set('memory_limit', '64M'); George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('memory_limit', '16M')
Hi, On one script (pulling large amount of data from mysql) I'm getting error: "Fatal error: Allowed memory size of 16777216 bytes exhausted..." I put on the beginning of the page ini_set('memory_limit', '64M'); but I'm still getting the same error message?!? Any idea? Thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
*I* agree, but my agreement don't mean much... :-v On Fri, June 1, 2007 10:13 am, Samuel Vogel wrote: > I just tried it with php 5.2.3. Same behavior! > > Do you agree that overwriting the value shouldn't be possible with > ini_set() ? > > I will file a bug report! > > Richard Lynch schrieb: >> File a bug report then, and see what happens... >> >> But you may want to test with most recent versions if you are not >> already on current PHP versions. >> >> On Thu, May 31, 2007 2:46 pm, Samuel Vogel wrote: >> >>> There is no bug filed for this. There is only one older bug ( >>> http://bugs.php.net/bug.php?id=38804 ) which makes me think >>> overwriting >>> with ini_set() shouldn't be possible! >>> >>> Richard Lynch schrieb: >>> On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote: >> And what happens if you try to allocate 3M of data? >> >> $foo = str_repeat('.', 3145728); >> >> >> > Nothing. It does it without any errors. I can allocate up to 20MB > (well > a little bit less of course). > > Check http://bugs.php.net and see if it's a known issue or an exception to the php_admin_* rule or... >> >> >> > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
I don't think it should be allowed. A comment from the ini_set page [1]: "If you set something using php_admin_value in httpd.conf it is then not possible to be set the value at runtime, even if it's NOT PHP_INI_SYSTEM. " So, I guess it must be a bug. Tijnema [1] http://www.php.net/manual/en/function.ini-set.php#30424 That's what I read too. I just wondered because many times there are only .htaccess and vhost mentioned. I filed a bug at: http://bugs.php.net/bug.php?id=41561 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
On 6/1/07, Samuel Vogel <[EMAIL PROTECTED]> wrote: I just tried it with php 5.2.3. Same behavior! Do you agree that overwriting the value shouldn't be possible with ini_set() ? I will file a bug report! I don't think it should be allowed. A comment from the ini_set page [1]: "If you set something using php_admin_value in httpd.conf it is then not possible to be set the value at runtime, even if it's NOT PHP_INI_SYSTEM. " So, I guess it must be a bug. Tijnema [1] http://www.php.net/manual/en/function.ini-set.php#30424 Richard Lynch schrieb: > File a bug report then, and see what happens... > > But you may want to test with most recent versions if you are not > already on current PHP versions. > > On Thu, May 31, 2007 2:46 pm, Samuel Vogel wrote: > >> There is no bug filed for this. There is only one older bug ( >> http://bugs.php.net/bug.php?id=38804 ) which makes me think >> overwriting >> with ini_set() shouldn't be possible! >> >> Richard Lynch schrieb: >> >>> On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote: >>> >>> > And what happens if you try to allocate 3M of data? > > $foo = str_repeat('.', 3145728); > > > Nothing. It does it without any errors. I can allocate up to 20MB (well a little bit less of course). >>> Check http://bugs.php.net and see if it's a known issue or an >>> exception to the php_admin_* rule or... >>> >>> >>> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
I just tried it with php 5.2.3. Same behavior! Do you agree that overwriting the value shouldn't be possible with ini_set() ? I will file a bug report! Richard Lynch schrieb: File a bug report then, and see what happens... But you may want to test with most recent versions if you are not already on current PHP versions. On Thu, May 31, 2007 2:46 pm, Samuel Vogel wrote: There is no bug filed for this. There is only one older bug ( http://bugs.php.net/bug.php?id=38804 ) which makes me think overwriting with ini_set() shouldn't be possible! Richard Lynch schrieb: On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote: And what happens if you try to allocate 3M of data? $foo = str_repeat('.', 3145728); Nothing. It does it without any errors. I can allocate up to 20MB (well a little bit less of course). Check http://bugs.php.net and see if it's a known issue or an exception to the php_admin_* rule or... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
File a bug report then, and see what happens... But you may want to test with most recent versions if you are not already on current PHP versions. On Thu, May 31, 2007 2:46 pm, Samuel Vogel wrote: > There is no bug filed for this. There is only one older bug ( > http://bugs.php.net/bug.php?id=38804 ) which makes me think > overwriting > with ini_set() shouldn't be possible! > > Richard Lynch schrieb: >> On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote: >> And what happens if you try to allocate 3M of data? $foo = str_repeat('.', 3145728); >>> Nothing. It does it without any errors. I can allocate up to 20MB >>> (well >>> a little bit less of course). >>> >> >> Check http://bugs.php.net and see if it's a known issue or an >> exception to the php_admin_* rule or... >> >> > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
There is no bug filed for this. There is only one older bug ( http://bugs.php.net/bug.php?id=38804 ) which makes me think overwriting with ini_set() shouldn't be possible! Richard Lynch schrieb: On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote: And what happens if you try to allocate 3M of data? $foo = str_repeat('.', 3145728); Nothing. It does it without any errors. I can allocate up to 20MB (well a little bit less of course). Check http://bugs.php.net and see if it's a known issue or an exception to the php_admin_* rule or... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
On Wed, May 30, 2007 3:34 pm, Samuel Vogel wrote: >> And what happens if you try to allocate 3M of data? >> >> $foo = str_repeat('.', 3145728); >> > Nothing. It does it without any errors. I can allocate up to 20MB > (well > a little bit less of course). Check http://bugs.php.net and see if it's a known issue or an exception to the php_admin_* rule or... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
Hi! Show us your test code? /etc/apache2/httpd.conf : php_admin_value memory_limit 3145728 iniset_test.php : new: ".$new; ?> The result is the following: old: 3145728 new: 20971520 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
And what happens if you try to allocate 3M of data? $foo = str_repeat('.', 3145728); Nothing. It does it without any errors. I can allocate up to 20MB (well a little bit less of course). Regards, Samy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
On Wed, May 30, 2007 2:59 pm, Samuel Vogel wrote: > Hi! >> Show us your test code? >> > /etc/apache2/httpd.conf : > php_admin_value memory_limit 3145728 > > iniset_test.php : > > $old = ini_set("memory_limit", 20971520); > > echo "old: ".$old; > > $new = ini_get("memory_limit"); > > echo "new: ".$new; > > ?> > > The result is the following: > old: 3145728 > new: 20971520 And what happens if you try to allocate 3M of data? $foo = str_repeat('.', 3145728); -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
On Wed, May 30, 2007 2:44 pm, Samuel Vogel wrote: >>> I would like to allow the users to ini_set(), while disabling the >>> risky >>> options with php_admin_flag/value! >>> >> >> I don't think php_admin_* can be over-ridden -- that's kinda the >> whole >> point of that. > > The Problem is, that i can be overwritten using ini_set()... > I just found that out by testing it and now I don't even have to worry > about what options to disable, because I can't disable any of them :( > > Any thoughts on that? Show us your test code? -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
Hello, I would like to allow the users to ini_set(), while disabling the risky options with php_admin_flag/value! I don't think php_admin_* can be over-ridden -- that's kinda the whole point of that. The Problem is, that i can be overwritten using ini_set()... I just found that out by testing it and now I don't even have to worry about what options to disable, because I can't disable any of them :( Any thoughts on that? Regards, Samy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() security question
On Tue, May 29, 2007 10:19 am, Samuel Vogel wrote: > I would be very interested in knowing which options, that are > accessible > with PHP_INI_ALL or PHP_INI_PERDIR, could be risky to allow on a > shared > hosting server. php.ini_recommended is a good starting point, I think... > I would like to allow the users to ini_set(), while disabling the > risky > options with php_admin_flag/value! I don't think php_admin_* can be over-ridden -- that's kinda the whole point of that. > Stuff like 'memory_limit' and so on come to my mind! If you're going to use memory_limit on shared hosting, PLEASE make it a reasonable value! The default php.ini setting doesn't even run some of the larger common packages out there. And something like a simple photo album trying to generate thumbnails... You may want to have a very different default php.ini for the CLI php and give (some) users SSH access, on request, so they can do reasonable things like make thumbnails in a background task. > Does anybody have more infos on this? I would guess that there are mailing lists and forums dedicated to webhosting, and that many many many of them would have much better info the PHP-General, since many hosts are running PHP. You could also try contacting reputable webhosts you think "do it right" directly and ask them what they do. And, finally, you could work backwards by asking your potential customers what they need. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set() security question
I would be very interested in knowing which options, that are accessible with PHP_INI_ALL or PHP_INI_PERDIR, could be risky to allow on a shared hosting server. I would like to allow the users to ini_set(), while disabling the risky options with php_admin_flag/value! Stuff like 'memory_limit' and so on come to my mind! Does anybody have more infos on this? Regards, Samy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set()
- Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: "Gustav Wiberg" <[EMAIL PROTECTED]> Cc: "PHP General" Sent: Tuesday, September 13, 2005 9:26 PM Subject: Re: [PHP] ini_set() On Tue, September 13, 2005 2:11 pm, Gustav Wiberg wrote: Hi there! I don't get it... From the manual... string ini_set ( string varname, string newvalue ) Sets the value of the given configuration option. Returns the old value on success, FALSE on failure. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending. Does this mean that: File phpcode1.php handles cookies and has the code ini_set('session.cookie_lifetime',2147483647); ini it. File phpcode2.php has nothing to do with cookies When user goes TO phpcode2.php FROM phpcode1.php, session.cookie_lifetime would be zero and ended when browser is closed...? No. It means that *IF* you do that ini_set() before you do session_start() *THEN* the Cookie sent out in phpcode1.php will have a theortical lifetime of about 33 years. phpcode2.php would be affected only if it did session_start(), and the effect would be that the cookie would be theoretically available (and the session tied to it) for 33 years. I say THEORETICAL above because browsers are allowed to discard cookie life-times longer than 2 years (??? check specs ???) on the assumption that 33 year life-time cookies are just plain stupid mistakes on somebody's part. YMMV NAIAA IANAL -- Like Music? http://l-i-e.com/artists.htm -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.23/99 - Release Date: 2005-09-12 Thanx a lot! I think it is clearer now... :-) What happens if ini_set AFTER session_start(). Doesn't it affect anything then? /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set()
On Tue, September 13, 2005 2:11 pm, Gustav Wiberg wrote: > Hi there! > > I don't get it... > > > From the manual... > > string ini_set ( string varname, string newvalue ) > > Sets the value of the given configuration option. Returns the old > value on > success, FALSE on failure. The configuration option will keep this new > value > during the script's execution, and will be restored at the script's > ending. > > Does this mean that: > > File phpcode1.php handles cookies and has the code > ini_set('session.cookie_lifetime',2147483647); ini it. > File phpcode2.php has nothing to do with cookies > > When user goes TO phpcode2.php FROM phpcode1.php, > session.cookie_lifetime > would be zero and ended when browser is closed...? No. It means that *IF* you do that ini_set() before you do session_start() *THEN* the Cookie sent out in phpcode1.php will have a theortical lifetime of about 33 years. phpcode2.php would be affected only if it did session_start(), and the effect would be that the cookie would be theoretically available (and the session tied to it) for 33 years. I say THEORETICAL above because browsers are allowed to discard cookie life-times longer than 2 years (??? check specs ???) on the assumption that 33 year life-time cookies are just plain stupid mistakes on somebody's part. YMMV NAIAA IANAL -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set()
Hi there! I don't get it... From the manual... string ini_set ( string varname, string newvalue ) Sets the value of the given configuration option. Returns the old value on success, FALSE on failure. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending. Does this mean that: File phpcode1.php handles cookies and has the code ini_set('session.cookie_lifetime',2147483647); ini it. File phpcode2.php has nothing to do with cookies When user goes TO phpcode2.php FROM phpcode1.php, session.cookie_lifetime would be zero and ended when browser is closed...? /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set and upload_tmp_dir
On Friday 15 April 2005 02:11, Reynier Perez Mira wrote: > I'm try to change de value for the PHP config var upload_tmp_dir with > objetive to make an file upload an access more easy to superglobal > array $_FILES['fichero']['tmp_name']. Into my php file just in the > start I have this: > > ini_set("upload_tmp_dir","C:\\PHP5\\tmp\\"); You can't do that. That has to be set in php.ini. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set and upload_tmp_dir
Reynier Perez Mira wrote: Hi: I'm try to change de value for the PHP config var upload_tmp_dir with objetive to make an file upload an access more easy to superglobal array $_FILES['fichero']['tmp_name']. Into my php file just in the start I have this: ini_set("upload_tmp_dir","C:\\PHP5\\tmp\\"); The directory exists because I made it's after. What's wrong? http://docs.php.net/en/ini.html upload_tmp_dir is PHP_INI_SYSTEM - Entry can be set in php.ini or httpd.conf It's logical, by the time your script is executed the file is already uploaded. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set and upload_tmp_dir
Hi: I'm try to change de value for the PHP config var upload_tmp_dir with objetive to make an file upload an access more easy to superglobal array $_FILES['fichero']['tmp_name']. Into my php file just in the start I have this: ini_set("upload_tmp_dir","C:\\PHP5\\tmp\\"); The directory exists because I made it's after. What's wrong? Reynier Pérez Mira 3ero. Ing. Informática Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy.
Re: [PHP] ini_set doesn't work
your set it to '-1'!!! thats not allowed. You must habe a value highter than zero. Its better you set it in generall to 60. And you forgot the 'M' fater the number like ini_set("memory_limit","-1M"); set it better to that: ini_set("memory_limit","60M"); > hello, > > what do I have to change in php.ini, to allow thr > ini_set("memory_limit",-1); > command? > > It doesn't work in my script... > > regards > Joerg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set doesn't work
Mukasa Assey Alfred wrote: > Try ini_set(memory_limit, "-1"); Maybe the quotes on "-1" will help, but memory_limit should also have quotes. > On Wed, 8 Dec 2004, Joerg P wrote: > >> hello, >> >> what do I have to change in php.ini, to allow thr >> ini_set("memory_limit",-1); >> command? >> >> It doesn't work in my script... Can you define "doesn't work" a bit better? Do you get an error message from ini_set? Are you building an 8 Meg object and then get an error message? What? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set doesn't work
Try ini_set(memory_limit, "-1"); regards Assey On Wed, 8 Dec 2004, Joerg P wrote: > hello, > > what do I have to change in php.ini, to allow thr > ini_set("memory_limit",-1); > command? > > It doesn't work in my script... > > regards > Joerg > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set doesn't work
hello, what do I have to change in php.ini, to allow thr ini_set("memory_limit",-1); command? It doesn't work in my script... regards Joerg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('include_path') and require_once()
BigSmoke wrote: Hi, In the following code, require_once() borks, complaining: "Failed opening required 'includes/companies.php' (include_path='.:..')" """ ini_set("include_path", "../../php"); require_once('includes/common.php'); require_once('includes/validate.php'); require_once('includes/company.php'); require_once('includes/companies.php'); """ Try setting it to the full path. ini_set ( "include_path", "/path/from/root/php" ); -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('include_path') and require_once()
The error message hints that something is wrong with your include path. "(include_path='.:..')" Also, when you say `ini_set("include_path", "../../php")` you are overwriting the entire include path rather than appending your path to it. Try this: I would use the full system path rather than a relative path. Using "echo get_include_path()" should give you an idea what's going on. http://www.php.net/manual/en/function.set-include-path.php Jim Grill - Original Message - From: "BigSmoke" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 26, 2004 6:56 AM Subject: [PHP] ini_set('include_path') and require_once() > Hi, > > In the following code, require_once() borks, complaining: > "Failed opening required 'includes/companies.php' (include_path='.:..')" > > """ > ini_set("include_path", "../../php"); > > require_once('includes/common.php'); > require_once('includes/validate.php'); > require_once('includes/company.php'); > require_once('includes/companies.php'); > """ > > The strange thing is: I have other code where this same method _does_ > appear to work. Anyone care to enlighten me? > > I'm using PHP 4.3.8. > > >BigSmoke >Smokes your problems, coughs fresh air > > PS: I was not sure in which newsgroups to (cross-)post this. > I thought, it might be better fit for php.version4, but, since > I wasn't sure, I decided on php.general. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('include_path') and require_once()
Hi, In the following code, require_once() borks, complaining: "Failed opening required 'includes/companies.php' (include_path='.:..')" """ ini_set("include_path", "../../php"); require_once('includes/common.php'); require_once('includes/validate.php'); require_once('includes/company.php'); require_once('includes/companies.php'); """ The strange thing is: I have other code where this same method _does_ appear to work. Anyone care to enlighten me? I'm using PHP 4.3.8. BigSmoke Smokes your problems, coughs fresh air PS: I was not sure in which newsgroups to (cross-)post this. I thought, it might be better fit for php.version4, but, since I wasn't sure, I decided on php.general. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ini_set with mutiple include directories
On Tue, 2003-06-17 at 12:08, Mike Morton wrote: > I have an application that I set the include directory using the ini_set > (the application assumes that the client does not have access to the php.ini > files). > > I can set the first include path of course: > ini_set("include_path","/Library/WebServer/Documents/includes"); > > But how do I set additional paths like in the ini file? If I try to do > another ini set, then it replaces the initial one, and I cannot seem to find > any way to set more than one path in the initial ini_set above > > Does anyone know how this can be done? Thanks :) Separate the paths with semicolons or colons depending on your OS. You can also check existing values using ini_get() and modify based on that. I like to use something like the following: Hope this helps, Torben -- Torben Wilson <[EMAIL PROTECTED]>+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ini_set with mutiple include directories
Ah ha - the semi colon does not work - but colon does - thanks Jason! On 6/17/03 5:04 PM, "Jason Wong" <[EMAIL PROTECTED]> wrote: > On Wednesday 18 June 2003 03:08, Mike Morton wrote: >> I have an application that I set the include directory using the ini_set >> (the application assumes that the client does not have access to the >> php.ini files). >> >> I can set the first include path of course: >> ini_set("include_path","/Library/WebServer/Documents/includes"); >> >> But how do I set additional paths like in the ini file? If I try to do >> another ini set, then it replaces the initial one, and I cannot seem to >> find any way to set more than one path in the initial ini_set above > > Separate multiple directories with a semi-colon? -- Cheers Mike Morton * * Tel: 905-465-1263 * Email: [EMAIL PROTECTED] * "Indeed, it would not be an exaggeration to describe the history of the computer industry for the past decade as a massive effort to keep up with Apple." - Byte Magazine Given infinite time, 100 monkeys could type out the complete works of Shakespeare. Win 98 source code? Eight monkeys, five minutes. -- NullGrey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ini_set with mutiple include directories
On Wednesday 18 June 2003 03:08, Mike Morton wrote: > I have an application that I set the include directory using the ini_set > (the application assumes that the client does not have access to the > php.ini files). > > I can set the first include path of course: > ini_set("include_path","/Library/WebServer/Documents/includes"); > > But how do I set additional paths like in the ini file? If I try to do > another ini set, then it replaces the initial one, and I cannot seem to > find any way to set more than one path in the initial ini_set above Separate multiple directories with a semi-colon? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The greatest productive force is human selfishness. -- Robert Heinlein */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ini_set with mutiple include directories
I have an application that I set the include directory using the ini_set (the application assumes that the client does not have access to the php.ini files). I can set the first include path of course: ini_set("include_path","/Library/WebServer/Documents/includes"); But how do I set additional paths like in the ini file? If I try to do another ini set, then it replaces the initial one, and I cannot seem to find any way to set more than one path in the initial ini_set above Does anyone know how this can be done? Thanks :) -- Cheers Mike Morton * * Tel: 905-465-1263 * Email: [EMAIL PROTECTED] * "Indeed, it would not be an exaggeration to describe the history of the computer industry for the past decade as a massive effort to keep up with Apple." - Byte Magazine Given infinite time, 100 monkeys could type out the complete works of Shakespeare. Win 98 source code? Eight monkeys, five minutes. -- NullGrey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set question
ini_set doesn't seem to work for me. I am trying with: ini_set("display_errors","Off"); The manual says this one should be able to be set this way. I have tried it with all combinations of " and " and with Off or 0. It doesn't give an error, but it has no effect either. I can set it to off in php.ini and it works. But not this way. I know there is another function that does this. I'm not concerned with this particular setting; I'm wanting to learn how to use ini_set in general. I am using this particular setting to change because the manual says ini_set can change this and because this one has an effect that it is easy for me to see. I have a statement that throws a notice. The notice should not appear if this setting was actually changed to off. Am I not understanding how this is supposed to work? Or is there some other setting that needs to change to make ini_set work? Any suggestions? TIA Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set()
Hello, I was doing some fooling around with the ini_set() function and noticed that my scripts stopped functioning altogether (produced blank output). Furthermore, I checked to make sure we actually used a php.ini file and found that we do not. My question is: When using ini_set() without a php.ini file being present does it set all the wouldbe php.ini settings to nothing, making previously relied upon settings non-existent? Some of things I was trying are below: ini_set('include_path', '.:..:../..:' . DIR_WS_INCLUDES); tug_error_reporting(PHP_ERROR_REPORTING_LEVEL); tug_ini_set('error_log', FILENAME_PHP_ERROR_LOG); tug_ini_set('log_errors', PHP_LOG_ERRORS); tug_ini_set('display_errors', PHP_DISPLAY_ERRORS); tug_ini_set('track_errors', PHP_TRACK_ERRORS); Please CC to my email address as I only receive this list in digest. Thanks! Jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
master is the top-level default value set in either your php.ini if you have that file and have a specific value set, or ir not it is the PHP default for the config value. The local is the per-request setting set either in httpd.conf, .htaccess or locally in the script. On Mon, 8 Jul 2002, Philip Olson wrote: > Hello Rasmus- > > How do you suggest ini_set() document these differences? Maybe > the table at ini_set() could use another column, for descriptions > and notes. Also, could you give a concise description for the > differences between local and master values? > > Regards, > Philip Olson > > > > > On Mon, 8 Jul 2002, Rasmus Lerdorf wrote: > > > Well, you can set it at runtime, it just won't do what you might expect. > > That doesn't mean that it may not be useful to be able to set it at > > runtime. If, for example, you have register_globals off and you write an > > auto-prepend script, or even just a normal snippet of code that you insert > > into some other app at the beginning that emulates register_globals, then > > you may want to set register_globals = on at runtime so that any > > subsequent checks by the app will behave correctly. > > > > -Rasmus > > > > On Mon, 8 Jul 2002, Philip Olson wrote: > > > > > > > > You cannot set register_globals at runtime via > > > ini_set(). The documentation goes off the PHP4 > > > source which is, to put it simply, a little wrong. > > > The PHP4 source says register_globals is PHP_INI_ALL > > > when in the real world it isn't. .htaccess > > > is as close as you'll get. > > > > > > The ini_set() docs are autogenerated and this issue > > > is being looked into. The correct docs on this are > > > now in phpdoc CVS and will show up soon. > > > > > > In short, don't attempt to set register_globals > > > at runtime as explained by a few in this thread, > > > it won't fully work as expected. > > > > > > Regards, > > > Philip Olson > > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Hello Rasmus- How do you suggest ini_set() document these differences? Maybe the table at ini_set() could use another column, for descriptions and notes. Also, could you give a concise description for the differences between local and master values? Regards, Philip Olson On Mon, 8 Jul 2002, Rasmus Lerdorf wrote: > Well, you can set it at runtime, it just won't do what you might expect. > That doesn't mean that it may not be useful to be able to set it at > runtime. If, for example, you have register_globals off and you write an > auto-prepend script, or even just a normal snippet of code that you insert > into some other app at the beginning that emulates register_globals, then > you may want to set register_globals = on at runtime so that any > subsequent checks by the app will behave correctly. > > -Rasmus > > On Mon, 8 Jul 2002, Philip Olson wrote: > > > > > You cannot set register_globals at runtime via > > ini_set(). The documentation goes off the PHP4 > > source which is, to put it simply, a little wrong. > > The PHP4 source says register_globals is PHP_INI_ALL > > when in the real world it isn't. .htaccess > > is as close as you'll get. > > > > The ini_set() docs are autogenerated and this issue > > is being looked into. The correct docs on this are > > now in phpdoc CVS and will show up soon. > > > > In short, don't attempt to set register_globals > > at runtime as explained by a few in this thread, > > it won't fully work as expected. > > > > Regards, > > Philip Olson > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Well, you can set it at runtime, it just won't do what you might expect. That doesn't mean that it may not be useful to be able to set it at runtime. If, for example, you have register_globals off and you write an auto-prepend script, or even just a normal snippet of code that you insert into some other app at the beginning that emulates register_globals, then you may want to set register_globals = on at runtime so that any subsequent checks by the app will behave correctly. -Rasmus On Mon, 8 Jul 2002, Philip Olson wrote: > > You cannot set register_globals at runtime via > ini_set(). The documentation goes off the PHP4 > source which is, to put it simply, a little wrong. > The PHP4 source says register_globals is PHP_INI_ALL > when in the real world it isn't. .htaccess > is as close as you'll get. > > The ini_set() docs are autogenerated and this issue > is being looked into. The correct docs on this are > now in phpdoc CVS and will show up soon. > > In short, don't attempt to set register_globals > at runtime as explained by a few in this thread, > it won't fully work as expected. > > Regards, > Philip Olson > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
You cannot set register_globals at runtime via ini_set(). The documentation goes off the PHP4 source which is, to put it simply, a little wrong. The PHP4 source says register_globals is PHP_INI_ALL when in the real world it isn't. .htaccess is as close as you'll get. The ini_set() docs are autogenerated and this issue is being looked into. The correct docs on this are now in phpdoc CVS and will show up soon. In short, don't attempt to set register_globals at runtime as explained by a few in this thread, it won't fully work as expected. Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Hi Even with the correct spelling it returns null (php-4.2.1) $x = ini_get('register_globals'); echo "current settings = ".$x.""; Tom At 12:43 PM 8/07/2002 +0800, Jason Wong wrote: >Tom Rogers said: > > Hi > > If you check with phpinfo() you will see that it is getting set to 1 or > > 0 but by the time your script is run it is too late for it to have any > > effect. > >I just checked with an old PHP manual (probably 4.1.X) and >register_globals can only be set in PHP_INI_PERDIR & PHP_INI_SYSTEM, ie >cannot be set at run-time. So either they changed the behaviour in 4.2.X, >or the latest manual is wrong. > > > Also ini_get('registar_globals') will not return the current > > state. > >No, but ini_get('register_globals') will :) > > > I have no idea why, it looks like one of those undocumented > > safety features... Tom > >However, in the one instance where I used it, it returned 'Off'. My guess >is that it returns whatever was defined in php.ini. Thus if in php.ini you >had defined register_globals = 1, then ini_get('register_globals') returns >1. > >It would be much better and less confusing if ini_get() returns values in >a consistent notation, eg for booleans it should either return (0/1) OR >(false/true). > >Another gotcha that I've come across is when setting register_globals (may >or may not apply to other settings) in the apache conf file. > >This does NOT work: > php_value register_globals On > >Whereas this does work: > php_value register_globals 1 > > >-- >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Tom Rogers said: > Hi > If you check with phpinfo() you will see that it is getting set to 1 or > 0 but by the time your script is run it is too late for it to have any > effect. I just checked with an old PHP manual (probably 4.1.X) and register_globals can only be set in PHP_INI_PERDIR & PHP_INI_SYSTEM, ie cannot be set at run-time. So either they changed the behaviour in 4.2.X, or the latest manual is wrong. > Also ini_get('registar_globals') will not return the current > state. No, but ini_get('register_globals') will :) > I have no idea why, it looks like one of those undocumented > safety features... Tom However, in the one instance where I used it, it returned 'Off'. My guess is that it returns whatever was defined in php.ini. Thus if in php.ini you had defined register_globals = 1, then ini_get('register_globals') returns 1. It would be much better and less confusing if ini_get() returns values in a consistent notation, eg for booleans it should either return (0/1) OR (false/true). Another gotcha that I've come across is when setting register_globals (may or may not apply to other settings) in the apache conf file. This does NOT work: php_value register_globals On Whereas this does work: php_value register_globals 1 -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Hi If you check with phpinfo() you will see that it is getting set to 1 or 0 but by the time your script is run it is too late for it to have any effect. Also ini_get('registar_globals') will not return the current state. I have no idea why, it looks like one of those undocumented safety features... Tom At 10:50 PM 7/07/2002 -0500, Greg Donald wrote: >On Sun, 7 Jul 2002, Chris Shiflett wrote: > > >I refer you to this URL: > > > >http://www.tuxedo.org/~esr/faqs/smart-questions.html > >I refer you to this URL: http://php.net/ini_set and ask why does this >function not work as per the manual? > >Again, here is my code: > >if(ini_set("register_globals", "0")) > echo "ini_set success"; >else > echo "ini_set failed"; >?> > > >-- >--- >Greg Donald >http://destiney.com/public.key >--- > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Mon, 8 Jul 2002, Jason Wong wrote: > if (ini_set("register_globals", "0") !== FALSE) > echo "ini_set success"; > else > echo "ini_set failed"; >?> Finally someone interested in helping find my error. Thanks alot! -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Greg Donald wrote: >On Sun, 7 Jul 2002, Chris Shiflett wrote: > >>I refer you to this URL: >> >>http://www.tuxedo.org/~esr/faqs/smart-questions.html >> >> > >I refer you to this URL: http://php.net/ini_set and ask why does this >function not work as per the manual? > >Again, here is my code: > >if(ini_set("register_globals", "0")) > echo "ini_set success"; >else > echo "ini_set failed"; >?> > Why should I help you when you can't: 1. Follow simple instructions 2. Treat others who have tried to help you with respect. Suffice it to say that ini_set() is not broken; your logic above is. Behave like an adult, and I might explain more. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Greg Donald wrote: > On Sun, 7 Jul 2002, Miguel Cruz wrote: >>> >> if(ini_set("register_globals", "0")) >>> echo "ini_set success"; >>> else >>> echo "ini_set failed"; >>> ?> >> >> Please don't say "this code doesn't work." Say why you think it didn't >> work, whether that's because you received an error message, or a >> specific > > Uhh.. I don't have any thoughts as to why it doesn't work, that's why I > posted. The function itself appears broken, my code is a test to that > notion. I can see where my wording was ambiguous. By "why you think it didn't work", I don't mean "the explanation for its failure to function", but rather "the experience you had that convinced you it was not working". Obviously something happened to make you decide that it wasn't working. We need to know what that was. Maybe it was an error message. Maybe it was a plume of smoke rising from your computer. Maybe it was some sort of weird behavior of your program. It's just a general thing: We can't read your mind. Or at least I can't. > If you can't be helpful then feel free to shutup.. Well, I did go on to answer your question. It could've been worse. >>> So does anyone know why my code doesn't work then? ini_set() seems >>> broken. Can anyone confirm or deny? >> >> I believe the issue here is that by the time your PHP code starts >> executing and gets to the ini_set call, it's too late to register the > > "gets to the ini_set call" - what do you mean? The code I posted is all > there is to the entire script. Where else would I use the ini_set() > function except at the very beginning of a script? Before your code starts, there is a whole bunch of initialization that takes place in the script engine. It looks at its settings to see how it should behave. It gathers all the data that came from the web server (details about the user's request, etc.). It learns about its environment. It populates global variables. Having done these, it starts looking at your code. By this time it's too late to change the way those prior steps were taken. It's like waiting until the plane has taken off (i.e., execution of your code has begun) and then telling the flight attendant you wished it were headed to Chicago instead of Detroit. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Greg Donald said: > On Sun, 7 Jul 2002, Miguel Cruz wrote: > >>> >> if(ini_set("register_globals", "0")) >>> echo "ini_set success"; >>> else >>> echo "ini_set failed"; >>> ?> >> >>Please don't say "this code doesn't work." Say why you think it didn't >> work, whether that's because you received an error message, or a >> specific > > Uhh.. I don't have any thoughts as to why it doesn't work, that's why I > posted. Even if you don't know _why_ it didn't work, you could at least state what you _expected_ to see and what you _actually_ saw. > The function itself appears broken, my code is a test to that > notion. If you can't be helpful then feel free to shutup.. It would be helpful on your part if you had stated your problem clearly. >>expected outcome was not realized, or whatever. Otherwise it doesn't >> really tell us anything. Obviously it doesn't work or you wouldn't be >> posting it. Absolutely. > Yes, the obvious is always pretty easy to restate. If you need more > explanation than the code itself I don't knwo what to tell you. Again, what you expected to happen, and what actually happened are usually a good starting points. >>> At http://php.net/ini_set it states the following setting is >>> possible: >>> >>> register_globals "0" PHP_INI_ALL >>> >>> Translated, PHP_INI_ALL means: Entry can be set anywhere I'm not sure about this, but I don't think it was possible in previous versions PHP. >>> So does anyone know why my code doesn't work then? ini_set() seems >>> broken. Can anyone confirm or deny? >> >>I believe the issue here is that by the time your PHP code starts >> executing and gets to the ini_set call, it's too late to register the > "gets to the ini_set call" - what do you mean? The code I posted is all > there is to the entire script. Where else would I use the ini_set() > function except at the very beginning of a script? Because PHP registers the globals etc (if enabled) then starts working on your code. Anyway, regardless of whether or not it is possible to set register_globals at run-time, your code would be better re-written as: Because, if you RTFM, ini_set() will return the existing value of whatever you're setting. Thus if register_globals was already disabled then your original code would return "ini_set failed" everytime. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Chris Shiflett wrote: >I refer you to this URL: > >http://www.tuxedo.org/~esr/faqs/smart-questions.html I refer you to this URL: http://php.net/ini_set and ask why does this function not work as per the manual? Again, here is my code: -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set() broken?
On Mon, 8 Jul 2002, Martin Towell wrote: >>> >> if(ini_set("register_globals", "0")) >>> echo "ini_set success"; >>> else >>> echo "ini_set failed"; >>> ?> > >I haven't tried this code Then why comment on it? >but I assume you're trying to say that "ini_set >failed" is displayed, but you're expecting the other output to be displayed. >Am I correct there? Yes, is it not obvious enough from just reading the code? I am showing that the ini_set() function is not working properly, as per the manual. The manual states that ini_set() returns the old value on success and FALSE on failure. My script always returns false. Any idea why? >What happens if you use http://localhost/file.php?var=something or whatever >your test script's path is and have this line at the end of the script > echo "var = |$var|"; What does this prove or disprove in relation to the ini_set() function? If you knew anything about the function then you would see I am passing it a big fat zero in the second parameter, just as the manual states I can. I also tried "Off" and "off", same results. >does $var contain anything. If it doesn't, then ini_set() worked... >otherwise.. um... find other way of doing it(??) Yes.. another way, any suggestions? -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
Greg Donald wrote: >If you can't be helpful then feel free to shutup.. > Please don't attack people who freely give their time to try and help you. Mr. Cruz did not ridicule you in any way but merely asked that you be more specific than, "it doesn't work," which is very good advice and a sincere attempt at helping you solve your problem. I can vouch that participating on this list and attempting to give helpful answers takes a great deal of time and there is absolutely no benefit, so try to be more respectful. I refer you to this URL: http://www.tuxedo.org/~esr/faqs/smart-questions.html Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Miguel Cruz wrote: >> > if(ini_set("register_globals", "0")) >> echo "ini_set success"; >> else >> echo "ini_set failed"; >> ?> [snip] I haven't tried this code, but I assume you're trying to say that "ini_set failed" is displayed, but you're expecting the other output to be displayed. Am I correct there? What happens if you use http://localhost/file.php?var=something or whatever your test script's path is and have this line at the end of the script echo "var = |$var|"; does $var contain anything. If it doesn't, then ini_set() worked... otherwise.. um... find other way of doing it(??) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Miguel Cruz wrote: >> > if(ini_set("register_globals", "0")) >> echo "ini_set success"; >> else >> echo "ini_set failed"; >> ?> > >Please don't say "this code doesn't work." Say why you think it didn't >work, whether that's because you received an error message, or a specific Uhh.. I don't have any thoughts as to why it doesn't work, that's why I posted. The function itself appears broken, my code is a test to that notion. If you can't be helpful then feel free to shutup.. >expected outcome was not realized, or whatever. Otherwise it doesn't >really tell us anything. Obviously it doesn't work or you wouldn't be >posting it. Yes, the obvious is always pretty easy to restate. If you need more explanation than the code itself I don't knwo what to tell you. >> At http://php.net/ini_set it states the following setting is possible: >> >> register_globals "0" PHP_INI_ALL >> >> Translated, PHP_INI_ALL means: Entry can be set anywhere >> >> So does anyone know why my code doesn't work then? ini_set() seems >> broken. Can anyone confirm or deny? > >I believe the issue here is that by the time your PHP code starts >executing and gets to the ini_set call, it's too late to register the "gets to the ini_set call" - what do you mean? The code I posted is all there is to the entire script. Where else would I use the ini_set() function except at the very beginning of a script? >globals (which must happen before execution begins). Therefore I'd suggest >looking into .htaccess or whatever the IIS equivalent is. If there's no Thanks but I have no idea about IIS, that's why I posted, to see if this might be an IIS specific issue some other windows users experienced. >equivalent then I'd suggest throwing the server out the window. Yes.. -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set() broken?
On Sun, 7 Jul 2002, Greg Donald wrote: > This code doesn't work: > > if(ini_set("register_globals", "0")) > echo "ini_set success"; > else > echo "ini_set failed"; > ?> Please don't say "this code doesn't work." Say why you think it didn't work, whether that's because you received an error message, or a specific expected outcome was not realized, or whatever. Otherwise it doesn't really tell us anything. Obviously it doesn't work or you wouldn't be posting it. > At http://php.net/ini_set it states the following setting is possible: > > register_globals "0" PHP_INI_ALL > > Translated, PHP_INI_ALL means: Entry can be set anywhere > > So does anyone know why my code doesn't work then? ini_set() seems > broken. Can anyone confirm or deny? I believe the issue here is that by the time your PHP code starts executing and gets to the ini_set call, it's too late to register the globals (which must happen before execution begins). Therefore I'd suggest looking into .htaccess or whatever the IIS equivalent is. If there's no equivalent then I'd suggest throwing the server out the window. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set() broken?
This code doesn't work: At http://php.net/ini_set it states the following setting is possible: register_globals "0" PHP_INI_ALL Translated, PHP_INI_ALL means: Entry can be set anywhere So does anyone know why my code doesn't work then? ini_set() seems broken. Can anyone confirm or deny? I am using PHP 4.2.1 and on this particular project I am moving existing code from a Linux/Apache setup where I developed it, to it's home on a microsoft/iis server. Obviously I do not have access to the php.ini file. Thanks in advance.. :) -- --- Greg Donald http://destiney.com/public.key --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('register_globals',0) doesn't work
Thank you for answer. I didn't expect ini_set('register_globals','Off') to work, that's why I had a look at the documentation. There should be PHP_INI_PERDIR, PHP_INI_SYSTEM but not PHP_INI_ALL in the table (so it's a mistake in the documentation). Anyway it may be possible to use this, if the variables are unset. This is overload of course, because the variables are first set (because of register_globals="On" in php.ini) and are unset if I call ini_set('register_globals','Off'), but this could be a nice "feature", making it easier to work with register_globals="Off" while other old projects still work. Do you consider this a good idea? Does anything except performance speak against doing this manually? Jens > register_globals affects things that happen before PHP parsing begins, so > by the time you get to your ini_set() it is too late. So no, that won't > work. You need to set it in your php.ini, httpd.conf or .htaccess. > > -Rasmus > > On Sun, 26 May 2002, Jens Lehmann wrote: > > > I tested ini_set('register_globals',0) and ini_set('register_globals','Off') > > for turning register_globals off. It doesn't work and it doesn't produce any > > notice, warning or error. > > > > Here's a quick example: > > > > > > > ini_set('register_globals',0); > > > > if(isset($test)) > > echo "$test"; > > > > ?> > > > > > > > > > > > > This prints out $test, what it shouldn't do with register_globals turned > > off. > > I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is > > supposed to work according to the documentation. Can anyone tell > > me what I've done wrong? > > > > For some strange reason if I do > > > > echo ini_set('register_globals',0); > > > > it will print "10". For > > > > echo ini_set('register_globals','Off'); > > > > it will print "1Off". > > > > Jens > > > > PS: ini_set works fine with include_path and error_reporting > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('register_globals',0) doesn't work
register_globals affects things that happen before PHP parsing begins, so by the time you get to your ini_set() it is too late. So no, that won't work. You need to set it in your php.ini, httpd.conf or .htaccess. -Rasmus On Sun, 26 May 2002, Jens Lehmann wrote: > I tested ini_set('register_globals',0) and ini_set('register_globals','Off') > for turning register_globals off. It doesn't work and it doesn't produce any > notice, warning or error. > > Here's a quick example: > > > ini_set('register_globals',0); > > if(isset($test)) > echo "$test"; > > ?> > > > > > > This prints out $test, what it shouldn't do with register_globals turned > off. > I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is > supposed to work according to the documentation. Can anyone tell > me what I've done wrong? > > For some strange reason if I do > > echo ini_set('register_globals',0); > > it will print "10". For > > echo ini_set('register_globals','Off'); > > it will print "1Off". > > Jens > > PS: ini_set works fine with include_path and error_reporting > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('register_globals',0) doesn't work
I tested ini_set('register_globals',0) and ini_set('register_globals','Off') for turning register_globals off. It doesn't work and it doesn't produce any notice, warning or error. Here's a quick example: $test"; ?> This prints out $test, what it shouldn't do with register_globals turned off. I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is supposed to work according to the documentation. Can anyone tell me what I've done wrong? For some strange reason if I do echo ini_set('register_globals',0); it will print "10". For echo ini_set('register_globals','Off'); it will print "1Off". Jens PS: ini_set works fine with include_path and error_reporting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('display_errors',1) not working.
On Thursday 23 May 2002 04:46, Jeff Bearer wrote: > Update, I can see the errors if I make a fatal error. but not if it's a > parse error. in the php.ini I'm using the default error_reporting: > E_ALL & ~E_NOTICE > > I sill have no explanation as to why. The error reporting is for catching run-time errors. Parse errors means your program is totally broken and will not run -- and needs fixing ;-) -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Don't worry. Life's too long. -- Vincent Sardi, Jr. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('display_errors',1) not working.
Update, I can see the errors if I make a fatal error. but not if it's a parse error. in the php.ini I'm using the default error_reporting: E_ALL & ~E_NOTICE I sill have no explanation as to why. On Wed, 2002-05-22 at 11:24, Jeff Bearer wrote: > I have the following in my php.ini file: > > display_errors=Off > log_errors=On > error_log="filename" > > I want to turn on display_errors for developers, I'm attempting to use > ini_set to do this. I made a script like: > > ini_set('display_errors',1); > ini_set('log_errors',0); > ini_set('error_log',null); > > phpinfo(); > ?> > > (I added log_errors and error_log lines in an attempt to get this > working) > > The phpinfo() shows that the local values for the variables I set as I > just set them, and the master values are those of the php.ini file. > Everything looks how I what it. If I add an error: > > echo "asdfadf"asdfa; > > The script behaves as it would in the php.ini, it displays no error and > writes it to the log. Does anybody have any ideas on why this isn't > working? > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('display_errors',1) not working.
I have the following in my php.ini file: display_errors=Off log_errors=On error_log="filename" I want to turn on display_errors for developers, I'm attempting to use ini_set to do this. I made a script like: (I added log_errors and error_log lines in an attempt to get this working) The phpinfo() shows that the local values for the variables I set as I just set them, and the master values are those of the php.ini file. Everything looks how I what it. If I add an error: echo "asdfadf"asdfa; The script behaves as it would in the php.ini, it displays no error and writes it to the log. Does anybody have any ideas on why this isn't working? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set()
I think I remember that thread. Ill track it down tomorrow. Thanks Jason Wong wrote: >On Tuesday 14 May 2002 13:43, Jason Wong wrote: > > > >>>Is there something else I can do so I can have the old scripts work >>>while php is has register_globals off. >>> >>> >>As you're running your own server, set it in php.ini >> >> > >Oops, sorry wrong answer. Correct answer is: you have to manually/explicity >extract all the variables in $HTTP_*_VARS (or the new $_*) into the global >scope. Search archives for details as this was discussed recently (within >last 2 weeks). > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set()
I didn't know about the run-time issue, I guess I didnt see that. Thanks for the heads up... Jason Wong wrote: >On Tuesday 14 May 2002 13:32, Gerard Samuel wrote: > > >>Im running php 4.1.2 on a test box, and Im doing some recoding on an >>application Im writing. >>The new version, I intend be be compliant with php new $_* global arrays. >>But I dont want to waste time redoing the old version, so I tried setting >>ini_set('register_globals', 1); >> >> > >Well if you read the manual you would know that register_globals cannot be set >at run-time. > > > >>at the top of the main config file that all the scripts access (so that >>I can have it around). >>But the scripts are broke even with the ini_set call. >>Is there something else I can do so I can have the old scripts work >>while php is has register_globals off. >> >> > >As you're running your own server, set it in php.ini > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set()
On Tuesday 14 May 2002 13:43, Jason Wong wrote: > > Is there something else I can do so I can have the old scripts work > > while php is has register_globals off. > > As you're running your own server, set it in php.ini Oops, sorry wrong answer. Correct answer is: you have to manually/explicity extract all the variables in $HTTP_*_VARS (or the new $_*) into the global scope. Search archives for details as this was discussed recently (within last 2 weeks). -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "The wages of sin are death; but after they're done taking out taxes, it's just a tired feeling:" */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set()
On Tuesday 14 May 2002 13:32, Gerard Samuel wrote: > Im running php 4.1.2 on a test box, and Im doing some recoding on an > application Im writing. > The new version, I intend be be compliant with php new $_* global arrays. > But I dont want to waste time redoing the old version, so I tried setting > ini_set('register_globals', 1); Well if you read the manual you would know that register_globals cannot be set at run-time. > at the top of the main config file that all the scripts access (so that > I can have it around). > But the scripts are broke even with the ini_set call. > Is there something else I can do so I can have the old scripts work > while php is has register_globals off. As you're running your own server, set it in php.ini -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I came, I saw, I deleted all your files. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set()
Im running php 4.1.2 on a test box, and Im doing some recoding on an application Im writing. The new version, I intend be be compliant with php new $_* global arrays. But I dont want to waste time redoing the old version, so I tried setting ini_set('register_globals', 1); at the top of the main config file that all the scripts access (so that I can have it around). But the scripts are broke even with the ini_set call. Is there something else I can do so I can have the old scripts work while php is has register_globals off. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set doesn't work
>but you'd have to put set_ini() in each of your files (unless you're putting >it in an auto prepended file) Thanks.I haven't explained enough. I have one file included at the beginning of all files. So I only have to write ini_set in that file only once. I really appreciate your answer. thanks. Hiroshi Ayukawa http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set doesn't work
> [snip mail header info] > > Hello, > > >why don't you just do an include "hello.html"; at the end of the file? > > Because, there are so many files. > thanks. > > [snip mail footer info] but you'd have to put set_ini() in each of your files (unless you're putting it in an auto prepended file) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set doesn't work
Hello, >why don't you just do an include "hello.html"; at the end of the file? Because, there are so many files. thanks. Hiroshi Ayukawa http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set doesn't work
why don't you just do an include "hello.html"; at the end of the file? -Original Message- From: Hiroshi Ayukawa [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 11, 2002 2:04 PM To: [EMAIL PROTECTED] Subject: [PHP] ini_set doesn't work Hello, I wnat to set auto_append_file in my own php script not in php.ini. So I used ini_set("auto_append_file","hello.html"); But it doesn't work. Does anyone know about this? environment: Apache + Windows2000 + PHP4.1.2 Apache + TurboLinuxServer7 + PHP4.1.2 Regards, Hiroshi Ayukawa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set doesn't work
Hello, I wnat to set auto_append_file in my own php script not in php.ini. So I used ini_set("auto_append_file","hello.html"); But it doesn't work. Does anyone know about this? environment: Apache + Windows2000 + PHP4.1.2 Apache + TurboLinuxServer7 + PHP4.1.2 Regards, Hiroshi Ayukawa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php