… and discovered that we can happily now have a chance incorporating these functionalities into PHP serverside logic into the future. We tested this with a tweakedmbstring_test.php“old way” live run and “new way” live run via the writing of a couple of “proof of concepts” …
… and if, in doing this, you find a reference to the “mbstring” Multibyte String Information functionality existing, you are a lucky candidate to introduce some internationalization code into your PHP code, for those occasions where the destination language uses a UTF-8 character set where individual characters can not be described by the ascii character set from decimal 0 to decimal 255. In other words, it takes more than one byte to describe each character of the language. There are many languages like this, a few being the Chinese languages, Japanese and Korean.
We followed a lot of the advice of the very useful link (thanks) to create some PHP called …
… where we show what we always suspected but were too shy to ask, and didn’t flesh it out before … doh! … you can’t split a Chinese phrase’s characters into their individual characters and expect those characters individually translated bring you back to the sense of the Chinese phrase to start with.
So we take the Chinese phrase 火车票 (which translates into English as “Train tickets” … and we thank Google Translate for help with all this) and use PHP mbstring’s mb_str_split to properly split the Chinese into its constituent multibyte (UTF-8) characters (and along the way, show that PHP str_split messes up this same task, as you’d probably guess would happen), and then translate all these into English using Google Translate, as an intellectual exercise.
If this exercise makes you …
a) fall on the floor laughing
b) hit a gong with a huge hammer
c) cook up some deep fried dumplings
d) put the left chopstick in the right ear and the right chopstick in the left ear (please ask for adult supervision) … translation: do not do this
e) while reading you sweep the cat under the rug (no animals were harmed in the making of this blog posting)
… then we’re here to tell you that you need to take a Bex and have a lie down.
We are just showing in PHP that if the mbstring functionality is available to you, that the mbstring library of functionality can help with some Internationalization issues you may be grappling with and that this PHP code you could try via this live run link.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If you maintain a computer it can be reassuring to have access to some quality Malware Scanning functionality (often part of an AntiVirus suite of functionality located, for us, in amongst the cPanel functionality of our AlmaLinux WHM Linux web server software parts). So it is with our “soon to be” RJM Programming AlmaLinux web server, which has provided us with ImunifyAV …
We’ve used ImunifyAV a few times, now, on our AlmaLinux web server, and find it easy to use, starting a session scanning …
/home*/*
… folder specification, which covers the public parts of the RJM Programming domain reach.
But we have come across some false positive Malware readings …
How do we know? It’s the combination of …
what it suspected was inhouse code … and …
we stopped it being flagged as “malware” via …
copied the code to a newly created folder (for speed of scanning purposes)
found that for two inhouse code examples, now, by changing codelines that used to look like …
[some code statement]; // thanks to https://[domain]/[requestURI]
… to …
[some code statement]; // thanks to https [domain] [requestURI]
… and the fact that this took the code off that “malware” suspicion list made us think that “signature based” malware checking can throw up very occasional false positives
delete this code and its temporary folder
make the changes to the original code
rerun the /home*/* (or subset) scanning run, to reassure
So, if a small number of these inhouse examples are found we recommend not panicking, and checking each one out for these “what must be signature based” Malware Scanning accidental “false positives”. Else if still flagged … panic! But seriously, you may need to examine further, or quarantine, via deletion perhaps, or purchase more ImunifyAV functionality that purports to fix such malware issues.
Malware (a portmanteau for malicious software) is any software intentionally designed to cause damage to a computer, server, client, or computer network.[1] Malware does the damage after it is implanted or introduced in some way into a target’s computer and can take the form of executable code, scripts, active content, and other software.[2]
… and as such, should not be confused with another security concern called “computer viruses” … Wikipedia again …
A computer virus is a type of malicious software that, when executed, replicates itself by modifying other computer programs and inserting its own code.[1] When this replication succeeds, the affected areas are then said to be “infected” with a computer virus.[2][3]
Confusion could mean that you think a “computer virus” scanning system will protect you from Malware. If the scanning product doesn’t say so, it doesn’t. On our MacBook Pro we got offered the chance to try out a Malware controlling piece of software called Malwarebytes, and we’ve been using its simple interface to scan for Malware at regular intervals. We like it, and think you may like it too … hence the blog posting, for your perspicacious self, like.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
… combination of products. Once arranged, given we had the Spotify app and subscription organized already (as we alluded to with Spotify Bluetooth Speaker Volume Tutorial below), and that is pretty simple as far as Sonos goes (it’s Era 100 pamphlette describing it …
1 Connect the power cord
2 Download the Sonos app for setup
on our iPhone with the Spotify app associated with the subscription and used to set up the Sonos speaker (and we’re not even going into some additional Wi-Fi functionality available too) …
Settings -> Bluetooth … tap (hopefully) On >
as required, if Room Name (SONOS) “Not Connected” tap to make it “Connected”
open Spotify app
pick music to play and tap it’s icon …
tap the Play button (perhaps only this once, for the day (and as a sometime media interfacing iOS programmer, that is a feat!))
That’s it! But let’s just hope all those great and entertaining musicians are getting rewarded appropriately too.
playing music through the bluetooth speakers … we find we want to …
change volume
? Do you think I can nail that last step?! I mean, that last step confounds me every time! Maybe this blog posting can help me, and maybe you, to commit to memory, where on Spotify you can get to change the volume on those bluetooth speakers …
There's a bluetooth icon down near the bottom of the screen a little right of centre (with special consideration for people who think Spotify is all smoke and mirrors)
… which gets you to a draggable volume controller. Yayyyyyyyy!
Spotify has changed the way a lot of us listen to music online. The huge pull for its audience are the number of arrangements it has with music labels to be able to build a huge music repository publicly available online.
Using Spotify though, the easiest way to arrange the music playing is via a “Shuffle Play” of the songs of the sources you choose, whether that be by individual artist or podcast or album or genre. Some albums though, at least to our mind, are like a story, and they have been developed with a purpose or theme in mind, and as such, can be best played in the song order chosen by the artist or that artist’s agents, for that album. Don’t think there are any buttons as such for this on the Spotify app, today’s video showing the iOS app version on an iPhone. But this is possible, and the purpose of today’s tutorial is to talk about the Spotify “play queue” and in the process how to achieve this.
Clear the existing queue first by …
Tap on song currently playing
Tap top right icon … shows songs on the queue
Check all the boxes on left
Tap “Remove” button at bottom left to clear the queue
Go back with down arrow top left icon tap
Search for album name via bottom magnifying glass icon tap … type in album name in resultant textbox … go (swipe) down to Album section and tap the album
Swipe to right on each song of that album in order … and a “Queued” message will briefly verify that operation
Optionally choose more music to be queued up by returning to step 2 above
Your choices will be played in that order after any currently playing song
Have a geek at this demonstrated by us, below …
We hope this might be of some use to some Spotify users out there! Happy listening!
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
AlmaLinux SSH Access Fail2ban and Firewall Protection Tutorial
For us, we just want to get on with the programming. But what if something is welling up, that might stop you “getting on”?
We saw this on our “soon to be” dedicated virtual AlmaLinux Apache/PHP/MySql web server, for RJM Programming, where we use SSH (Secure Shell) to access and get to a command line environment on that AlmaLinux web server via (no secret anymore) …
ssh -p 22 root@65.254.95.247
But what is a secret is the ensuing password needed to log in. Worrying us, though, lately, was dialog such as …
user@MacBook-Air htdocs % ssh -p 22 root@65.254.95.247
root@65.254.95.247’s password:
Last failed login: Fri Aug 2 20:49:45 EDT 2024 from 180.184.139.166 on ssh:notty
There were 157 failed login attempts since the last successful login.
Last login: Fri Aug 2 19:20:56 2024 from 60.227.219.39
[root@65-254-95-247 ~]# exit
logout
… “greeting” us as we logged in. We dislike the advice online to configure SSH access away from port 22 (though we’re sure it could help some), so? If you’re into security you will know the term “SSH Brute Force Attack” …
An SSH brute force attack is a hacking technique that involves repeatedly trying different username and password combinations until the attacker gains access to the remote server.
Well, yes, our password is good, but if you were me, would you want to put up with this when, given the way you can trust yourself with the remembering of your own high security passwords, you have these great informative, and reassuring, websites like Fail2Ban install tutorial for Linux (AlmaLinux) that give you great step by step ways to …
on AlmaLinux style web server …
as required, install (oh, that’s what that is … from CentOS roamings) “fail2ban” and “firewalld” (we touched on the “feel for” with previous CentOS based WHM cPanel cPHulk Firewall Primer Tutorial) … and then, the all important (and we recommend if all this is new, to take the advice of others) …
configure fail2ban and fail2ban-client and arrangements regarding ssh login access
For our CentOS Linux Apache/MySql/PHP web server for RJM Programming, we needed to reboot the Apache and MySql services, via the use of an unusual (at least for us, because we couldn’t get graphical WHM cPanel access working) combination of …
Power Management … Stop and Start the VMWare Virtual Host … followed by …
ssh command line access means by which to restart Apache and MySql services (and we like this link as a services list checklist, thanks) via …
service http restart
service mysql restart
… and even a …
service cpanel restart
… would not allow our graphical based WHM cPanel access happen, us getting, instead, when trying to access the usual Safari web browser address bar way, the error message …
The connection timed out. Please try again.
Weird! Anyway, researching this (but please note all along, we suspect we may have been able to solve the issue by closing the Safari web browser and reopening and retrying it) we got onto the topic of …
Web Server Firewalls
… associated with (what might be a “service” for you) cPanel’s cPHulk software.
We looked into cPHulk, and decided to Stop and Start cPHulk finding great “Stop” advice here, getting us to go, while still in ssh session …
… successfully back at our graphical cPanel session. Then we clicked the “cPHulk is Currently Disabled … Enable” button to successfully get the Firewall functional again. Phew!
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
… we admire your panache, but if you’re the duck wading through the near shoreline weeds, and the legs aren’t working too well …
Life wasn’t meant to be easy.
We picked the interfacing to the Google ChartGeo Chart inhouse interfacer PHP web application as our opening gambit, figuring it would have extensive issues … and it did not fail to disappoint in this respect …
… 3 hours later …
What can we say? As a precis …
$_SERVER[‘HTTP_REFERER’] is deprecated
$_GET[‘alabel’] and/or $_POST[‘alabel’] type “globals”, if undefined, should not appear that way (nor other undefined non-global ones), exposed, unless, maybe, with a ternary PHP isset based intervention, you check for existence dynamically so as to avoid this “exposure”
And what was our great friend here? No need for any PHP debuggers, just good ol’ Google Chrome web browser Web Inspector debugging was fine and PHP errors and warnings would be derivable via PHP statements output and available through the Web Inspector tab called “Console”.
Yes, we’re migrating again (as we were talking about with Apache/PHP/MySql Web Hosting Website Migration ssh Tutorial), though as you read this blog posting, if hot off the press here on 19/7/2024, we’ll not have transferred the DNS over yet, which we’ll outline the reasons for into the future. But, today, we’re excited to outline some steps after …
data migration … which our web hoster, Crazy Domains, did a good job regarding … ahead of …
seeing HTML and Javascript and CSS working fine straight away … and today’s progress migrating the WordPress Blog (involving serverside PHP and MySql) you are reading now …
… in terms of a migration consisting of (just in terms of major players) …
… that PHP leap very big (and we were near an edge regarding PHP 5.4.38 where a WP-CLI approach as below can still work … some earlier 5’s will not work, we were told along the way), and trepidatious, to our mind, but at least for WordPress, now working, via (just highlights, and we’ll leave out that it is great to have a backup of the MySql WordPress software and database ideally, before starting (because we already had one courtesy of the data migration above)) …
install WP-CLI … via ssh -p 22 [adminUser]@[newIPaddressForRJMProgrammingIntoTheFuture] … profuse thanks to this great advice …
# cd ~[websiteUser]
# cd public_html/ITblog
# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
# php wp-cli.phar --info
# chmod +x wp-cli.phar
# mv wp-cli.phar /usr/local/bin/wp
just install the WordPress Codex software in wp-admin and wp-includes … via ssh -p 22 [adminUser]@[newIPaddressForRJMProgrammingIntoTheFuture] …
# su - [websiteUser]
$ cd ~[websiteUser]
$ cd public_html/ITblog
$ wp core download --force --skip-content
iron out just the one (yee, ha) plugins and/or theme issues that can occur entering a URL such as https://[newIPaddressForRJMProgrammingIntoTheFuture]/ITblog into a web browser address bar … removing …
New Google Plus Badge Widget
… plugin folder and files, because it’s name was apparent in the error message in the video below, and once done WordPress 6.6 starting looking like it’s old self … yee, ha …
amend wp-config.php to add in code statement … thanks to this great advice …
define('RELOCATE',true);
… meaning URLs such as https://[newIPaddressForRJMProgrammingIntoTheFuture]/ITblog just address data and software on [newIPaddressForRJMProgrammingIntoTheFuture] proposed new AlmaLinux9 web server (rather than ducking off to https://www.rjmprogramming.com.au/ITblog/ or https://[oldIPaddressForRJMProgrammingFromTheNearFuturePast]/ITblog/)
on our way to WordPress admin section via https://[newIPaddressForRJMProgrammingIntoTheFuture]/ITblog/wp-admin into the web browser address bar …
WordPress MySql database was updated (to align with PHP 8.1.19 and MySql 8.0.38 and WordPress 6.6 requirements)
in WordPress admin section General Settings make sure both WordPress Address (URL) and Site Address (URL) get mapped to … https://[newIPaddressForRJMProgrammingIntoTheFuture]/ITblog
… during our migration phase, at least
practice writing …
Blog posts
… in WordPress Code editor (showing HTML, as we are most familiar with, but you can edit in a visual mode of use, if you like)
Feel free to see some of what we did here in video below …
Apache/PHP/MySql Web Hosting Website Migration ssh Tutorial
One of the most amazing aspects to the Crazy Domains performed data migration for the RJM Programming domain on 17/1/2023, thanks, was the way, from our point of view, it was …
Changed
No change
IP address
Any usernames
Power management
Any passwords
DNS mappings
ssh access (just with changed IP address slotted in for old one)
sftp access
cPanel access (just with changed IP address slotted in for old one)
… with so little affecting our day to day interactions with the website.
And so, on this topic, adding to the recent Apache/PHP/MySql Web Hosting Website Migration DNS Tutorial we want to hone in on that Any usernames and Any passwords resisting any need to change. How so? Well, it’s to do with how ssh and sftp and RSA keys and Fingerprints work. Let’s ask experts some questions.
An SSH key relies upon the use of two related keys, a public key and a private key, that together create a key pair that is used as the secure access credential. The private key is secret, known only to the user, and should be encrypted and stored safely.
That “stored safely” is the key (chortle, chortle) to the cleverness of the system. The key is stored on the same web server disk migrated, and so access to a username’s previous password is maintained that way.
Secure Shell (SSH) uses a fingerprint generated with the unique server host key so that a client can identify the server. Whenever the host fingerprint changes, SSH issues the following warning: The host fingerprint can’t be verified or it has changed. When you configure the SSH server, the host key generates randomly.
And so, we can see that the fingerprint mechanism can help the user authenticate, and have the key refresh itself, in the new web server IP address environment, as you can see in today’s tutorial picture.
The Domain Name System (DNS) is a hierarchical and distributed naming system for computers, services, and other resources in the Internet or other Internet Protocol (IP) networks. It associates various information with domain names assigned to each of the associated entities. Most prominently, it translates readily memorized domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols.[1] The Domain Name System has been an essential component of the functionality of the Internet since 1985.
… steps that represented that final “tying the knot” of repositioning the RJM Programming domain to a new IP address and allowing cPanel and ssh and sftp website access methods not have to change regarding username and password usage, just IP addresses, perhaps totally “behind the scenes”. Think of it like a “renaming the underbelly” exercise, perhaps!
Until these DNS settings are adjusted in “A records” up at the web hoster by the Webmaster or Web Hoster, and there is, typically, about a five minute wait afterwards, the website cannot be reached via your usual …
We were wondering if Linux (and can work on unix) soft links, as talked about with Linux and Unix Soft Links Primer Tutorial, can be of practical value pointing to the source code of a webpage. Perhaps you’d want to do this regarding restrictions applied to executionable server code, such as PHP.
We decided to try this with our new AlmaLinux9 web server (cded to web server Document Root) via …
Are there big differences between the Linux and Unix operating system, and Windows, for example? Deep at the heart of the very file orientated Unix and Linux operating systems (where just about everything can be boiled down to being about files) are the possibilities presented by Soft Links (or Symbolic Links), a concept missing in the original design of Windows/DOS. So, as is pretty apparent, there are some huge differences, which partly explains the passion some people feel for their favourite operating system … or favourite anything … it is the “tribal” in us methinks.
For myself, prefer to marvel at the good bits of (the whole gamut of) all these approaches to software (and cherrypick the appropriate/good ones for any particular problem/issue), and have to say, Soft Links, as a concept, in Unix and Linux, was (and is) one of the best things ever invented, and if it was everywhere (on other operating systems) who knows, maybe there would have been some internationalization on this area of I.T., and approaches could have seen the concept used more powerfully (and fully) than now (mind you, maybe it is, and I just need somebody to share their deep insights?! … please feel free, in the comments) in cute ways that would have opened up many more useful ways to program code that is cross-platform-friendly (or “networked”).
Let’s see some Linux and Unix Soft Links Primer Tutorial steps of interest, hopefully. These are presented via a Mac laptop’s Terminal application, whose default shell environment is Bash.
Link to some downloadable code … rename to soft_link_tutorial.sh (bit specific to local conditions, but please tailor for your own use).
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.