I am experiencing some odd behavior with Apache. I have several vhosts setup on my local machine. I am currently experiencing this on 1 of the vhosts, as I am doing dev work constantly, however I think it happened on another local site as well.

Here's whats happening:

I go to nekst.local and the page loads fine. I refresh the page constantly to check my updated code. All of a sudden I get a 403 error in the console for all assets but the page loads (minus assets). If I refresh again I get a 403 error in browser rather than a page load. If I restart apache everything works for a while and then all of a sudden it happens again.

I did recently download xdebug and add that to my php.ini. I'm not sure if this may be causing any issues.

I am running apache 2.4.9, php 5.5.14 on osx yosemite

my vhost:

<Directory "/Users/shawn/Documents/work/sites/mindbox/nekst/webapp/web">
   Require all granted
   AllowOverride All
<VirtualHost *:80>
    DocumentRoot "/Users/shawn/Documents/work/sites/mindbox/nekst/webapp/web"
    ServerName nekst.local
    ErrorLog "/Users/shawn/Documents/work/sites/mindbox/nekst/webapp/app/logs/error_log"
    CustomLog "/Users/shawn/Documents/work/sites/mindbox/nekst/webapp/app/logs/access_log" common

and my dir:

drwxr-xr-x  15 shawn  staff     510 Jan 27 10:25 web

Have you tried looking into your error log for more details?

I always run the following command while developing PHP, to be aware of any notices. It may also help you narrow down this issue:

tail --follow=name -n 100 /Users/shawn/Documents/work/sites/mindbox/nekst/webapp/app/logs/error_log

Ctrl-C when done

  • Good call, I should have thought to look at the error log... not sure what the --follow=name was meant to do but didn't work, ran tail -f -n 100 /User.... and eventually got these errors: gist.github.com/shawn-northrop/709b07b074285d3c1308 error is saying: 'failed to open stream too many open files'. Is this a setting I can bump up (and would I want to) in my php.ini? – Shawn Northrop Jan 30 '15 at 17:30
  • I ran the following launchctl limit maxfiles and it returned maxfiles 256 unlimited I'm not sure what a reasonable number for this is. I'm looking into finding out what files are already open. – Shawn Northrop Jan 30 '15 at 17:40
  • To find which files are open, you can use lsof command or look in /proc/$PID/fd However, some things use file handles that are not, in fact, files - such as open TCP sockets. – Dan Armstrong Jan 30 '15 at 18:02
  • and "--follow=name" (leave as 'name', do not put filename there) will reopen the file after a log file rotation. This is convenient for leaving the error file open for days on end. – Dan Armstrong Jan 30 '15 at 18:04
  • 1
    Also, tail -F is the syntax required vs tail --follow=name which gave me an error... atleast on my machine – Shawn Northrop Jan 30 '15 at 19:46

Do you have mod_evasive enabled in apache? I had the same kind of problem and after disabling it, the problem was gone. See here for a guide to tweak values for mod_evasive: http://www.faqforge.com/linux/prevent-dos-attacks-on-apache-webserver-for-debian-linux-with-mod_evasive/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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