Showing posts with label httpd. Show all posts
Showing posts with label httpd. Show all posts

Monday 16 February 2015

Install phpredis

After installing redis, let further install the php package for apache or nginx.
To download and compile phpredis:
git clone https://github.com/phpredis/phpredis
cd phpredis
phpize
./configure
make && make install
Include the compiled extension to php.ini:
touch /etc/php.d/redis.ini
echo extension=redis.so > /etc/php.d/redis.ini
If you use Apache (httpd), restart by:
systemctl restart httpd.service

If you use nginx, restart it by:
systemctl restart php-fpm.service
systemctl restart nginx.service

Friday 9 January 2015

httpd: segmentation fault (GDB)

During one of my php programming, I encountered a httpd segmentation fault. The error was shown in error_log.
[root@fc21 ~]# tail -f /var/log/httpd/error_log

[Fri Jan 09 08:31:50.859976 2015] [core:notice] [pid 6757] AH00052: child pid 6775 exit signal Segmentation fault (11)
I decided to use GDB to see where the segmentation fault occur.
[root@fc21 ~]# systemctl stop httpd
[root@fc21 ~]# systemctl status httpd
To start GDB.
[root@fc21 ~]# gdb httpd
(gdb) r -DONE_PROCESS
Program received signal SIGSEGV, Segmentation fault.
0x00007fffe7f431e8 in _zend_mm_free_int () from /etc/httpd/modules/libphp5.so
And it displayed the fault occured in zend_mm_free_int. Proceed with a "where".
(gdb) where
#0  0x00007fffe7f431e8 in _zend_mm_free_int ()
   from /etc/httpd/modules/libphp5.so
#1  0x00007fffe7f629ce in convert_to_double ()
   from /etc/httpd/modules/libphp5.so
#2  0x00007fffe0d20ea1 in zif_trader_stoch (ht=,
    return_value=0x7ffff7f257f8, return_value_ptr=,
    this_ptr=, return_value_used=)
    at /root/trader-0.3.0/functions/trader_stoch.c:67
#3  0x00007fffe7f5bf2a in dtrace_execute_internal ()
   from /etc/httpd/modules/libphp5.so
#4  0x00007fffe8019800 in zend_do_fcall_common_helper_SPEC ()
   from /etc/httpd/modules/libphp5.so
#5  0x00007fffe7fa9dd0 in execute_ex () from /etc/httpd/modules/libphp5.so
#6  0x00007fffe7f5bdc8 in dtrace_execute_ex ()
   from /etc/httpd/modules/libphp5.so
#7  0x00007fffe7f6e7c0 in zend_execute_scripts ()
   from /etc/httpd/modules/libphp5.so
#8  0x00007fffe7f0a6cb in php_execute_script ()
   from /etc/httpd/modules/libphp5.so
#9  0x00007fffe801b3c2 in php_handler () from /etc/httpd/modules/libphp5.so
#10 0x00005555555942f0 in ap_run_handler ()
#11 0x0000555555594839 in ap_invoke_handler ()
#12 0x00005555555a966a in ap_process_async_request ()
To continue, enter "cont".
(gdb) cont
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
GDB is a useful tool to identify where fault lies. Maybe you could be one to raise a bug in php/httpd/linux with this. And for this problem, I actually found out that I need to cast a decimal in a php variable.
array_push($high,number_format($obj["high"],2,'.',''));

Friday 16 May 2014

Apache http server ldap authentication (by group)

To setup the apache server to use 389 Directory Server as access manager you will need to make sure the mod_ldap was setup with the apache server:
yum install mod_ldap
vi /etc/httpd/conf.modules.d/01-ldap.conf
# This file configures the LDAP modules:
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
And that these lines are in the httpd.conf file:
AuthType Basic
AuthName "Protected Area"
AuthBasicProvider ldap
AuthLDAPURL "ldap://r65-1.local/dc=local"
Require ldap-group cn=Managers,ou=Groups,dc=local

Apache http server ldap authentication (by uid)

To setup the apache server to use 389 Directory Server as access manager you will need to make sure the mod_ldap was setup with the apache server:
yum install mod_ldap
vi /etc/httpd/conf.modules.d/01-ldap.conf
# This file configures the LDAP modules:
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
And that these lines are in the httpd.conf file:
AuthType Basic
AuthName "Protected Area"
AuthBasicProvider ldap
AuthLDAPURL "ldap://r65-1.local/dc=local"
Require ldap-user john

search iomeweekly