[PHP] header function
I am having a hard time with the header("Location:") function inside an include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27). At the VERY TOP of my php page, I have: logincheck.php contains exactly: However, if this "agent_id" is not set, I just get a blank page with html open and close tags. I'm SURE there are no spaces or blank lines before these lines. It works fine if I put the code in the main page instead of using the virtual include. Output buffering is set to 4096 in php.ini. Any suggestions would be appreciated. Thanks, Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function
I have session auto start on. Plus, like I said, it works fine if it's at the top of the page, not in the include file. Thanks, Barry At 05:19 PM 3/7/2003, Jim Lucas wrote: if you put this at the very to of the page, I am guessing then that you haven't ran session_start() ?? if you are trying to access a value stored in a session variable, you need to initialize the session first, then access the variable. Jim - Original Message ----- From: "Barry Gould" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 07, 2003 3:35 PM Subject: [PHP] header function > I am having a hard time with the header("Location:") function inside an > include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27). > > At the VERY TOP of my php page, I have: > > > logincheck.php contains exactly: > // login check > if(!isset($_SESSION["agent_id"])) > { > header("Location:/"); > header("Connection: close"); > exit; > } > ?> > > However, if this "agent_id" is not set, I just get a blank page with html > open and close tags. > > I'm SURE there are no spaces or blank lines before these lines. > > It works fine if I put the code in the main page instead of using the > virtual include. > > Output buffering is set to 4096 in php.ini. > > Any suggestions would be appreciated. > > Thanks, > Barry > > > -- > 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] header function
I'm starting to think this is a BUG. Can anyone else test this and confirm or contradict? Thanks, Barry At 03:35 PM 3/7/2003, you wrote: I am having a hard time with the header("Location:") function inside an include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27). At the VERY TOP of my php page, I have: logincheck.php contains exactly: However, if this "agent_id" is not set, I just get a blank page with html open and close tags. I'm SURE there are no spaces or blank lines before these lines. It works fine if I put the code in the main page instead of using the virtual include. Output buffering is set to 4096 in php.ini. Any suggestions would be appreciated. Thanks, Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header function
AHA! Thank you! Barry At 01:38 PM 3/10/2003, you wrote: Use INCLUDE(), not virtual(). virtual() isn't supposed to be used with PHP files. ---John Holmes... - Original Message - From: "Barry Gould" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 10, 2003 4:26 PM Subject: Re: [PHP] header function > I'm starting to think this is a BUG. > > Can anyone else test this and confirm or contradict? > > Thanks, > Barry > > At 03:35 PM 3/7/2003, you wrote: > >I am having a hard time with the header("Location:") function inside an > >include file with PHP 4.3.1 (Linux, running as a module w/ Apache 1.3.27). > > > >At the VERY TOP of my php page, I have: > > > > > >logincheck.php contains exactly: > > >// login check > >if(!isset($_SESSION["agent_id"])) > >{ > > header("Location:/"); > > header("Connection: close"); > > exit; > >} > >?> > > > >However, if this "agent_id" is not set, I just get a blank page with html > >open and close tags. > > > >I'm SURE there are no spaces or blank lines before these lines. > > > >It works fine if I put the code in the main page instead of using the > >virtual include. > > > >Output buffering is set to 4096 in php.ini. > > > >Any suggestions would be appreciated. > > > >Thanks, > >Barry > > > -- > 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] Problem with PHP and MySQl after install
Yes, the RPM you need in RedHat for php with mysql is called php-mysql. It is a replacement for the php rpm Also, if you install them both (i.e. rpm -Uvh php*) you may not get the correct php.ini file. At 12:39 PM 4/3/2003, you wrote: Don wrote: Further to this point, I've just read that RedHat installed PHP RPM's do not come with MySQL support. Now I've d/l the latest stable version form php.net, version 4.3.1 but I still cannot get MySQL support after compiling and installing. I think that there is more than one rpm. If you do an install of "everything" on RH 8 then you get php 4.2.2-8.0.5 that is compiled with "--with-mysql=shared/usr" and gives mysql 3.23.52. I just checked this on my RH8 box. HTH Chris -- 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] 4.3.1 sessions not expiring / garbage collection not working
Hi, I'm having a problem where session files are not expiring or getting deleted. I'm running RedHat 7.3 (which normally expires sessions fine). I removed the RedHat PHP packages (rpm -e), and compiled and installed PHP 4.3.1 from source. './configure' '--with-mysql' '--with-gd' '--with-zlib-dir=/usr/lib' '--with-apxs=/usr/sbin/apxs' '--with-config-file-path=/etc' I'm using the php.ini-recommended, with ONLY the following changes: display_errors = On session.save_path = /tmp/php session.auto_start = 1 session.entropy_length = 16 session.entropy_file = /dev/urandom Following some documentation I found somewhere on php.net, I have the permissions on /tmp/php equal to 310: >ls -l /tmp d-wx--x---2 apache apache 17408 Apr 3 11:14 php There are hundreds of files in there; many are over 1 week old. I've just tried changing the permissions to 770 (drwxrwx---) and restarting apache; it doesn't seem to be making any difference. apache is apache-1.3.27-2 from RedHat's RPM Any ideas would be appreciated. Thank you, Barry Gould -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4.3.1 sessions not expiring / garbage collection not working
At 01:36 PM 4/3/2003, Ernest Vogelsinger wrote: At 23:25 03.04.2003, Barry Gould said: [snip] >Following some documentation I found somewhere on php.net, I have the >permissions on /tmp/php equal to 310: > >ls -l /tmp >d-wx--x---2 apache apache 17408 Apr 3 11:14 php Check the umask of the apache process - it should be either 022 or 002, allowing rwx for apache (022), or for apache and the apache group (002). It's 022 Check the permissions on the files too, they should be -rw-rw---, or -rw--, at least (best...) They were -rw--, I tried changing them all to -rw-rw-rw-, which has made no difference. Thank you, Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generate all permutations possible? (twist)
just count from 0 to FF in HEX or count from 0 to 16777216 and print each output in HEX I'm sure there's a function for outputting a number in hex. of course, displaying 16million numbers to the browser will be time consuming, to say the least. :P Barry At 03:59 PM 4/3/2003, you wrote: Hi Folks, I'm struggling with a permutation problem. I want to take a set of characters (for example "012345678ABCDEF") and generate all permutations of length N, allowing characters to be repeated. For example, I could use this algorithm to generate all HTML hex colors by passing: generatePermutations("012345678ABCDEF",6) Granted, this example would output some 16,777,215 items, but it would be a handy thing. Note that I could get these color values by running from 0 to FF in hex, but I am looking for something more general so I can play with anagrams, etc. I have seen some algorithms that generate permutations, but I don't want all permutations of "012345678ABCDEF", I just want all 6-digit permutations. I have searched all over for algorithms, and have beat my head against it, but it is just escaping me. Can anyone help? thanks, michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] generate all permutations possible? (twist)
OK. I would probably still go with a counting approach. abc can be represented as 012, so, for all 4-character permutations of abc, you could count in base 3 from 0 to (base 3), and then do zero padding and string substitutions to output as - The only problems I can think of: converting to/from base 3 (you might be able to write a simple algorithm for this) handling large bases > base16 could be tricky. Also, googling for permutation algorithm comes back with lots of results. Most are in C++, but conversion to PHP may be trivial. It looks like some are using loops where one character or position is swapped with another each time. (That is basically a counting algorithm.) you could just stick your alphabet into an array, and then do the "counting" by stepping through the array, with carry... Do you know how to count for any base? It's not hard, but I doubt I can explain it concisely... If you can do that, you can solve this problem easily. if not, see the "accepted answer" at <http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_10352883.html> and convert to PHP. It looks like the STRVector is similar to a standard PHP array. Note this is a stateful algorithm that only outputs a few results at a time; you could modify it to output all results. Be careful how you store the output, as it will get VERY big very quickly. Barry Gould At 05:28 PM 4/3/2003, you wrote: Hi guys, I appreciate your taking interest, but as I wrote, I am looking for a permutation algorithm, not specifically for all the hex colors. That was simply an example of a usage. Put another way, I want a function that I can do: echo generatePerms("abc",4); and it will return aaab aaac aaba aabb aabc and so on It is for some mathematical R&D. Thanks, michael -- 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] re:[PHP] 4.3.1 sessions not expiring / garbage collection not working
Any other ideas on this? Should I submit it to the bug system? Thanks, Barry Date: Thu, 03 Apr 2003 13:25:16 -0800 Hi, I'm having a problem where session files are not expiring or getting deleted. I'm running RedHat 7.3 (which normally expires sessions fine). I removed the RedHat PHP packages (rpm -e), and compiled and installed PHP 4.3.1 from source. './configure' '--with-mysql' '--with-gd' '--with-zlib-dir=/usr/lib' '--with-apxs=/usr/sbin/apxs' '--with-config-file-path=/etc' I'm using the php.ini-recommended, with ONLY the following changes: display_errors = On session.save_path = /tmp/php session.auto_start = 1 session.entropy_length = 16 session.entropy_file = /dev/urandom Following some documentation I found somewhere on php.net, I have the permissions on /tmp/php equal to 310: >ls -l /tmp d-wx--x---2 apache apache 17408 Apr 3 11:14 php There are hundreds of files in there; many are over 1 week old. I've just tried changing the permissions to 770 (drwxrwx---) and restarting apache; it doesn't seem to be making any difference. apache is apache-1.3.27-2 from RedHat's RPM Any ideas would be appreciated. Thank you, Barry Gould -- 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] re:[PHP] 4.3.1 sessions not expiring / garbage collection not working
At 11:20 AM 4/4/2003, CPT John W. Holmes wrote: How much traffic does this site get? Is it possible that the garbage collection is just never triggered? What if you up the garbage collection probability in your php.ini file to 100% (to trigger it with each session start)? Do the files get removed then? AHA! That's it! I thought the default was 1%, which should have been enough as I had several hundred session files there, but it was at 1/1000 or 0.1% Thank you, Barry I'm sure this isn't the problem, but the OS must be able to track the last "access" time of the file in order for garbage collection to work. I'm sure RedHat does that, but I'm just bringing it up. Can you write a simple PHP script to try and delete one of these files? Just a one liner using ulink() would work. You could then see if PHP, running as Apache, has any issues accessing these files. ---John Holmes... - Original Message - From: "Barry Gould" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, April 04, 2003 2:10 PM Subject: [PHP] re:[PHP] 4.3.1 sessions not expiring / garbage collection not working > Any other ideas on this? > Should I submit it to the bug system? > > Thanks, > Barry > > >Date: Thu, 03 Apr 2003 13:25:16 -0800 > > > >Hi, > > > >I'm having a problem where session files are not expiring or getting deleted. > > > >I'm running RedHat 7.3 (which normally expires sessions fine). > >I removed the RedHat PHP packages (rpm -e), and compiled and installed PHP > >4.3.1 from source. > > > > './configure' '--with-mysql' '--with-gd' '--with-zlib-dir=/usr/lib' > > '--with-apxs=/usr/sbin/apxs' '--with-config-file-path=/etc' > > > >I'm using the php.ini-recommended, with ONLY the following changes: > >display_errors = On > >session.save_path = /tmp/php > >session.auto_start = 1 > >session.entropy_length = 16 > >session.entropy_file = /dev/urandom > > > >Following some documentation I found somewhere on php.net, I have the > >permissions on /tmp/php equal to 310: > > >ls -l /tmp > >d-wx--x---2 apache apache 17408 Apr 3 11:14 php > > > >There are hundreds of files in there; many are over 1 week old. > > > >I've just tried changing the permissions to 770 (drwxrwx---) and > >restarting apache; it doesn't seem to be making any difference. > > > >apache is > >apache-1.3.27-2 > >from RedHat's RPM > > > >Any ideas would be appreciated. > > > >Thank you, > >Barry Gould > > > > > >-- > >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 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] Webtrends
Check out Analog and Webalizer. RedHat includes Webalizer... it seems to work fine. Barry Gould At 03:49 PM 4/4/2003, you wrote: I know this is sort of off topic but I was wondering it any one knew if there was a GNU version of Webtrends or perhaps a GNU equivalent, maybe in php to use on an Apache Linux Red Hat server? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php