[PHP] php.ini setting
I'm trying to set magic quotes Off as my reading tells me that it's not good to have it defaulted to On. My ISP has this setting (from PHPINFO call): magic_quotes_gpc on >From reading the php.net manual I found this line php_flag magic_quotes_gpc on which it says to place in the .htaccess file. I downloaded that file from my server's public_html folder, edited it to put in the above line (which now says "Off") and re-uploaded it. Boom! My server no longer works - I get "Internal Server Error" "The server encountered an internal error or misconfiguration." If I re-edit my .htaccess, remove the line and re-upload, everything works fine. So - what am I mis-interpreting about how to accomplish this task? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini setting
On 11-10-01 11:57 AM, Jim Giner wrote: I'm trying to set magic quotes Off as my reading tells me that it's not good to have it defaulted to On. http://php.net/manual/en/security.magicquotes.disabling.php Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini setting
"Stephen" wrote in message news:4e874606.2030...@rogers.com... >> > http://php.net/manual/en/security.magicquotes.disabling.php > > Stephen That tells me nothing new. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini setting
On Sat, 2011-10-01 at 12:55 -0400, Stephen wrote: > On 11-10-01 11:57 AM, Jim Giner wrote: > > I'm trying to set magic quotes Off as my reading tells me that it's not good > > to have it defaulted to On. > > > > > http://php.net/manual/en/security.magicquotes.disabling.php > > Stephen > Stephen, that page specifies the exact same line for the .htaccess that he said he used. I'm not sure why it would cause an internal server error, but I've seen some Apache configurations completely flake over lines in the .htaccess that were fine elsewhere. The only thing I can find online where this line will cause a server error is where the server is set up to allow custom php.ini files which override the defaults. To test this, try adding a php.ini file into the directory your script is (this is completely untested, I just saw it on a forum (http://www.bluehostforum.com/archive/index.php/t-15975.html )) and enter the regular php.ini line to turn it off. If that fails, I'd try and contact your hosting provider and see what they say, as they probably have more information specific to this problem, as it's most likely a setting of theirs that is causing it. -- Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Variable question
If $correct_answer has a value of 3 what is the correct syntax needed to use echo to display the value of $trivia_answer_3? I know this is incorrect, but along the lines of what I am wanting to do: echo $trivia_answer_$correct_answer; $trivia_answer_1 = “1,000”; $trivia_answer_2 = “1,250”; $trivia_answer_3 = “2,500”; $trivia_answer_4 = “5,000”; Ron www.TheVerseOfTheDay.info
Re: [PHP] php.ini setting
On Oct 1, 2011, at 2:04 PM, Ashley Sheridan wrote: > On Sat, 2011-10-01 at 12:55 -0400, Stephen wrote: > >> On 11-10-01 11:57 AM, Jim Giner wrote: >>> I'm trying to set magic quotes Off as my reading tells me that it's not good >>> to have it defaulted to On. >>> >>> >> http://php.net/manual/en/security.magicquotes.disabling.php >> >> Stephen >> > > > Stephen, that page specifies the exact same line for the .htaccess that > he said he used. I'm not sure why it would cause an internal server > error, but I've seen some Apache configurations completely flake over > lines in the .htaccess that were fine elsewhere. > > The only thing I can find online where this line will cause a server > error is where the server is set up to allow custom php.ini files which > override the defaults. To test this, try adding a php.ini file into the > directory your script is (this is completely untested, I just saw it on > a forum (http://www.bluehostforum.com/archive/index.php/t-15975.html )) > and enter the regular php.ini line to turn it off. > > If that fails, I'd try and contact your hosting provider and see what > they say, as they probably have more information specific to this > problem, as it's most likely a setting of theirs that is causing it. > > -- > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Have you tried: ini_set('magic_quotes_gpc', false); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable question
On Oct 1, 2011, at 1:59 PM, Ron Piggott wrote: > > If $correct_answer has a value of 3 what is the correct syntax needed to use > echo to display the value of $trivia_answer_3? > > I know this is incorrect, but along the lines of what I am wanting to do: > > echo $trivia_answer_$correct_answer; > > $trivia_answer_1 = “1,000”; > $trivia_answer_2 = “1,250”; > $trivia_answer_3 = “2,500”; > $trivia_answer_4 = “5,000”; > > Ron > > > > > www.TheVerseOfTheDay.info Best bet would to toss this into either an object or array for simplification, otherwise that type of syntax would need the use of eval. example: eval('echo $trivia_answer_'.$correct_answer.';'); best bet would be to.. $trivia_answer = array(); $trivia_answer[1] = 1000; $trivia_answer[2] = 1250; $trivia_answer[3] = 2500; $trivia_answer[4] = 5000; echo $trivia_answer[$correct_answer]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini setting
"Mike Mackintosh" wrote in message news:52ea6b9e-ef12-44d3-bd31-72984e5e5...@angrystatic.com... http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable question
On Sat, Oct 1, 2011 at 10:59 AM, Ron Piggott wrote: > If $correct_answer has a value of 3 what is the correct syntax needed to > use echo to display the value of $trivia_answer_3? You can use variable variables [1] to access the variable by building its name in a string: $name = 'trivia_answer_' . $correct_answer; echo $$name; Peace, David [1] http://php.net/manual/en/language.variables.variable.php
Re: [PHP] Variable question
On 11-10-01 02:03 PM, Mike Mackintosh wrote: On Oct 1, 2011, at 1:59 PM, Ron Piggott wrote: If $correct_answer has a value of 3 what is the correct syntax needed to use echo to display the value of $trivia_answer_3? I know this is incorrect, but along the lines of what I am wanting to do: echo $trivia_answer_$correct_answer; $trivia_answer_1 = “1,000”; $trivia_answer_2 = “1,250”; $trivia_answer_3 = “2,500”; $trivia_answer_4 = “5,000”; Ron www.TheVerseOfTheDay.info Best bet would to toss this into either an object or array for simplification, otherwise that type of syntax would need the use of eval. example: eval('echo $trivia_answer_'.$correct_answer.';'); best bet would be to.. $trivia_answer = array(); $trivia_answer[1] = 1000; $trivia_answer[2] = 1250; $trivia_answer[3] = 2500; $trivia_answer[4] = 5000; echo $trivia_answer[$correct_answer]; Agreed the OP's value list isn't optimal, but eval is not needed to address the solution: Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable question
On 01 Oct 2011 at 18:59, Ron Piggott wrote: > If $correct_answer has a value of 3 what is the correct syntax needed to use > echo to display the value of $trivia_answer_3? > > I know this is incorrect, but along the lines of what I am wanting to do: > > echo $trivia_answer_$correct_answer; > > $trivia_answer_1 = “1,000”; > $trivia_answer_2 = “1,250”; > $trivia_answer_3 = “2,500”; > $trivia_answer_4 = “5,000”; Not completely obvious to me what you're trying to do but I assume its: echo '\$trivia_answer_' . $correct_answer . " = \"" . $somevalue . "\";"; -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting meta data (of any type) for an XML file being from it's URL.
On Fri, Sep 30, 2011 at 3:03 AM, Richard Quadling wrote: > On 29 September 2011 23:34, Tommy Pham wrote: > > On Thu, Sep 29, 2011 at 3:27 PM, Tommy Pham wrote: > >> > >> On Thu, Sep 29, 2011 at 9:09 AM, Richard Quadling > >> wrote: > >>> > >>> Hi. > >>> > >>> I'm looking to process very large XML files without the need of first > >>> downloading them. > >>> > >>> To that end, > >>> SimpleXMLIterator('compress.zlib://http://www.site.com/products.xml.gz > ') > >>> is working perfectly. > >>> > >>> But a downside is that I have no information of my progress. > >>> > >>> Is there any mechanism available to get a position within the XML > stream? > >>> > >>> I can use libxml_set_streams_context() to set a context (so I can > >>> provide POST data if needed for the HTTP request), but I can't see how > >>> to gain access to the stream within the libxml code (SimpleXML uses > >>> libxml). > >>> > >>> At the most basic, what I'm looking for is to be able to record a > >>> percentage complete. Even with compression, I'll be reading some bytes > >>> from a stream (either from http or from compress.zlib) and I want to > >>> know where I am in that stream. > >>> > >>> The HTTP header will tell me how big the file is (so that can easily > >>> be a HEAD request to get that data). > >>> > >>> > >>> Even if I DO save the file locally first, I still can't get a position. > >>> > >>> If I use the SimpleXMLIterator::count() method, I am unsure as to what > >>> will happen if I am using a stream (rather than a local file). If I > >>> use ... > >>> > >>> $xml = new SimpleXMLIterator(...); > >>> $items = $xml->count(); > >>> foreach($xml as $s_Tag => $o_Item) { > >>> ... > >>> } > >>> > >>> will the XML file be cached somewhere? Or will that depend upon the > >>> originating server supporting some sort of rewind/chunk mechanism? > >>> > >>> > >>> > >>> Any suggestions/ideas? > >>> > >>> > >>> > >>> Richard. > >>> > >>> > >>> -- > >>> Richard Quadling > >>> Twitter : EE : Zend : PHPDoc > >>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea > >>> > >> > >> Richard, > >> > >> Only think I can think of is break up into 2 parts. 1st part use cURL > for > >> the down streams and monitor it's progress. 2nd part is XML parsing. > If > >> you want to do both simultaneously and only if the remote supports > chunked > >> encoding/transfer, you could use multiple handles of cURL into numerical > >> indexed array variable containing the chunks for XML parsing. This > could be > >> memory intensive if the file is very large, depending whether you free > the > >> elements in the array as you progress. So if memory consumption is a > major > >> concern, you may want to save to the file locally until the > import/migration > >> is done as there maybe a situation where you'll need to review the data > and, > >> thus, saving the time and bandwidth of having to re-download the data. > >> > >> Regards, > >> Tommy > > > > An afterthought, handling streams and parsing at the same may require > > sophisticated XML node validations as the node maybe split between the > > transferred chunks. > > > > The SimpleXMLIterator() does do a superb job of providing 1 node at a > time and doesn't remember each node automatically. If I do, then > that's my issue. > > Accessing the stream/file meta data doesn't seem possible. > > > -- > Richard Quadling > Twitter : EE : Zend : PHPDoc > @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea > A while back, I did a project in Java where parts of it had to access and process streams. I guess this would be a really good exercise for me to see if it's doable in PHP also. In addition to implement 'PHP simulating threads', in this scenario, where 1 thread would download and monitor the streams while another thread would analyze/process the data and import into a database.
Re: [PHP] php.ini setting
Solved. Had to have my host provider put a copy of php.ini in my public_html and then I made the magic quotes setting change. Interesting - running a phpinfo command still shows the setting as On becuase it returns the server's settigns, NOT my individual folder setting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable question
On Sat, 1 Oct 2011, Mike Mackintosh wrote: Best bet would to toss this into either an object or array for simplification, otherwise that type of syntax would need the use of eval. example: eval('echo $trivia_answer_'.$correct_answer.';'); You could do: $var = "trivia_answer_.$correct_answer"; echo $$var; But I agree that an array would be simpler. best bet would be to.. $trivia_answer = array(); $trivia_answer[1] = 1000; $trivia_answer[2] = 1250; $trivia_answer[3] = 2500; $trivia_answer[4] = 5000; echo $trivia_answer[$correct_answer]; You can define this a bit more simply: $trivia_answer = array ( 1 => 1000, 2 => 1250, 3 => 2500, 4 => 5000 ); You can do it even more simply by just giving the values, but indexes wil start at 0: Array ( [0] => 1000 [1] => 1250 [2] => 2500 [3] => 5000 ) While manually defining an array like this is only slightly less tedius than using 4 numbered variables, it's a lot easier to do if you're getting data from somewhere else (e.g. a database of trivia questions). To use the original way proposed, you'd have to keep constructing variable names, which arrays avoid quite nicely. In my opinion, the only real usefulness for a syntax like $$var (above) is if you want to do something with a bunch of variables in one go. For example: foreach (array ("title", "artist", "album", "label") as $field) echo ucwords($field) . ': ' . $$field . ''; The above comes from a function which manages only a single record, so no real need to use an array. I could of course, e.g. record['title'] etc, but I don't see much could be gained unless I needed to be able to manage an entire record as a single unit. Geoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php