2

I have several drupal sites running on my local machine with WAMP installed (apache 2.2.17, php 5.3.4, and mysql 5.1.53). Whenever I try to visit the administrative page, the php process seems to die. From apache_error.log:

[Fri Nov 09 10:43:26 2012] [notice] Parent: child process exited with status 255 -- Restarting.
[Fri Nov 09 10:43:26 2012] [notice] Apache/2.2.17 (Win32) PHP/5.3.4 configured -- resuming normal operations
[Fri Nov 09 10:43:26 2012] [notice] Server built: Oct 24 2010 13:33:15
[Fri Nov 09 10:43:26 2012] [notice] Parent: Created child process 9924
[Fri Nov 09 10:43:26 2012] [notice] Child 9924: Child process is running
[Fri Nov 09 10:43:26 2012] [notice] Child 9924: Acquired the start mutex.
[Fri Nov 09 10:43:26 2012] [notice] Child 9924: Starting 64 worker threads.
[Fri Nov 09 10:43:26 2012] [notice] Child 9924: Starting thread to listen on port 80.

Some research has led me to a php bug report on the '4096 byte bug'. I would like to see if I have any files whose filesize is a multiple of 4096 bytes, but I don't know how to do that.

I have gitBash installed and can use most of the typical linux tools through that (find, grep, etc), but I'm not familiar enough with linux to figure it out on my own. Little help?

doub1ejack
  • 537
  • 1
  • 6
  • 12

1 Answers1

4

Since you're on Windows, you can do this with PowerShell

Get-ChildItem C:\PathToTopDirectory -recurse | ForEach-Object {    
  if(($_.length % 4096 -eq 0) -and (! $_.PSIsContainer)) {Write-Host $_.FullName}    
}

What this does is get a list of everything below the path in the Get-ChildItem command and evaluates each object. Since folders have no size, we want to exclude them, that's what -and (! $_.PSIsContainer) does.

Then we just need to see if the file size in bytes (which is the length property, divided by 4096 leaves us with a zero remainder, meaning that the file is a 4096 or a multiple thereof. That's what the $_.length % 4096 -eq 0 block does.

The Write-Host cmdlet will write the output to the command window. You can easily replace this with Out-File c:\stuff.txt if you'd rather have it in a text file.

MDMarra
  • 100,183
  • 32
  • 195
  • 326
  • Cool. I've never used PowerShell though. Can you walk me through running this script? – doub1ejack Nov 09 '12 at 16:44
  • First run `Set-ExecutionPolicy RemoteSigned` from an elevated PowerShell prompt. This will allow you to run PowerShell scripts on that machine. You an elevated PS prompt the same way you get an elevated command prompt. Then, you can save it to a text file, rename it with a `.ps1` extension, and run it by typing in the path to the script. Alternatively, you can just copy and paste this one line at a time into a PowerShell prompt. – MDMarra Nov 09 '12 at 16:45
  • 1
    @MDMarra As long as your PS is well formed (as above) you can paste mulit-line (even entire scripts with functions, etc) into your window. Enable "QuickEdit Mode" in `cmd`'s defaults and the clipboard will past automatically on right-click. – jscott Nov 09 '12 at 17:09
  • sweet. works beautifully - thanks. ..now to see if this bug was actually the root of my troubles :) – doub1ejack Nov 09 '12 at 17:31