WordPress DB migration change URL

SET @from="http://example.localhost";
SET @to="https://example.com";
UPDATE wp_options SET option_value = replace(option_value, @from, @to) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, @from, @to);
UPDATE wp_posts SET post_content = replace(post_content, @from, @to);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @from, @to);

Xdebug configurations for Xdebug2 and Xdebug3 under Windows and Linux

In your xdebug.ini file:

; For Xdebug 2 (2.5.5) / Linux
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9003
xdebug.remote_host=172.17.0.1
; For Xdebug 2 (2.5.5) / Windows
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9003
xdebug.remote_host=172.17.0.1
; For Xdebug 3 (3.1.1) / Linux
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so
xdebug.mode=debug
xdebug.discover_client_host=no
xdebug.client_port=9003
xdebug.client_host=172.17.0.1
; For Xdebug 3 (3.1.1) / Windows
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so
xdebug.mode=debug
xdebug.discover_client_host=no
xdebug.client_port=9003
xdebug.client_host=host.docker.internal

Make Git ignore file mode (chmod) changes

Per project

git config core.fileMode false

Global

git config --global core.fileMode false

Warning

Changes of the global setting won’t be applied to existing repositories. Additionally, git clone and git init explicitly set core.fileMode to true in the repo config as discussed in Git global core.fileMode false overridden locally on clone

Warning 2

core.fileMode is not the best practice and should be used carefully. This setting only covers the executable bit of mode and never the read/write bits. In many cases you think you need this setting because you did something like chmod -R 777, making all your files executable. But in most projects most files don’t need and should not be executable for security reasons.

The proper way to solve this kind of situation is to handle folder and file permission separately, with something like:

find . -type d -exec chmod a+rwx {} \; # Make folders traversable and read/write
find . -type f -exec chmod a+rw {} \; # Make files read/write
If you do that, you’ll never need to use core.fileMode, except in very rare environment.

Install Xdebug from sources in Dockerfile, docker

Tested on: docker php:5.6.40-fpm

If you need Xdebug version compatibile with older php versions and you can’t do it by PECL.

Download sources to .docker dir e.g. .docker/xdebug-2.5.5.tgz

In Dockerfile:

# Xdebug install from sources
RUN echo \
    && mkdir /usr/local/lib/xdebug
COPY .docker/xdebug-2.5.5.tgz /usr/local/lib/xdebug/xdebug-2.5.5.tgz
RUN echo \
    && cd /usr/local/lib/xdebug/ && tar zxvf xdebug-2.5.5.tgz \
    && cd /usr/local/lib/xdebug/xdebug-2.5.5 \
    && phpize \
    && ./configure --enable-xdebug \
    && make \
    && make install