2021

Safely inject the values into SQL

Other than using bind in SQL, this is the old school way to solve the SQL query to prevent injection attack Sample Code // a sample list of values to use in IN(): $values = [1,4,10,’12a’,’xy\’z’]; // VERSION 1. For integers: make sure all array elements are integers $in = implode(‘,’, array_map(‘intval’, $values)); // VERSION 2. For strings: apply PDO::quote() function to all elements $in = implode(‘,’, array_map([$pdo, ‘quote’], $values)); // VERSION 3. Custom sanitization: allow only letters a[…]

Safely inject the values into SQL Read More »

Installing PHP Extension in WP ENV

I need pdo_mysql php extension to use on my Wordpress plugins. After a day of research, I found out that this is the limitation of wp-env. The developers do not want us to touch more to any setting of PHP and Docker. So we have to manually install everytime after wp-env start. You can use this way to install other php extensions. Install pdo_mysql after WP-ENV started. wp-env start docker ps docker exec -it [WORDPRESS_CONTAINER_ID] docker-php-ext-install pdo_mysql docker exec -it [WORDPRESS_CONT[…]

Installing PHP Extension in WP ENV Read More »

Restore Discourse from Terminal

Restore discourse from terminal Preparing copy the backup file to from old host /var/discourse/shared/standalone/backups/default to new host /var/discourse/shared/standalone/backups/default Restore cd /var/discourse ./launcher enter app discourse enable_restore discourse restore juzhax-com-2021-03-21-043426-v20210315173137.tar.gz Rebuild cd /var/discourse ./launcher rebuild app

Restore Discourse from Terminal Read More »

Running two discourse in one server

I’m going to duplicate from /var/discourse to /var/discourse2 and make it run both discourse docker together in a server. Preparing sudo -s git clone https://github.com/discourse/discourse_docker.git /var/discourse2 cd /var/discourse2 Transfer Create a directory for the second discourse mkdir -p /var/discourse2/shared/standalone/backups/default cp /var/discourse/container/app.yml /var/discourse/container/app2.yml Modify App2.yml expose: # – “80:80” # http – – Remember to change the port # – “443[…]

Running two discourse in one server Read More »

Error: Package: ImageMagick6-6.9.11.3-1.el7.remi.x86_64 (@remi)

Error message Error: Package: ImageMagick6-6.9.11.3-1.el7.remi.x86_64 (@remi) Requires: ImageMagick6-libs(x86-64) = 6.9.11.3-1.el7.remi Removing: ImageMagick6-libs-6.9.11.3-1.el7.remi.x86_64 (@remi) ImageMagick6-libs(x86-64) = 6.9.11.3-1.el7.remi Obsoleted By: ImageMagick-libs-6.9.11.60-1.el7.remi.x86_64 (remi) ~ImageMagick-libs(x86-64) = 6.9.11.60-1.el7.remi Error: Package: ImageMagick6-c++-6.9.11.3-1.el7.remi.x86_64 (@remi) Requires: ImageMagick6-libs(x86-64) = 6.9.11.3-1.el7.remi Removing: Im[…]

Error: Package: ImageMagick6-6.9.11.3-1.el7.remi.x86_64 (@remi) Read More »

Error: Can’t find command linux during boot

Recently one of my server unable to start during boot time. I received the screenshot from my web hosting company and showing with these error. error: can’t find command linux . Press any key to continue … Solution The problem is the linux and initrd command used in /boot/efi/EFI/centos/grub.cfg is not found in your centos (or any default boot OS). You must replace the linux to linuxefi and initrd to initrdefi inside the grub.cfg file. boot to your CentOS terminal (If can’t boot, you can try[…]

Error: Can’t find command linux during boot Read More »