Tag: php

Manually Installing phpMyAdmin (Ubuntu 18.04)

Sometimes installing phpMyAdmin manually, as opposed to using apt, is necessary. This might be because you're using MySQL 8 and/or PHP 7 and the version provided by Ubuntu's apt repository either won't install or won't function with this setup. You also may just want the latest version for the virtues that come with staying up-to-date. Whatever the reason, this tutorial will run you through the basic process of doing so.

The server I'm using is running Ubuntu 18.04 (though this tutorial will likely need little to no revision for previous versions), Apache 2.4.37, MySQL 8.0.13, and PHP 7.2.14. The latest version of phpMyAdmin at the time of writing is 4.8.4.

Read more

Installing an Up-To-Date LAMP Stack (Ubuntu 18.04)

Having spent a fair bit of time lately setting up new servers and installing LAMP stacks, I figured I'd write a tutorial on the basic process I use. And while there are plenty of tutorials covering the installation of the LAMP stack on Ubuntu, there aren't many I could find which ensure that latest versions of each component are installed.

Therefore, this tutorial will run you through several fundamental things that should be done to set up any Ubuntu server, such as user creation, SSH configuration, and firewall setup. Following that, it'll take you through installing the latest versions of Apache, MySQL, and PHP. At the time of writing, these versions are 2.4.37, 8.0.13, and 7.2.13 (discounting the very recent 7.3.0), respectively.

Read more

Generating a Joomla Password (for reseting)

I recently found myself in the awkward situation of having only a Super Admin user in the Joomla installation, and neither I nor my client knew the password. I had to the fix the problem, and I decided to do so by generating a Joomla user password (which required a lot of searching through code, mind you). Here's the PHP code I used:

// JUserHelper class from libraries/joomla/user/helper.php
$pwd = 'my_new_password';
$instance = new JUserHelper();
$salt = $instance->genRandomPassword(32);
$final_pwd = $instance->getCryptedPassword($pwd, $salt) . ':' . $salt;

(Note that I have to use the <?php tags to get syntax highlighting to work properly.)

Read more

Making a Dynamic Copyright With PHP

I though I'd just write a quick tutorial on how I make a dynamic copyright for my websites. If you don't know what a function does in the code, look it up on the PHP manual.

<?php echo strftime('%Y', time()); ?>

That's the year generating code. It's just grabbing the year from the current timestamp. So we could do something like this in the copyright:

&copy; <?php echo strftime('%Y', time()); ?> Legion of Weirdos.

You might want to wrap around the code in a helper function:

Read more