DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • May 19, 2013, 01:06:07 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: 1 [2] 3   Go Down
  Print  
Author Topic: Strange redirect() problem  (Read 1049 times)
0 Members and 1 Guest are viewing this topic.
Loscil Derails
Militia
**
Offline Offline

Posts: 51



View Profile
« Reply #15 on: August 04, 2012, 12:13:25 PM »

OS= operating system (of the server running)

Ahhh. Linux.

If you have command line access to your server (and if it's linux), I suggest running
grep -r "posting.php" *
from the home directory of your install. You can see which file is making a call to that file.

I can't seem to find this command line access in my cPanel.. o.o

Did you install any modules or make any changes between when it was working and when it wasn't?

I'm not exactly sure when it stopped working, actually. It's been happening for a while, and I've only kept a changelog of the stuff I've done over the past 2 (or so) weeks.
Your web hosting provider would have probably advertised as "ssh access" Or "shell" access or something like that. Hm. I'm not aware of another way to mass-search files without grepping from a command line

Well, alternatively you could download your whole game directory and search it locally on your computer
Logged

Your specimen is being processed...
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #16 on: August 05, 2012, 05:50:36 PM »

Your web hosting provider would have probably advertised as "ssh access" Or "shell" access or something like that. Hm. I'm not aware of another way to mass-search files without grepping from a command line

Well, alternatively you could download your whole game directory and search it locally on your computer

I've only recently aquired access to SSH Access, and still dunno how to use it properly. I also downloaded my game directory (as I do backups of it every wekk), and still can't find anything to do with any posting.php.

However, I noticed this:
Redirect works perfectly for anything that does not involve a MySQl query. To elaborate, if I have a link that redirects elsewhere immediately, and that's all it does, it works as it's meant to.
IF, however, I have a redirect after something is inserted into the database (e.g. a line of commentary, as with the Petition Extension module), only then does it send me to a white-page. (Just FYI, the insert into the database could be anything, not just the commentary.)

* Edit: Just another FYI, it seems to only happen with inserting things into the database. I have a module that delete something from the database, then redirects, and it works perfectly.

I also sent in a ticket to my host, to ask if PHP could be run as a CGI module, but to be able to do that, I have to transfer to some type of VPN hosting, with is three times the cost of what I'm currently paying. x.x
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Nightborn
Captain of the Guard
***
Offline Offline

Posts: 157


View Profile
« Reply #17 on: August 06, 2012, 04:48:56 AM »

You mean as an apache module? =)

though this looks rather strange, indeed.
are you certain the redirecting is the issue, when you say "only when inserting" ? If you only leave out the db_query(); of such a section, it does work?
Logged
Loscil Derails
Militia
**
Offline Offline

Posts: 51



View Profile
« Reply #18 on: August 06, 2012, 06:28:58 AM »

I don't believe redirecting itself is the issue. I believe that exit() is the issue.
However, I'm not sure if the actual /redirect itself/ is what is causing it to fail. Like the actual switching the URL and moving to another page. Although I am faiiirrllly certain that it is exit() since there are some known issues with fastcgi and exit(). Fewer so with pure cgi, which is strange, but... The whole problem in general is interesting. Such as 5.2 fastcgi/cgi working fine for me, but not Aeolus, and such.
It's even hard to debug since it doesn't want to print any error messages-- it just... dies.

There is some discussion here as to exit and fastcgi here. Someone made a suggestion to use: fastcgi_finish_request()
However when I tried using this I got an undefined function issue and couldn't figure out if something was missing an import or what was wrong.

Also, I think that I may have had the same issue as Aeolus in that only pages that have sql queries die. It was interesting, because for instance newday from grotto.php to village.php would die, but newday from forest.php to village.php would work.
« Last Edit: August 06, 2012, 06:32:53 AM by On Rails » Logged

Your specimen is being processed...
Loscil Derails
Militia
**
Offline Offline

Posts: 51



View Profile
« Reply #19 on: August 10, 2012, 04:27:34 PM »

Aeolus: Do you have datacaching enabled? That's the only thing different (aside from the php version) Between my personal server and the host.

Could that be causing some strange issue, perhaps?
Logged

Your specimen is being processed...
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #20 on: August 10, 2012, 08:01:24 PM »

Aeolus: Do you have datacaching enabled? That's the only thing different (aside from the php version) Between my personal server and the host.

Could that be causing some strange issue, perhaps?

Nope. I never understood datacaching, so I thought it'd be safest if I didn't.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Loscil Derails
Militia
**
Offline Offline

Posts: 51



View Profile
« Reply #21 on: August 10, 2012, 08:57:22 PM »

I think I'm going to disable datacaching. It's causing too many undesirable race conditions to be useful.

Anyway, thanks. Now I'm pretty sure that's not it. It's quite the curious error.
Logged

Your specimen is being processed...
Nightborn
Captain of the Guard
***
Offline Offline

Posts: 157


View Profile
« Reply #22 on: August 11, 2012, 12:00:46 AM »

What race conditions?

Only if people program modules and don't invalidate their caches correctly, they are an issue.

w/o caching on a shared host might provoke a kick-out with a few users on at a time due to the high number of sql queries that will be done each page hit. the more module, the more unnecessary queries.

Logged
Loscil Derails
Militia
**
Offline Offline

Posts: 51



View Profile
« Reply #23 on: August 11, 2012, 12:26:40 AM »

The module doesn't do anything really suspicious, it just set its module pref on newday to its current pref minus one
Logged

Your specimen is being processed...
Nightborn
Captain of the Guard
***
Offline Offline

Posts: 157


View Profile
« Reply #24 on: August 11, 2012, 08:14:22 AM »

If you have this problem with every module pref you change through the editor, the editor is probably not invalidating the caches correctly - or somewhere else something goes wrong.

You'd need to debug that - best on a test machine with no users but you:

1. check the content of the datacache file
2. edit the preference in the user editor
3. check if the db now has the right value
4. do 1. again - has the file been deleted? or is it still there?

if 4. equals 1. your invalidation is not working in this specific case.
Logged
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #25 on: August 24, 2012, 05:45:49 AM »

I just noticed something strange. o.o

As you know, whenever my site uses an SQL 'INSERT' query/command, and then attempts to redirect to another page, it white pages.

Except!

System Mail. Whenever I call upon the systemmail function, and then use the redirect function directly after, my site works perfectly. And the systemmail uses an SQL 'INSERT' command. That was the something I thought was strange.

I decided to send in a ticket to the server I use for my site to see if they could do anything about it, and gave them access to an area where the error would occur. They came back saying:

Quote
However looking at the strace from it running the request. I'm seeing nothing that would cause great concern except a high number of the following .

23:29:16.758835 access("prefixes.php", F_OK) = -1 ENOENT (No such file or directory)

Would this ^ have anything to do with redirects not working after an SQL 'INSERT' query?
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Nightborn
Captain of the Guard
***
Offline Offline

Posts: 157


View Profile
« Reply #26 on: August 24, 2012, 06:22:48 AM »

The mentioned quote indicates a missing file.

"prefixes.php" ... is that a necessary file in your (modified?) lotgd version?
If so, it seems not to be able to be accessed for some reason.

White pages -> ask them to turn error display on... way better than stumbling around.
Logged
kickme
Global Moderator
Mod God
*****
Offline Offline

Posts: 1588


Yay for elephants!


View Profile WWW
« Reply #27 on: August 24, 2012, 06:26:35 AM »

prefixes.php is optional and lets you define per-table prefixes.

Something I'd like you to try. In the redirect() method, right before the exit() call, can you add:
Code:
if(headers_sent($file, $line)) echo "Headers already sent in $file on line $line.";
then see if you get any output next time you get a whitescreen.
Logged

Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka
Aeo
Mod God
*****
Offline Offline

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #28 on: August 24, 2012, 06:43:00 AM »

The mentioned quote indicates a missing file.

"prefixes.php" ... is that a necessary file in your (modified?) lotgd version?
If so, it seems not to be able to be accessed for some reason.

I've personally never heard of prefixes.php, and I've barely modified the LotGD coding, except for small areas here and there.

White pages -> ask them to turn error display on... way better than stumbling around.

I'll request this - where exactly would I find this error display?

Something I'd like you to try. In the redirect() method, right before the exit() call, can you add:
Code:
if(headers_sent($file, $line)) echo "Headers already sent in $file on line $line.";
then see if you get any output next time you get a whitescreen.

I did that, and got the following line of text on my white-screen:

Quote
Headers already sent in /home/aeolus/public_html/modules/defaultcolor.php on line 2.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
kickme
Global Moderator
Mod God
*****
Offline Offline

Posts: 1588


Yay for elephants!


View Profile WWW
« Reply #29 on: August 24, 2012, 06:50:14 AM »

Something I'd like you to try. In the redirect() method, right before the exit() call, can you add:
Code:
if(headers_sent($file, $line)) echo "Headers already sent in $file on line $line.";
then see if you get any output next time you get a whitescreen.

I did that, and got the following line of text on my white-screen:

Quote
Headers already sent in /home/aeolus/public_html/modules/defaultcolor.php on line 2.

There's your problem. The defaultcolor module has whitespace outside the opening PHP tag (most likely a new line right at the start of the file, given the line number) that is being output to the browser, so the redirect header can't be sent. Deleting that new line (and any others that cause a similar error) should get redirects working again.
Logged

Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka
Pages: 1 [2] 3   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
27 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search