How to fix the APC and eaccelerator errors on CentOS

Browse By

Many a times we install some modules for php such as 'eaccelerator' , xcache, apc, etc. One such rookie mistake that happened recently was, I was trying to install a caching plugin for wordpress. The plugin W3 Total cache was looking good, so I downloaded it and installed..

While installing, I followed certain procedure that came along with it, but did not notice some minor instructions which suggested that I either install xcache or APC. I ignored that instruction and proceeded and installed both!

After installation I found out my whole blog was down. I could not enter the wordpress admin panel. I cursed the plugin. The biggest mistake that I had done was to install it on a production server, right when the server was at the peak load. Again, another rookie mistake!

I later found out that none of my php based pages were working. Something struck my mind that it has to be related to webserver or the PHP installation. Which further led to discovery of various linux commands, adding it to my linux experience.

How to trouble shoot APC and eAccelerator and XCache related errors:

1. I had no clue what the error was since nothing was showing up. I tried to reinstall the php and apache, but that didnt help at all. I checked the error log. In order to check the error use the following command:

vi /var/log/httpd/error_log

Press G to go to the end of the file. Look at what the error is.

In my case the error was:

[notice] child pid 13926 exit signal Segmentation fault (11)

This error did not help me at all, although it conveyed a message that it doesn't have anything to do with php files or my blog. This definitely was something big. I had broken something important in my server.

2. In your terminal, type

php

You should get some error:

PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/apc.so' - /usr/lib/php/modules/apc.so

Failed loading /usr/lib/php/modules/eaccelerator.so: /usr/lib/php/modules/eaccelerator.so: cannot open shared object file: No such file or directory
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/apc.so' - /usr/lib/php/modules/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0

This error clearly indicates what was happening. The php was not able to run and process my wordpress pages. These steps helped me identify the problem that XCache and APC were conflicting with each other.

3. In order to solve this problem use the following procedure:

vi /etc/php.d/apc.ini

Scroll below and make the following changes:

apc.enabled = 1

change it to

apc.enabled = 0

 

vi /etc/php.d/eaccelerator.ini

eaccelerator.enable = 1

change it to

eaccelerator.enable = 0

4. After making the changes, save the files and restart your httpd server with

service httpd restart

5. This will bring your webserver back in action and will be processing the php pages normally.

Hope this post helped you fix the APC and eaccelerator errors on CentOS.

Spread the word
  • 2
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    2
    Shares

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.