Category Archives: Web Server

Install PHP 7.3 + xdebug on MacOS Mojave (with homebrew)

First, you need to have homebrew installed, if you don’t have it please go to and follow the installation steps.

Remove any old version of php:

brew list | grep php | awk '{ print "brew uninstall --force "$1}' | bash

To be sure, manually remove the php cellar folder:

rm -rf /usr/local/Cellar/php

Then clean any php tap (extra repo):

brew untap homebrew/php

Cleanup and Update your brew:

brew cleanup
brew update

Install the latest version of php:

brew install php

Clean up old xdebug:

pecl uninstall xdebug

Install the latest version of xdebug-beta (The xdebug is not compatible with 7.3 so you need to use the xdebug-beta):

pecl install xdebug-beta

The last step, edit the  /usr/local/etc/php/7.3/php.ini and add these lines at the bottom of this file:

Find how much memory apache threaded MPM is using

The Worker MPM turns Apache into a multi-process, multi-threaded web server. Unlike Prefork, each child process under Worker can have multiple threads.

If you use top or ps you will get something like this:
And sometimes is hard to find how many resources this service is using.

If you want to have the memory usage grouped by process, we could use the atop tool and then press ‘m’ (memory usage) and ‘p’ (group by process name). Example:


This will work with any multi-process, multi-threaded service 🙂

How To Implement SSL With HAProxy on Debian

Generate the CSR and KEY SSL file:

cd /etc/ssl/private/
openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out server.csr

Then sent the .csr file to your SSL Provider and get the .crt file and put on /etc/ssl.

Install the HAProxy last version

add-apt-repository ppa:vbernat/haproxy-1.7
apt-get update
apt-get install haproxy

HAProxy Configuration

Edit the file: /etc/haproxy/haproxy.cfg and adjusts the maxconn and increase this line bellow in the global section:

tune.ssl.default-dh-param 2048

In the default section, put this lines under the mode http:

option forwardfor
option http-server-close

This will add X-Forwarded-For headers to each request, as well as reduce the latency between HAProxy and to preserve client persistent connections.

At the proxy section:

frontend www-http
   bind $PUBLIC_IP:80
   reqadd X-Forwarded-Proto:\ http
   default_backend www-backend

frontend www-https
   bind $PUBLIC_IP:443 ssl crt /etc/ssl/private/myserver.crt
   reqadd X-Forwarded-Proto:\ https
   default_backend www-backend

backend www-backend
   redirect scheme https if !{ ssl_fc }
   server host1 $PRIVATE_IP:80 check
   server host2 $PRIVATE_IP:80 check

Restart the HAProxy

sudo service haproxy restart

Find how much Ram the Apache is using per process

Find how much Ram the Apache is using per process

The best tool I’ve found to do that is:

The output of ps_mem is:

 Private  +   Shared  =  RAM used	Program

  7.8 MiB +   1.6 MiB =   9.4 MiB	bash (4)
 39.7 MiB +  34.8 MiB =  74.5 MiB	apache2 (76)
287.7 MiB + 411.5 KiB = 288.1 MiB	mysqld
                        451.2 MiB

Here you can see 76 process of apache2 using 74.5 MiB, so to calc that is really easy, 1 process memory usage = RAM used / number of process, using the values from this example above will be 74,5 / 76 = 0,98 MiB.