Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Jun 12, 2015 2:13 am 
Offline
Newbie

Joined: Fri Jun 12, 2015 2:06 am
Posts: 4
The websites on my Linode are more and more regularly not working due to (I believe) Apache memory issues. I can fix the problem by restarting Apache, but I'd obviously prefer to address the underlying problem to prevent this happening in the first place. I followed https://www.linode.com/docs/troubleshoo ... eshooting/ and determined that I have an issue with memory, however these steps https://www.linode.com/docs/troubleshoo ... ng-issues/ don't really help since you can't use those settings permanently and I'm not sure what setting them low temporarily will solve...

I'm therefore looking for a way to work out why Apache is running out of memory. Is it a certain website that is mis-configured, is it simply lots of traffic and I need to upgrade my plan (it'd be nice to know which website too), or something else. Any advice/steps to find the root cause would be much appreciated!


Top
   
PostPosted: Fri Jun 12, 2015 4:59 am 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
There are several ways to run Apache (prefork, worker, event) and several ways to run PHP (which is one of the likely reasons for your memory problems). You have not given any detail about your particular setup, so we can only guess.

In either case, if you are running Apache >= 2.4, I recommend that you use php-fpm for PHP (Debian/Ubuntu package name "php5-fpm").


Top
   
PostPosted: Fri Jun 12, 2015 9:07 am 
Offline
Newbie

Joined: Fri Jun 12, 2015 2:06 am
Posts: 4
Quote:
You have not given any detail about your particular setup

I'm happy to provide any info you need, just tell me what and how :)


Top
   
PostPosted: Fri Jun 12, 2015 9:38 am 
Offline
Newbie

Joined: Fri Jun 12, 2015 2:06 am
Posts: 4
Ok, I found http://serverfault.com/a/663878/293911 and my Apache is setup as 'prefork'. It's also running version 'Apache/2.4.7 (Ubuntu)'
Considering http://serverfault.com/a/383634/293911 should I set it up as 'event' instead?

I can't work out what the PHP setup options are or which I'm running...


Top
   
PostPosted: Fri Jun 12, 2015 12:06 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
Quote:
I can't work out what the PHP setup options are or which I'm running...


Create a file called "info.php" in the root of your web server containing this line:
Code:
<?php phpinfo(); ?>

Then visit the address http://example.com/info.php where example.com is your site address.

Your server will probably say "Server API: Apache 2.0 Handler" which means you are using mod-php.


Top
   
PostPosted: Fri Jun 12, 2015 12:10 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
This is the very short recipe to switch to php-fpm on Debian, I think it will work in Ubuntu too:
Code:
apt-get install apache2 php5-fpm
a2enmod proxy
a2enmod proxy_fcgi
nano /etc/apache2/sites-available/000-default.conf

Insert this in appropriate place:
Code:
  <FilesMatch \.php$>
    SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
  </FilesMatch>
  DirectoryIndex index.php index.html index.htm

then restart apache:
Code:
service apache2 restart


Top
   
PostPosted: Sun Jun 14, 2015 8:26 pm 
Offline
Newbie

Joined: Fri Jun 12, 2015 2:06 am
Posts: 4
Yes, I'm using 'Server API: Apache 2.0 Handler'. I'll look into switching to php-fpm, thanks.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group