Tried installing memcached, now all PHP files return a 500 Internal Server
Error
Ok, so I'm feeling pretty down and out at the moment. I wanted to start
using something new for my site and it ended up biting me pretty badly,
and I don't know why. Right now, my Apache files will not serve any type
of PHP files, not even something like <?php phpinfo(); ?>; however, all of
my static content is still being served. I can open image files, html
files, no problem. This is on a VPS running 64 bit CentOS 6. I'm going to
try and give as many details about what I did with the hope that someone
can give me an idea of what went wrong.
I tried installing memcached earlier today, continually got the following
error when I tried to /etc/init.d/memcached start:
Starting memcached: memcached: invalid option -- '1' Illegal argument "?"
Which google gave me absolutely no clues what it meant. Here's the site
that I used as a guide:
http://www.tecmint.com/install-memcached-caching-server-on-rhel-centos-fedora/.
Now, at this point, I was getting frustrated, which has a tendency to
spiral out of control when things don't go right. I changed a bunch of
different things suggested by different websites, so I'll try to list them
all here:
I changed the OPTIONS line of /etc/sysconfig/memcached from OPTIONS="" to
OPTIONS="-1 127.0.0.1" (and back again later when everything was broken)
I changed another OPTIONS line of /etc/init.d/memcached, again the OPTIONS
line (and again, undid it)
Like I said above, I tried the following and got an error:
chkconfig --levels 235 memcached on
/etc/init.d/memcached start
/etc/init.d/memcached restart
I remember trying to start memcache another way, using services memcache
start -u myusername or something along those lines. When I used netstats
to check on port 11211, there were 2 results for both tcp and udp, which
seemed wrong according to the guide above. Also, when I tried checking the
status of memcache using /etc/init.d/memcached status, I would get the
result of memcached is stopped. I then looked up how to stop the current
memcached processes, using the following command:
killall memcached
Doing all of the above, I still wasn't able to start memcached with the
methods I mentioned in #3. So, I decided to go ahead and install the PECL
extension of PHP regardless. Trying yum install php-pecl-memcache didn't
work, so I googled around and found this SO question: Yum install
php-pecl-memcached - No package found (Have epel-release-6-8.noarch.rpm).
So I went into /etc/yum.conf, deleted php*, and that allowed me to do an
install of php-pecl-memcache.
It's at this point when I went to check on my website, and bam, it's
returning 500 Internal Server Error for the main page. I have tried
checking Apache error logs but it looked like the log files were empty, so
I'm not sure what's up with that. I then went on CPanel and clicked on the
error logs there, and this is what's showing up:
PHP Fatal error: Call to undefined function mysqli_connect()
However, I've been using the mysqli extension for months now, so I'm not
sure what's going on here. I did a php -i just to make sure, and the
mysqli extension is indeed enabled. The problem isn't only with the file
where the mysqli_connect() error is being thrown - even if I make a new
php file and just try to do phpinfo I get the 500 error.
I tried restoring a backup of my user account in WHM, but obviously this
did nothing for the server as a whole. I then restored the httpd.conf
file, another option in WHM. I also tried restarting the server.
Here is what the Apache error log is giving me:
[Wed Aug 14 05:59:22 2013] [error] [client x.x.x.x] malformed header from
script. Bad header=<!DOCTYPE html>: index.php
[Wed Aug 14 05:59:22 2013] [error] [client x.x.x.x] PHP Fatal error: Call
to undefined function mysqli_connect() in /home/username/lib/common.php on
line 9
[Wed Aug 14 05:59:22 2013] [error] [client x.x.x.x] File does not exist:
/home/username/public_html/500.shtml
The same thing shows up regardless if I'm trying to open index.php or a
simple script with just phpinfo();.
I really hope I covered all my bases here - I tried my best to remember
the steps that I went through over the past ~8 or so hours. This is so
frustrating, I am completely dejected at the moment. Any help would be
greatly, greatly appreciated. Thanks for taking the time to read through
this.
No comments:
Post a Comment