Debug programa C++


Para debugar um programa em C++ utilize a opção “-g” na compilação, será gerado um arquivo a.out

g++ -g clientes.cpp

Depois inicie o debugador gdb

gdb a.out

Depois só executar o programa através do deputador

run clientes

Depois que ocorrer o erro é só dar um “backtrace”


SELinux – Permissão arquivos


You can check the current SELinux permissions with the following command:

ls -lZ

You can set SELinux permissions with the following command:

chcon unconfined_u:object_r:httpd_user_content_t:s0

You can use a wildcard to change all files in a directory like so:

chcon unconfined_u:object_r:httpd_user_content_t:s0 *

You can set permissions to all files and directories recursively using this (this is the command that will likely fix your permission issue, you should avoid 777 like then plague):

chcon -R unconfined_u:object_r:httpd_user_content_t:s0 *

If you wish to use home directories to serve sites or applications, you need to issue this command:

setsebool -P httpd_enable_homedirs=1

I have had issues with fsockopen on centos with Selinux and I had to use the following (the -P makes this change permanent, you will liekly need this command also):

setsebool -P httpd_can_network_connect 1

You can see what flags are set on HTTPD with: