Self Hosted Dynamic DNS with CloudFlare

Ok, “Self Hosted Dynamic DNS” may be a bit of a stretch here. When I was looking at solutions to self host my DNS, I found out that it might fall into the realm of overkill to run a full application. If, for the sake of dabbling, you want to go the full on self hosting route, then a great option is the free and open source

However we are going to achieve our end goal here via a simple bash script and a free Cloudflare account.

General Server Configuration Ubuntu

Cannot add PPA: ppa:yannubuntu/boot-repair

Cannot add PPA: ‘ppa:yannubuntu/boot-repair’

Often, when trying to repair Windows MBR or even modify the boot order on a Ubuntu and Windows dual boot system, it is recommended to use the package “boot-repair”.

the first step in this process is adding the repository: sudo add-apt-repository ppa:yannubuntu/boot-repair

However, many people end up getting an error stating that the repository doesn’t exist: “”

Cannot add PPA: 'ppa:~yannubuntu/ubuntu/boot-repair'.
ERROR: '~yannubuntu' user or team does not exist.

How can you repair Grub if yannubuntu doesn’t exist?

Because this operation is generally recommended to be done on a live USB or disk version of the OS it is very common to forget to connect to the wifi.

If you are experiencing ” ~yannubuntu’ user or team does not exist. ” or “Cannot add PPA: ppa:yannubuntu/boot-repair”, I suggest you make sure you are on the internet first!


WordPress Email Error Handling

  add_action( 'wp_mail_failed', 'onMailError', 10, 1 );
function onMailError( $wp_error ) {
    echo "<pre>";
    echo "</pre>";

Have you ever had to debug WordPress email problems, like mail not being sent, without any apparent reason? The wp_mail function is usually used to send emails from within WordPress code. This is a pluggable function and, thus, resides in wp-includes/pluggable.php.

Debugging wp_mail in WordPress

Its default behavior prevents it from returning anything but false when sending fails for one reason or another. And that often times poses a problem when trying to debug wp_mail issues.

Debugging wp_mail() can be a lot easier with this simple method: wp_mail_failed . It will display a more helpful error message (the original phpmailer error) than WordPress will by default. Just add this function to display the real wp_mail() error. But only use this for debugging.

WordPress relies on the PHPMailer class to send email through PHP’s mail function.

Since PHP’s mail function returns very little information after execution (only TRUE or FALSE), I suggest temporarily stripping down your mv_optin_mail function to a minimum in order to see if the wp_mail functions works.


$mailResult = false;
$mailResult = wp_mail( '[email protected]', 'test if mail works', 'hurray' );
echo $mailResult;

Since you’ve tested PHP’s mail function already, the mail should arrive.

If it does not, the problem lies in the other statements of your function or in the PHPMailer class.

Code Snippets PHP

How to get current directory, filename and code line number in PHP

How to Get the Current Directory, Filename, and Code Line Number in PHP

In PHP, there are several built-in functions that can be used to obtain information about the current script’s directory, filename, and code line number.

Getting the Current Directory

To get the absolute path of the directory containing the current script, you can use the dirname(__FILE__) function. For example:

$current_directory = dirname(__FILE__);

This will set the $current_directory variable to the absolute path of the directory containing the current script.

Getting the Current Filename

To get the name of the current script file, you can use the basename(__FILE__) function. For example:

$current_filename = basename(__FILE__);

This will set the $current_filename variable to the name of the current script file.

Getting the Current Code Line Number

To get the current code line number, you can use the __LINE__ magic constant. For example:

$current_line_number = __LINE__;

This will set the $current_line_number variable to the current code line number.

By using these built-in functions and magic constants, you can easily obtain information about the current script’s directory, filename, and code line number in PHP.


Post-processing of the image failed – WordPress

PHP Log: [17-Dec-2021 00:59:19 UTC] PHP Fatal error: Maximum execution time of 300 seconds exceeded in \site\wp-includes\functions.php on line 8179

WP Admin Error: Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.

Som e info about a directory cache, and multisite, added 5.6.0:

I simply went to the function that line 8179 of wp-includes/functions.php is in and added a return statemnt as the firsat line of the function. Short term solutuion – dunno if it causes other issues, but my uploader works again. function clean_dirsize_cache( $path ) { … }

Dev Console:
Failed to load resource: the server responded with a status of 524 () asynch-upload.php wordpress multisite