Author Topic: Strange Apache crashes  (Read 2388 times)

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9293
    • View Profile
Strange Apache crashes
« on: October 17, 2018, 05:48:19 PM »
On my dev laptop (Windows), Apache kept crashing instantly upon trying to load Wordpress. This is immediate and sudden, so nothing getting written to access logs or error logs in Apache or PHP.

I quickly figured out that it was crashing when it hit the first require() statement... so down the rabbit hole to that file and the whole string of Russian dolls.

So I added an
echo "Quitting at " . __FILE__ . ":" . __LINE__; die();

And kept moving that down to the bottom of the file and the file was fine. Remove the debug statements and the script executes to the next require() and fails.  Same thing.

At the next block or require statements, I go to all the files and add a space, save, delete the space, save. Everything works until the *next* require statement.

So I think, there's something weird on file permissions or last modified time stamp or something, so I run something to update the last modified to now()... and I'm back where I started.

I do a git checkout live to switch to a known working branch... and I'm still back to crashing instantly.

Haven't solved it yet, but I know it's a problem with that set of WP files, because the Drupal sites on that same server run fine and anything on that site that does not invoke require() runs fine. Since the permission models between Windows and Linux don't really match, I'm wondering if it's something related to pulling the code of Linux, though it has never happened to me before.

Anyway... mostly just venting... so frustrating. I'll re-download all the source files and start from a clean virtual host and see what happens there.

littleman

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Strange Apache crashes
« Reply #1 on: October 17, 2018, 08:32:29 PM »
Post an update if you figure it out.  Really weird that Apache is crashing, can you run a simple PHP script from that same directory and have it work properly?

Say something like this?

Code: [Select]
<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo '<p>Hello World</p>'?>
 </body>
</html>

===============================

Added: reread your post, clearly you are able to have PHP work when you die early, so it is not rejecting PHP outright in that folder....

« Last Edit: October 17, 2018, 08:37:32 PM by littleman »

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9293
    • View Profile
Re: Strange Apache crashes
« Reply #2 on: October 17, 2018, 09:37:00 PM »
Yeah exactly. Never seen anything like it.

It's not PHP that errors out. Apache crashes as soon as it tries to process a require() statement.

So let's say that fileA.php has this

<?php
require('fileB.php');
?>

That will crash. If I open fileB.php and resave a file with the exact same content, Apache won't error out and fileA.php will run fine until it encounters a require('fileC.php') statement and crashes. Open and resave fileC.php and now fileA.php will execute until it encounters fileD.php etc.

Strangest thing.

It took all the time I had to figure out that much. I'll pull a new copy down from the live server and start over... but I tore a lot of hairs out figuring that much out.

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9293
    • View Profile
Re: Strange Apache crashes
« Reply #3 on: October 18, 2018, 05:34:27 AM »
And sure enough - if I pull down a new copy of WP and do a byte-by-byte file compare, the files are all identical... but when I overwrite the existing files with the ones I just downloaded, everything springs to life.

So strange.