Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Background

  • I want to allow my users to submit a crash report which will get emailed to me.

  • I'm using UKCrashReporter with the bundled PHP script I've modified. This code does a POST to a specified URL along with the crash report.

  • I'm on a shared server running Linux. My main domain is synapticmishap.co.uk.

The Problem

  • When I send the crash report off, on the Cocoa side, it reports as having sent it successfully, but I don't receive an email.

  • The code has been used in lots of other well established Cocoa projects and it was working for me a few months ago.

  • That leads me to conclude that the problems are related to my web server setup, something I know almost nothing about.

  • When I look at my log files, I see entries like this:

    IP Redacted - - [10/Jun/2010:09:47:53 +0100] "POST /crashreportform.php HTTP/1.1" 403 74 "-" "UKCrashReporter"

What I've tried

  1. I've tried accessing the page at http://synapticmishap.co.uk/crashreportform.php via a browser. It loads fine.

  2. I've made sure the permissions on this php script are set so anyone can execute it.

  3. I've tried removing the deny entries from the section of .htaccess at various levels starting with root.

  4. I've downloaded the URLParams plugin for Firefox which allows you to simulate POSTs. I put in the URL above and tried a post with "crashlog" as the parameter and "test" as the value. This generated a 200 log entry in my log file - it seemed to work, although no mail message was sent.

Code

I've got the following at http://synapticmishap.co.uk/crashreportform.php. I've simplified it to just the bare bones in an effort to get it working.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Crash Report</title>
</head>
<body>

<p>This page contains super special magic which submits a crash report item to me.</p>
<p>Nothing to see here - move along.</p>

<?php
mail( "john@synapticmishap.co.uk", "Crash Report", "\r\n\r\nThis is a test.");
?>
</body>
</html>

This is my top level .htaccess file:

RewriteEngine on
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
Options All -Indexes

RewriteCond %{HTTP_HOST} ^synapticmishap.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.synapticmishap.co.uk$

RewriteCond %{HTTP_HOST} ^lapsusapp.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.lapsusapp.co.uk$
RewriteRule ^/?$ "http\:\/\/synapticmishap\.co\.uk\/synapticmishap\/lapsuspromo\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^jgtutoring.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.jgtutoring.co.uk$
RewriteRule ^/?$ "http\:\/\/synapticmishap\.co\.uk\/tutoring" [R=301,L]

RewriteCond %{HTTP_HOST} ^synapticmishap.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.synapticmishap.co.uk$
RewriteRule ^/?$ "http\:\/\/synapticmishap\.co\.uk\/synapticmishap" [R=301,L]

RewriteCond %{HTTP_HOST} ^jgediting.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.jgediting.co.uk$
RewriteRule ^/?$ "http\:\/\/synapticmishap\.co\.uk\/editing" [R=301,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://synapticmishap.co.uk/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://synapticmishap.co.uk$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.synapticmishap.co.uk/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.synapticmishap.co.uk$      [NC]
RewriteCond %{HTTP_REFERER} !^http://synapticmishap.co.uk/synapticmishap/crashreportform.php/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://synapticmishap.co.uk/synapticmishap/crashreportform.php$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

The error_log file doesn't seem to have any errors relating this at all. The last few entries are:

[24-May-2010 03:20:21] WordPress database error MySQL server has gone away for query SELECT FOUND_ROWS() made by require, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts
[08-Jun-2010 15:50:04] WordPress database error Duplicate entry '257-1' for key 1 for query INSERT INTO `wp_term_relationships` (`object_id`,`term_taxonomy_id`) VALUES ('257','1') made by wp_xmlrpc_server->wp_xmlrpc_server, IXR_Server->IXR_Server, IXR_Server->serve, IXR_Server->call, wp_xmlrpc_server->mw_editPost, wp_update_post, wp_insert_post, wp_set_post_categories, wp_set_object_terms

Help!

I'm at the end of my tether with this and I'm in a very unfamiliar space with all this web stuff. I'd be most appreciative of any thoughts people had on why this isn't working. Thanks.

UPDATE 1

A couple of test emails I sent off this morning have now come through - 4 hours later. Given the email server is on the same box as the one I'm POSTing too, this doesn't sound right. Plus the error is still being logged. I've just sent off a couple of test emails with crash logs attached. I'll see if these turn up later on in the day and post back.

UPDATE 2

The emails with crash logs never arrived. I've reached the end of the line of what I can try without ploughing endless days into this, time which I just don't have. I've resorted to filing a support ticket with my web hosting provider in desperation to get some kind of fix. This is the only thing I can now think of - that they're stopping certain types of POST. Since I've deleted all PHP code in the file and it's still generating the errors, I think it's something about my POST format or headers that the server doesn't like, rather than the PHP in the scripts. Any other ideas are welcome.

share|improve this question
    
it would help if you showed us the error_log also –  Mike Jun 10 '10 at 12:01
    
Sorry, Mike - totally forgot. The error_log doesn't appear to have anything relevant in it. And there was a huge delay, but the test messages I sent earlier today have just come through so it appears to be "kind of" working, but not with any proper crash reports. Question now updated. –  John Gallagher Jun 10 '10 at 14:12

2 Answers 2

up vote 1 down vote accepted

After much emailing back and forth with my hosting provider, it turns out there were many things going wrong here.

  1. Various security settings were incorrect on their end
  2. I wasn't aware that I had to set permissions on files to be 644 otherwise they wouldn't execute

Plus I'm sure lots more other stuff they didn't go into detail about.

Summary? The problem was indeed on the hosting end and it was stuff I either couldn't do anything about or wasn't aware of.

share|improve this answer

How big is your crash dump? PHP has memory limits that may need to be tweaked so your script can work. The memory limit will have to be large enough for the execution of the script + any uploaded data to fit.

share|improve this answer
    
The HTTP body of the post request I'm sending is 31554 bytes. I'm not convinced this is the issue - this is pretty small and I've had this working before now with the same amount of data as I have now. Still, how do I tweak the memory limit or even find out what it is at now? –  John Gallagher Jun 10 '10 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.