How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

October 29, 2014

chkconfig list ubuntu

Filed under: Linux — Tags: , — admin @ 10:52 am

Well on ubuntu I didn’t find a corresponding command to chkconfig list.
So a, easy way to find out what is running on startup is to run this:
runlevel
N X
And after you see what runlevel is you list the directory :
ls -ialh ls -ialh /etc/rcX.d/

Where X is the answer from runlevel

Also some equivalent command:
chkconfig –add
chkconfig –level 345 on
chkconfig –del

update-rc.d defaults
update-rc.d start 20 3 4 5
update-rc.d -f remove

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

January 29, 2014

How to display HTTP Headers with tcpdump

Filed under: Linux — Tags: , , , , — admin @ 9:19 pm

Well today I was needing to see some packages that arrived on apache. In order to see I have to use tcpdump, but you will only some short information if you are using basic.
In order to see HTTP header you have to use something like this:
tcpdump -n -vvvs 1024 -l -A host matrafox.info

If you want to see more information you have to increase the size, something like this
tcpdump -n -vvvs 1500-l -A host matrafox.info

November 28, 2013

ubuntu virtualbox networking not working

Filed under: Linux — Tags: , , — admin @ 10:20 am

Hello
Today I wanted to test something on a ubuntu server . So I start a virtualbox with it. However when it started there was no network. But only a error with 60 seconds to wait.
After long wait, the ubuntu server have started, but no network available . I have to mention that I use bridged adapter on virtual server.

The solution is to empty one file.
I did make a backup first with
cp /etc/udev/rules.d/70-persistent-net.rules /root

After this I have empty the file
echo ""> /etc/udev/rules.d/70-persistent-net.rules

And rebooted the server.
After this all was ok.

June 7, 2012

Run a script as a different user

Filed under: Linux — Tags: , , , , — admin @ 12:16 pm

Well if you want to run a script as diferent user you should try to run with su comand.
If you will run like this

su - x -c "/path/script.sh"
after the script is run the su comand return at your user.

« Newer PostsOlder Posts »

Powered by WordPress