Optimization Moodle HTTPD For Centos

Show used memory for apache process

ps aux | grep 'httpd' | awk '{print $6/1024 " MB";}'

And for resume:

ps -ylC httpd --sort:rss | awk '{sum+=$8; ++n} END {print "Tot="sum"("n")";print "Avg="sum"/"n"="sum/n/1024"MB"}'

show server MPM
# httpd -V

Server MPM:     prefork

And than
MaxRequestWorkers = Total available memory * 80% / Max memory usage of apache process

Example i have 91GB ram, and 50MB max memory per process (usualy per process not more than 100MB)
MaxRequestWorkers = 91000 * 0.8 / 50 = 1400

and than usualy i add 1400+100=1500 for ServerLimit

So configure mpm prefork
#vi /etc/httpd/conf.modules.d/00-mpm.conf

<IfModule mpm_prefork_module>
MaxRequestWorkers 1400
ServerLimit 1500

# systemctl restart httpd

Look Diference Between 2 folder in linux

This program using  rsync

rsync --recursive --delete --links --checksum --verbose --dry-run root@collo.jaringankantor:/home/anwar/public_html/ /public_html/anwar/ > dirdiff_anwar.txt

How To Install PGBOUNCER on Centos 6

Check your version of centos
# cat /etc/redhat-release

and then download from this link https://yum.postgresql.org/repopackages.php#pg96 if latest version is Postgresql96

Choose your operating system and then download repository:
# wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm
# rpm -ivh pgdg-centos96-9.6-3.noarch.rpm
# yum update -y
# yum install pgbouncer

Edit pgbouncer.ini, this is example
jaringankantorcom_penerimaan = dbname=db_penerimaan host=localhost port=5432 user=xxx_user password=xxx_password

logfile = /home/pgbouncer/pgbouncer.log
pidfile = /home/pgbouncer/pgbouncer.pid
listen_addr = *
listen_port = 6432
auth_type = md5
auth_file = /home/pgbouncer/userlist.txt
admin_users = postgres
stats_users = stats, postgres
pool_mode = transaction

Create your username and password at /home/pgbouncer/userlist.txt

Edit service pgbouncher /etc/init.d/pgbouncer tobe:

Restart and activate pgbouncer
# service pgbouncer restart
# chkconfig pgbouncer on

For checking yout pgbouncer on, type this command:
# su pgbouncer
pgbouncer $ psql -p 6432 -h localhost -U postgres jaringankantorcom_penerimaan

pgbouncer $ psql -p 6432 -h localhost -U postgres pgbouncer

How to display process with specific memory and processor linux

This command display all process with name like 'postmas'

ps -eo pcpu,pmem,pid,user,args --sort user |grep postmas

Install PHP from source (tar.gz) in Centos 6

Hello there, welcome back :)

Here my tutorial, hope help you for web application like Yii, CodeIgniter, Etc:
  1. Download libvpx https://codeload.github.com/webmproject/libvpx/zip/master -O libvpx.zip
  2. unzip libvpx.zip
  3. cd libvpx-master
  4. ./configure --enable-shared --prefix=/usr/local/
    make install
  5. Download Gd Lib https://github.com/libgd/libgd/archive/GD_2_0_33.tar.gz
  6. tar zxf GD_2_0_33.tar.gz 
  7. cd lib_GD_2_0_33/src
  8.  ./configure --enable-shared --prefix=/usr/local/
    make install
  9. Download libJpeg http://www.ijg.org/ (.tar.gz)
  10. tar -zxf jpegsrc.v9a.tar.gz
  11. cd jpeg-9a
  12. ./configure --enable-shared --prefix=/usr/local/
    make install
  13. Download libPNG http://www.libpng.org/pub/png/libpng.html (.tar.gz)
  14.  tar -zxf libpng-1.6.17.tar.gz
  15. cd libpng-1.6.17
  16. ./configure --prefix=/usr/local/
    make install
  17. Download php source (.tar.gz)
  18. tar -zxf phpxxx.tar.gz
  19. cd phpxxx.tar.gz
  20. ./configure \
      --libexecdir=/usr/libexec \
      --libdir=/usr/local \
      --includedir=/usr/include \
      --sbindir=/usr/sbin \
      --bindir=/usr/bin \
      --with-config-file-path=/etc/httpd/conf \
      --with-zlib-dir=/usr/local \
      --with-jpeg-dir=/usr/local \
      --with-png-dir=/usr/local \
      --with-vpx-dir=/usr/local \
      --with-xpm-dir=/usr \
      --with-freetype-dir \
      --with-mysql-sock=/var/lib/mysql \
      --with-kerberos \
      --with-gd \
      --with-apxs2=/usr/sbin/apxs \
      --with-bz2 \
      --with-curl \
      --with-gettext \
      --with-mcrypt \
      --with-openssl \
      --with-pdo-mysql \
      --with-xmlrpc \
      --with-zlib \
      --with-pdo-sqlite \
      --with-pdo-pgsql \
      --with-pgsql \
      --with-iconv \
      --with-pear \
      --with-pic \
      --with-config-file-path=/etc \
      --with-config-file-scan-dir=/etc/php.d \
      --with-libdir=lib \
      --with-mysql=mysqlnd \
      --enable-bcmath \
      --enable-calendar \
      --enable-dba \
      --enable-exif \
      --enable-ftp \
      --enable-mbstring \
      --enable-shmop \
      --enable-sigchild \
      --enable-soap \
      --enable-sockets \
      --enable-sysvmsg \
      --enable-sysvshm \
      --enable-sysvsem \
      --enable-zip \
      --enable-gd-native-ttf  \
      --enable-gd-jis-conv \
      --enable-json \
      --enable-pdo \
      --enable-dom \
      --enable-xml \
      --enable-phar \
      --enable-mysqlnd \
  21. make clean
  22. make
  23. make install
  24. service httpd restart
  25. smile :)

Return Array Data Nu Soap

Hello every buddy,

Here i'am :)....In this tutorial i will share about NuSoap WSDL..First i user NuSoap-0.9.5, so follow my step:
  1. Commenting out nusoap.php line 6132:
    //$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
  2. And then copy paste this code: (below)
  3. Create your client nusoap
require_once 'inc/nusoap-0.9.5/nusoap.php';

$ns = "http://webservice.sim.pnj.ac.id/mahasiswa.php";
// Create SOAP Server
$server = new soap_server();
$server->configureWSDL('Mahasiswa', $ns);

function Nilai()
        $result = array();
        $result[] = array('matakuliah' => 'Bahasa Indonesia', 'nilai' => 88);
        $result[] = array('matakuliah' => 'Fisika', 'nilai' => 85);
        return $result;    

        'matakuliah' => array('name'=>'matakuliah','type'=>'xsd:string'),
        'nilai' => array('name'=>'nilai','type'=>'xsd:int')

    $ns,false,'rpc','encoded','Menampilkan Nilai Mahasiswa PNJ');

$server->service(isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '');


Java Programming

Java is one of OOP (Object Oriented Programming) use in many device such as computer, laptop, tv, hand phone, etc. James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The language was initially called Oak after an oak tree that stood outside Gosling's officeIt went by the name Green later, and was later renamed Java, from a list of random words. Gosling aimed to implement a virtual machine and a language that had a familiar C/C++ style of notation. Sun Microsystems released the first public implementation as Java 1.0 in 1995. On May 8, 2007, Sun finished the process, making all of Java's core code available under free software/open-source distribution terms (GNU Public License).

Java have many version such as Java Standard Edition (Java SE) using For desktop, client/server application, Java Enterprise Edition(Java EE) using For e-business, e-commerce web based application, and Java Micro Edition(Java ME) using For small devices, like palm, handphone, etc

Java have certification that you can see in picture below:
And how using java? because Java is Simple and familiar object oriented programming, Architecture neutral (platform independent), Open Source, First rank in TIOBE Index, Defacto standard programming language in education ^_^