Show static google map image and link to map with marker

With this snippet you can show a static google map image for a specific location, which is linked to google maps and includes showing a marker in all views.Don’t forget to change YOUR_GOOGLE_STATIC_MAPS_API_KEY to your api key, which you can get at https://console.developers.google.com by creating a server key and aactivate google maps for this account. […]

Read More… from Show static google map image and link to map with marker

Show content of folder in PHP

To show the content of a directory in PHP and make the files like images etc downloadable without changing the Webserver config, upload this snippet as index.php to the directory. <?php$pageURL = ‘http’;$pageURL .= “://”;$pageURL .= $_SERVER[“SERVER_NAME”];$httpfolder = $pageURL.$_SERVER[“REQUEST_URI”]; // The link to this folder from outside, with slash at end$dir = getcwd();$files = array_diff(scandir($dir), […]

Read More… from Show content of folder in PHP

Downgrade Ubuntu PHP Version from PHP 8 to PHP 7.4

Recently my Ubuntu server updated itself, and I suddenly had version PHP 8.0 on my terminal. I use PHP for composer installations, and some packages in my composer.json required PHP 7.4 and wouldn’t install with PHP 8. So I had to downgrade my PHP Version from PHP 8.0 to PHP 7.4 This is done like […]

Read More… from Downgrade Ubuntu PHP Version from PHP 8 to PHP 7.4

E: The repository ‘https://packages.sury.org/php stretch Release’ does no longer have a Release file.

When updating your old Debian Stretch server, you experience the following error:E: The repository ‘https://packages.sury.org/php stretch Release’ does no longer have a Release file. Solution: Use a mirror of the old repository. echo “deb https://debian.octopuce.fr/snapshots/sury-php/stretch-latest/ stretch main” | sudo tee /etc/apt/sources.list.d/php.list wget -qO – https://debian.octopuce.fr/sury-php/apt.gpg | sudo apt-key add – sudo apt update Note: if […]

Read More… from E: The repository ‘https://packages.sury.org/php stretch Release’ does no longer have a Release file.

Write PHP Array with print_r as debug output to a file instead of echoing it

PHP debugging made easy At some point in our life as PHP developer, we come to the point where we are debugging PHP by checking the values of our variables, arrays and objects.We all know: Its easy to debug in Javascript. You can do something like:console.log(“variable is:”+myVar); This is a problem for PHP debug.You can […]

Read More… from Write PHP Array with print_r as debug output to a file instead of echoing it