How to , and other stuff about linux, photo, php … Another blog just like others on internet

January 23, 2015

Unique visitors from apache log file

Filed under: Linux — Tags: , , — admin @ 11:32 am

Well if you ever want to find out from apache log how many unique visitors you have here is one command

cat /usr/local/apache/domlogs/domain.log |awk '{print $1}' | sort | uniq | wc -l

If you want to find out for a date
cat /usr/local/apache/domlogs/domain.log | grep "\[05/Sep/2010" |awk '{print $1}' | sort | uniq | wc -l

Unique referrers
cat /usr/local/apache/domlogs/domain.log | awk '{print $11};' | awk -F / '{print $3}' | sort | uniq

Number of hits
cat /usr/local/apache/domlogs/domain.log | wc -l

May 9, 2014

apache child pid exit signal Segmentation fault

Filed under: Linux — Tags: , , , , , , , — admin @ 8:26 pm

Well today I face a strange problem. My apache start throw some segmentation fault into error log. So how to find out what is the problem ?

Well first of all we have to enable the coredump for apache, so in orde to do this we can add this line at the start of httpd.conf
CoreDumpDirectory /path
( Some put the path to /tmp directory but please be aware that for me core have 2.2G , so if you have a small /tmp partition you can put it in other place , but it have to be into a directory with same user/group as apache run ) .

We restart the apache and wait to see a segmentation fault again into error_log, and we will see that he say something about path also
For example:
[notice] child pid 4959 exit signal Segmentation fault (11), possible coredump in /var/www/html

If don’t say anything about path then something is not ok, most probably you have to check properties for path.

After this we find out where is located apache , so for this a
which httpd
/usr/sbin/httpd

Should be ok .
After this we have to run
gdb httpd_path core_path
gdb /usr/sbin/httpd /var/www/html/core

We will see something like this

....
....
....
Loaded symbols for /lib64/libgpg-error.so.0
Reading symbols from /usr/lib64/php/modules/zip.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/php/modules/zip.so
Reading symbols from /usr/lib64/gconv/ISO8859-1.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/gconv/ISO8859-1.so
Core was generated by `/usr/sbin/httpd'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f278f5a5c29 in zend_hash_index_find () from /etc/httpd/modules/libphp5.so
Missing separate debuginfos, use: debuginfo-install httpd-2.2.15-30.el6.centos.x86_64
(gdb)

Ok now we run
where
(gdb) where
And now is the magic to see what is causing the problem.

For me was
#0 0x00007f278f5a5c29 in zend_hash_index_find () from /etc/httpd/modules/libphp5.so
#1 0x00007f2789b98661 in my_copy_zval (dst=0x7f279e2e8dd0, src=0x7f2709eee8d0, ctxt=0x7fff0d4c3900) at /var/tmp/APC/apc_compile.c:314
#2 0x00007f2789b9176d in zif_apc_fetch (ht=, return_value=0x7f279e2e8dd0, return_value_ptr=, this_ptr=, return_value_used=)
at /var/tmp/APC/php_apc.c:858
#3 0x00007f278f5e8498 in ?? () from /etc/httpd/modules/libphp5.so
#4 0x00007f278f5bf5e0 in execute () from /etc/httpd/modules/libphp5.so
#5 0x00007f278f58ff35 in zend_call_function () from /etc/httpd/modules/libphp5.so
#6 0x00007f278f4e7c37 in ?? () from /etc/httpd/modules/libphp5.so
#7 0x00007f278f5e8498 in ?? () from /etc/httpd/modules/libphp5.so
#8 0x00007f278f5bf5e0 in execute () from /etc/httpd/modules/libphp5.so
#9 0x00007f278f5997ed in zend_execute_scripts () from /etc/httpd/modules/libphp5.so
#10 0x00007f278f547878 in php_execute_script () from /etc/httpd/modules/libphp5.so
#11 0x00007f278f622e55 in ?? () from /etc/httpd/modules/libphp5.so
#12 0x00007f279adfebb0 in ap_run_handler ()
#13 0x00007f279ae0246e in ap_invoke_handler ()
#14 0x00007f279ae0d96c in ap_internal_redirect ()
#15 0x00007f2791cfc855 in ?? () from /etc/httpd/modules/mod_rewrite.so
#16 0x00007f279adfebb0 in ap_run_handler ()
#17 0x00007f279ae0246e in ap_invoke_handler ()
#18 0x00007f279ae0db30 in ap_process_request ()
#19 0x00007f279ae0a9a8 in ?? ()
#20 0x00007f279ae066b8 in ap_run_process_connection ()
#21 0x00007f279ae12977 in ?? ()
#22 0x00007f279ae12c8a in ?? ()
#23 0x00007f279ae1390c in ap_mpm_run ()
#24 0x00007f279adea900 in main ()

To quit from gdb we have to type quit .

For me the problem was the apc, I have increased the memory_limit, and the problem is fixed .

Also some interesting link I found here

Generate PHP core dumps on segfaults in PHP-FPM

April 23, 2012

Invalid command “SSLEngine”, perhaps misspelled or defined by a module not included in the server configuration

Filed under: Linux — Tags: , , , , — admin @ 3:53 pm

If you have bellow error you should install mod_ssl
“Invalid command “SSLEngine”, perhaps misspelled or defined by a module not included in the server configuration”
The error message indicates that the module mod_ssl required to run SSL engine on a CentOS server is missing and needs to be installed.
Install the mod_ssl module using yum
yum install mod_ssl
Once it is installed, make sure to restart the Apache service
service httpd restart

August 19, 2010

How to Check if Apache is Running Prefork or Worker

Filed under: Linux — Tags: , , , , — admin @ 8:36 pm

Today I want to change some settings on one of my server. But when to change I didn’t know if it’s prefork or worker module at the power of my apache.

So what to tune ?

Well this information is compile in Apache and is not loaded as module.

So if you want to find out what MPM module Apache is running you should run: httpd -l

And the output will be like this:

Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
prefork.c
http_core.c
Hope this will help someone.

March 31, 2008

mod_auth_mysql Apache with cPanel

Filed under: Linux — Tags: , , — admin @ 2:18 pm

Overview:
mod_auth_mysql is an Apache module that allows authentication using user and group data stored in MySQL databases. Originally by Vivek Khera for Apache1, now also includes a version for Apache 2. Official SourceForge Project website http://sourceforge.net/projects/modauthmysql/

(more…)

« Newer Posts

Powered by WordPress