APC cache making apache consume all CPU usage - apache

Greetings,
I'm trying to install APC in order to deal with a high Apache RAM usage.
I've followed this instructions here and, from the moment I've edited php.ini my Apache CPU usage EXPLODED.
What did I do wrong? How can I be sure APC is working fine?
Thanks!

In the shell run php -i | grep apc to see if APC is enable
Install apc.php (cd /; find -name apc.php | grep apc) somewhere on web doc root to monitor Your APC installation

Related

Rabbitmq File Descriptor Limit

Rabbitmq documentation says that we need to do some configuration before we use it on production. One of the configuration is about maximum open file number (which is an OS parameter).
Rabbitmq server we use is running on Ubuntu 16.04 and according to resources I found on web, I updated the number of open files as 500k. When I check it from command line, I get the following output:
root#madeleine:~# ulimit -n
500000
However when I look at the rabbitmq server status, I see another number.
root#madeleine:~# rabbitmqctl status | grep 'file_descriptors' -A 4
{file_descriptors,
[{total_limit,924},
{total_used,19},
{sockets_limit,829},
{sockets_used,10}]},
It seems like, I managed to increase the limit on OS side, but rabbitmq still thinks that total limit of file descriptors is 924.
What might be causing this problem?
You might want to look at this page
Apparently, this operation depends on the OS version. If you have a systemd, you should do the following in /etc/systemd/system/rabbitmq-server.service.d/limits.conf file:
Notice that this service configuration might be somewhere else according to the operating system you are using. You can use the following command to find where this service configuration is located and update that file.
find / -name "*rabbitmq-server.service*"
[Service]
LimitNOFILE=300000
On the other hand, if you do not have the systemd folder, you should try this in your rabbitmq-env.conf file:
ulimit -S -n 4096
Increase / Set maximum number of open files
sudo sysctl -w fs.file-max=65536
These limits are defined in /etc/security/limits.conf
sudo nano /etc/security/limits.conf
and set
soft nofile 65536
hard nofile 65536
Per user settings for rabbitmq process can also be set in
/etc/default/rabbitmq-server
sudo nano /etc/default/rabbitmq-server
and set
ulimit -n 65536
Then reboot the server for changes to take effect.

Unable to write files in virtual host setup in NGINX / PHP-FPM running on Fedora 20

I have just made a new setup of Fedora 20 on my laptop, earlier I was using Linux Mint, running NGINX / PHP-FPM.
I have been trying to run php scripts that write files or upload files to server, but I am unable to do so, everything else seems to work fine.
I have already tried the obvious "chmod 777" and "chown -R nginx", etc. but the problem still persists.
Got it working with SELinux enabled,
Last command was:
setsebool -P httpd_can_network_connect 1
Referred to this blog: http://blog.frag-gustav.de/2013/07/21/nginx-selinux-me-mad/

Installing solr and indexing mysql

Can anyone help me with Installation of solr and configuring it to mysql table.I Have tried almost all tutorials , i tried with Jetty , also tomcat.Still getting errors like Data Handler not defined or could not find solr.It's been a week , i am trying all day
In order to get solr running, (assuming that you've downloaded solr and extract it to a location), just navigate to the jetty folder.
Under that there should be a start.jar.
Just type in java -jar start.jar - this should start Solr under jetty. As simple as that. For all my development purposes, I use this. I wouldn't worry about Tomcat unless the app is ready to be deployed to some server.
In order to get your SOLR instance to pull data from mysql, you need the DataImportHandler configured. This documentation describes it well.
EDIT:
A google search for "solr mysql import" lead me here. It is exactly what you're after, I suppose.
I also had the same issue and it is not easy to find simple tutorial for this. Anyway I found following tutorial and it was useful for me.
http://lasithtechavenue.blogspot.com/2013/11/crawling-mysql-database-with-apache-solr.html
Thanks
Hi Please take a look here.
https://github.com/vikash32/indexing-mysql-table-into-solr
i have tried to make it less messy.
Step1:
Login to Linux and go to root folder opt ie cd /opt/
Step2:
Dowload Solr-6.6.2 from the solr link and use the below command to download solr in linux
Sudo wget http://www-us.apache.org/dist/lucene/solr/6.6.2/solr-6.6.2.tgz
Step3:
Extract the service installation file
Sudo tar xzf solr-6.6.2.tgz solr-6.6.2/bin/install_solr_service.sh --strip-components=2
Step4:
Install solr as a service using the script
sudo bash ./install_solr_service.sh solr-6.6.2.tgz
Step5:To check solr server status
sudo service solr status
Step6:To Start Solr in Cloud mode in RHEL
Go to root directory ie cd /opt/
Then go to solr directory cd /solr
Opt/solr > sudo ./bin/solr start -c -force -s server/solr -p 8983 -z zk1:2181,zk2:2181,zk3:2181
Zk1 is the hostname or ipaddress
Step7: To Create Core on solr
Go to solr directory ie cd /opt/solr
Opt/solr > sudo ./bin/sor/create -c -p 8983,7574 -s 2 -rf 2
-s stands for no of shards
-rf stands for no of replica

install memcache onfedora linux OS

I installed memcache in the following way:
1) yum install memcached
2) yum install php-pecl-memcached
3) Also enabled the 'memcached.so' in php.ini
I tested the memcached in the follwing way:
$mc = new Memcache;
$mc->addServer('localhost', 11211);
echo "Server's version: " . $mc->getVersion() ;
But it generates the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_encode in Unknown on line 0
PHP Fatal error: Class 'Memcache' not found in /root/memcacheTest.php on line 2
Thank u.
I don't know PHP well (or at all), but from the error message I'll hazzard a guess that you do not have the PHP JSON extension installed, which is apparently needed by the memchached extension.
Apparently, the JSON extension has been in PHP since version 5.2.0, therefore:
You have an older version and you need to upgrade or install the JSON extension yourself
or
Your operating system distributor supplies the PHP JSON extension in a different package that you have not installed.
There is of course the possibility of a misconfiguration, but I think it's slightly less likely.
This showed memcached.so didn't loaded successfully.
Error shows the reason: json.so should be load before memcached.so
Please use php -m | grep memcached to check whether memcached.so is loaded successfully.
If show memcached, this mean it succeeded.
If show like PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_decode_ex in Unknown on line 0
Here is the solusion:
e.g your php.ini is /etc/php.ini, your php.d is /etc/php.d/
Solution 1
comment 'memcached.so' in php.ini
vim /etc/php.d/memcached.ini
add extension=memcached.so in /memcached.ini
php -m | grep memcached check whether memcached is succeed loaded
Solution 2
rm /etc/php.d/json.ini
add extension=json.so in php.in before extension=memcached.so
php -m | grep memcached check whether memcached is succeed loaded
Can you check and double check user permissions? Additionally, my experience with PHP is that the distribution repository versions of PHP aren't very good. I solved those symbol errors by compiling PHP from the ground up. But that's a very radical and time-consuming solution.
http://pecl.php.net/bugs/bug.php?id=17574&edit=1
Just make sure that extension=json.so is specified BEFORE
extension=memcached.so.
I had placed extension=memcached.so in php.ini, and extension=json.so
was specified in /etc/php.d/json.ini, that is parsed AFTER php.ini.
That is why PHP can't find php_json_encode() at the point of loading
memcached.so.
Also, check that the permissions on memcached.so are the same as the other extensions
Try to install the version 2.0. It helped for me.
yum -y install gcc-c++
wget http://launchpad.net/libmemcached/1.0/0.50/+download/libmemcached-0.50.tar.gz
tar xzf libmemcached-0.50.tar.gz
cd libmemcached-0.50
./configure
make
make install
wget http://pecl.php.net/get/memcached-2.0.0b2.tgz
pecl install memcached-2.0.0b2.tgz
echo 'extension=memcached.so' > /etc/php.d/memcached.ini
service php-fpm restart
cd ..
rm -r libmemcached-0.50*
rm -r memcached-

libvirt and VirtualBox / Getting Started

I'm trying to get started on libvirt with VirtualBox as a virtualization solution. I installed everything and VirtualBox itself is running when using their VBoxHeadless command.
However, libvirt fails to connect to VirtualBox:
# virsh -c vbox:///session
libvir: error : could not connect to vbox:///session
error: failed to connect to the hypervisor
I could not find any hints in the libvirt documentation that point to whether I have to make any domain specific configuration before using virsh.
Does anyone have a hint? Or even better, maybe a tutorial that works through the way of using libvirt, virsh or it's APIs (my later goal) from the ground up.
If you are doing this on Ubuntu, then the problem is their libvirt package is built without VirtualBox support.
You can rebuild the package with support very easily. Something like:
apt-get source -d libvirt
sudo apt-get build-dep libvirt
dpkg-source -x libvirt*dsc
Go into the libvirt directory and edit debian/rules so that instead of --without-vbox it says --with-vbox. You can add an entry to the top of debian/changelog so the package is compiled as a different version (e.g., append ~local1 to the version).
dpkg-buildpackage -us -uc -b -rfakeroot
You'll get new .debs built in the directory above. Use dpkg -i to install the relevant ones (libvirt0, libvirt0-bin, and whatever else you want).
Double-check whether or not you have write access to /var/run/libvirt/libvirt-sock.
The socket file should have permissions similar to:
$ sudo ls -la /var/run/libvirt/libvirt-sock
srwxrwx--- 1 root libvirtd 0 2010-08-24 14:54 /var/run/libvirt/libvirt-sock
I think it could be helpful also to increase the libvirt logging capabilities by running this in your shell:
export LIBVIRT_DEBUG=1
There is Ubuntu PPA for libvirt with VirtualBox support: https://launchpad.net/~cxl/+archive/ubuntu/libvirt