Right now I’m in the process of pruning and reorganizing my various sites a bit – mostly finishing what I started back at the end of the year, but also in consolidating a few other sites into my WordPress multisite install to make everything easier to manage.

I was just looking over plugins in preparation of bringing comedic-genius.com into the mix and I got to wondering how many of them are even still active. My multisite network as a whole currently has over 50 plugins installed, yet I’ve got to imagine that there are probably a good handful that are really only being used for one specific site…

…if they even still work at all! 😛

So I found this cool plugin – WDS Active Plugin Data – and it creates this really simple visual showing every plugin currently in the network, where it’s active, and even differentiates between single-site and network-wide activations!

Now it should just be a matter of deleting the ones not in use altogether as well as reviewing the single-site ones to see if there’s anything that can also be removed or at least consolidated with other more featured plugins.

Good stuff! 😀

Troubleshooting page load speed, part 45…

December 20, 2016 3:31pm
Tagged with:

For the record, I’m painfully aware that the page load times on several of my sites have been, well, unbearable as of late!

Admittedly it’s a problem that I’ve been stalling on for some time now, despite the regular high load emails that I get from my server. A few days ago I got one saying it was as bad as a 5-minute load average of 68.94 … and this is on a VPS with three CPUs and 5 GB of RAM that does honestly pretty light traffic right now, unfortunately…

I had been hoping that most of it could be chalked up to an OS issue because I recently discovered that cPanel had stopped updating on me after reaching a version threshold where the latest would no longer run on 32-bit operating systems, which I was kind of surprised to learn that I had, but again, this VPS was setup back in 2012 so I suppose 32-bit could’ve still been the default four years ago.

The trouble is, there’s really no clean way to upgrade my server from 32- to 64-bit leaving everything intact, so it requires spinning up a new machine and migrating everything over to the newer OS.

Plus, the way I migrated four years ago to VPS from my plain, old shared hosting account of maybe eight years was using cPanel’s built-in account transfer features, which although made it incredibly easy (plus my host did most of the work!), lord only knows how much random garbage has accumulated in all of those files over 8 + 4 years of shared history!

So I had planned on making the migration sort of a clean-up effort along the way and only copy over the guts of each WordPress install, leaving behind whatever caches and other nonsense have accumulated over the years.

And then terrible performance got even worse!!!

When it got to the point where it would literally take upwards of a minute to move from one page on my blog to another, and the admin pages would randomly get disconnected because they couldn’t touch base with the server when it was super overloaded, I knew that it was time to finally tackle this pig. So within a few hours time, I created a second VPS with my awesome web host and gradually let it go through all of the OS and app updates while I staged just one install – my multisite that contains my blog, Thing-a-Day, and about half a dozen other sites – and everything seemed to be going fine…

…until I switched my domain over to the new server…

…upon which usage started blowing up like crazy, again despite little traffic, and even though I started this new VPS a bit smaller than my main server (figuring I could upgrade once I’m ready to stop paying for the old one), it quickly became unusable just like the old machine had been.

From here I started doing some digging into WordPress itself because no longer could I point fingers at the 32-bit OS. I downloaded a couple of plugins – P3 Profiler and Query Monitor – and with the latter’s help, that’s when I noticed that apparently I had a plugin that was just GOING NUTS against MySQL day and night:

To walk you through this fun graph, the orange is your normal SELECT queries that happen when anyone hits a page and WordPress queries its database to build it; the purple, on the other hand, is somehow all INSERT queries, which should really only ever happen when I’m publishing a new post, with a few exceptions.

And those two big valleys in the purple that you see around the 18th and then again between 19 and 20? The first is when I had temporarily pointed my domain over to the new server; the second is keeping the domain back on the old server, but turning off the plugin in question … which apparently solves just about everything!

By the way, the last little purple sliver is me turning the plugin back on so that I can capture some logs to send over to the plugin’s developer to help him look for a fix…

because the thing is, I actually really like this plugin – it’s called WP Word Count and I’ve used it on just about all of my sites for years and years to summarize how much writing I’ve put into my projects. I love it, and if I can spare the time next year, I want to make use of its work to pull together a running total of word counts for all of my work combined so that I can ultimately put together a fun, little dashboard to help motivate me to keep putting words on the screen!

Luckily after finding another multisite user with the same issue, I left a quick comment expressing the same and got a reply from the plugin’s developer later on that evening, so it’s awesome that they’re actively interested in patching this bug because I’ve evaluated a lot of other options and honestly never really found ones that I liked better than theirs.

In the meantime it’ll have to stay off, though, as I continue with my fun server migration. During this whole effort, I’m also trying to really hone in on The Perfect VPS WordPress Configuration, so I’m doing other things like tinkering with Varnish and considering adding Nginx in front of Apache, and then eventually I also want to fine tune W3 Total Cache so that I have one reliable set of caching / compression / minifying rules to use for all of the different sites that I publish … because I figure if I’ve seriously been doing this publishing on the web-thing for over fifteen years now, my pages should be some of the fastest loading around!

Stay tuned for more as I struggle through more issues to come! Now if I can only get this stupid thing to post… 😛

censoring yourself for Google AdSense…

October 13, 2016 7:08pm
Tagged with:

So the other day I got an email from Google AdSense that was frustrating, to say the least…

screen-shot-2016-10-13-at-6-47-54-pm

…frustrating because admittedly until earlier this week, I haven’t even posted anything to Just Laugh for a good six months, so for the most part it’s barely even on my radar. Yet I use the same Google AdSense account for all of my sites and I don’t really want to get the thing suspended … what, for the whopping $100 in ad revenues that I somehow collect every year or so at a couple of bucks in random visitors each month! 😛

Also, it’s stupid because the post that apparently flagged this “mature content warning” was published a year and a half ago and never got a complaint until now, but whatever…

Now I just use simple text widgets to insert AdSense blocks around Just Laugh and being a WordPress site, it’s all done through templates so it wasn’t easy to just “remove ads from the violating pages.” I looked around, but surprisingly didn’t find any plugins that would allow you to omit specific URLs from receiving ad code, and apparently AdSense itself doesn’t have anything either – you can block advertisers, but not specific content on your site.

This seems weird and dumb because no doubt there are plenty of sites that publish “adult content” with “adult” meaning 18+ … not for kids and not here’s where you can buy vibrators and inflatable sex toys!

…I wonder if just mentioning those words will get this blog post flagged … in a year and a half…

Anyways, I found this simple write-up that basically has you create a new custom field and then uses an if/else condition in PHP to determine whether or not to display the ad code that you choose…

Show or Prevent Adsense ads on Selected Posts in WordPress

It’s not perfect – at least not in my layout – because I suppose if I really cared that much I wouldn’t want the Sponsors widget to display at all if it’s going to be empty anyways. An alternative would be for me to insert a house ad or something into that block so that it isn’t empty for that one post, but honestly according to my stats this specific post has gotten viewed a total of 39 times since it was published last spring, and 8 times this year … so I really don’t care right this second as long as it prevents Google from suspending my account whenever they get around to rescanning the page! 😛

One note – if you use a widget-based solution like I do, you’ll need a widget that can parse PHP because the regular Text widget in WordPress doesn’t and I made that mistake the first time around, not noticing it until I reloaded the page and saw the actual code everywhere. Fortunately I already had the Enhanced Text Widget plugin installed and it works great.

I suppose if I get more notices down the road about other inappropriate content, I can go back and add alternate ads to load as I flag the new posts, but if you just need something quick and dirty because Google randomly crawled an old post and is complaining about it, this works just fine in about 10 minutes time. 😉

jl_clean

You know what they say – any day that you launch a new website is a good day… 😉

Screen Shot 2015-11-10 at 10.24.20 PM

This is one that I actually started kicking ideas around for earlier this year, but didn’t really have the time/content/procrastination for another project at the time to drive me there. I had a very brief mockup of what you see above running on a test site, but apparently today was the day that I actually mustered up the effort to both write the first post about the recent presidential debate as well as work out the kinks for the site design itself.

…although admittedly it wasn’t necessarily in that order! 😛

Anyways, the intent of this site – whether I managed to do it justice with the first post or not – is to give me a place to write in more depth about editorial-type topics that would normally otherwise be ranty-type posts on my regular blog. Kind of along the lines of some of the better quality posts you might find on a Medium or something of that nature, I was originally thinking about trying to host them there, but the whole huge audience/no pay thing is a problem for me and doing it myself gives me the control that I like to maintain with publishing my writing online nonetheless.

The plan isn’t really to post super-frequently – maybe one article a month, at best – but I really don’t want to force it just for the sake of keeping a writing schedule. Instead I want Scott’s Thoughts to be a place where I can elaborate on topics in a manner that feels a bit more professional so that there’s really a focus on the content itself rather than tying in my humor and other writing that might be seen on my blog as more of a distraction.

You’ll also see that I ended up pulling in a small handful of really old, but somewhat related articles that I wrote in this same vein more than a decade ago. Back when Comedic-Genius.com was my primary writing site, I had a bunch of different columns that I was writing – one of which was an editorial piece called Against the Grain… In truth there were upwards of 50 columns in the series before I ended it, but upon further review there simply weren’t nearly as many worth preserving from ten years later as I would’ve thought!

Hopefully the new series will fare a bit better, though I would argue that maybe that’s just another factor of getting older that one simply needs to get used to… 😉

* * * * * * * * * *

In geek news, this site is also my official foray into WordPress multisite-ing!

My testing earlier this summer was pretty unsuccessful, but before I let myself delete the install altogether, I tried one last test creating a new multisite environment with this blog and the new editorial subdomain, and it actually worked so I just decided to keep it. 😀

My multisite network currently consists of 4 sites total – the two previously mentioned and then two more test sites for more ideas that I haven’t gotten off the ground yet. For simplicity’s sake, I decided to only worry about sites that are actually subdomains of scottsevener.com right now, so humor and mouse and Just Laugh will all stay where they are … I’ve heard horror stories about trying to un-co-mingle sites once you go multisite, so no sense in adding new stress there!

Still lots to learn – the only real big dumb thing I’ve come across so far is the difference between Network Activating Plugins vs Network Enabling Themes because apparently doing the first forces activation of plugins network-wide (which is a neat feature for the ones I use everywhere) but the second simply makes themes available to activate on a given site … terms are just a little too close for my comfort, really.

I’m curious to see how performance ranks in comparison to the individual installs, but for now at least I was able to drop my install count down to under 20!!! 😯

So I’ve been doing a lot of pondering about my writing career as a whole and how do I quantify all of this suffering via keyboard over the weekend-ish, and one of the ideas that’s been kicking around inside of my head is that maybe it’s time for me to spruce this particular site up a bit to better highlight all of the writing everywhere that I’m presently doing.

Mind you, my first thought was that maybe I needed to create an all new site to give me a place to feature special content that feels like it belongs somewhere bigger than just my blog, and then I realized that I already have too many other dwindling sites that one more might not be the best idea at the time…

The whole point of this site is really supposed to be two-fold:

  1. MY BLOG, which is just me rambling on about whatever in that classic style that I came to know and love from LiveJournal, circa 2003
  2. A COOL HUB SITE, set to feature writing everywhere – as it happens – which right now pretty much consists of RSS feeds on the front page and that’s it…

The thing is, I don’t know exactly how in depth I want to make this change because I don’t want it to take up an exuberant amount of my time and there are actually certain parts of the site that I already like quite well. Still, this theme conglomerate that I’m running now was slapped together some 4 years ago, and it’s 2015 now and responsive design is all of the rage, and there’s a part of me that likes to think that for some of the prettier posts that I’m writing with photos and whatnot on the other sites, I should somehow be able to pull those in here to make this one look all swanky and awesome and more enticing to your random clicks to those other sites, too!

…somehow…

Anyways, I guess I need to start flipping through magazine themes and see if I can find anything that jumps out at me because that’s probably the direction that I should be looking. For what it’s worth, I really like the theme that I ended up with for Just Laugh and it didn’t cost me a fortune, so I’m definitely open to paying for themes if I can find one out of the box that fixes more problems for me than it creates.

It’s tricky because there’s a part of me that likes the simplicity of something like Medium and is intrigued by the idea of a site that’s more centric on the writing than other flashy stuff … BUT I also have books to promote and I do a lot of photo posts about Disney and whatnot, so in the end I don’t really think that a one-size fits all solution is going to work for me here. Not to mention the fact that it somehow needs to incorporate posts from all of these other sites like they were live on this one … I have a feeling that might be tricky and what I don’t want to do is start importing posts from all over the place just to have them populate on my hub site correctly.

This is by no means anywhere near my top priority, but as I try to get myself posting regularly everywhere in the second half of the year, I’d like to have something that can better showcase all of my thoughtful writings. 😀

We’ll see…

WordPress vs. DSO & APC

July 17, 2014 6:13pm
Tagged with:

I’ve put off writing this post for a while now, partially because I’m still not sure that I understand it and partially to make sure that my “fixes” that I’ve put into place actually work! 🙄

So about a year ago I started having issues with the server that runs all of my websites running over-utilized. It was a big, nasty affair that we had a hard time tracking down, on top of being a nightmare because we were supposed to be celebrating my birthday over at Disney after having just started our second round of IVF with the embryo which would eventually become Christopher … needless to say, it was VERY stressful!

After we got things back up and running again, I spent about a week researching how to make sure that it never happened again and one thing that I dove heavy into was caching. There are some plugins that are decent, but you can also do caching at the server level on top of all that and this is where I met my new friend, APC

Now, the good thing about my friend APC is that it’s extremely efficient at what it does – like, it’s one of the best PHP accelerators you can run. Facebook uses it, which sometimes you wouldn’t know, but still, even I can’t deny that they’ve got a fuckton more users than I’ll ever have, so I’ll take their word for it! 8)

Of course, the bad thing about APC is that you have to change the way that PHP runs on your server to enable it … or at least I did. And that’s where the problems began…

Normally most shared environments will run under the SuPHP handler because it’s secure in the way it runs scripts under the users that actually own them. For WordPress, this makes permissions simple because everything just works right out of the box as it always has for me for the past blorgteen years.

Now to run APC, however, I needed to switch over to DSO, which from a security standpoint didn’t seem like a big deal because I run on a VPS, not a shared server now, so there’s not really any risk of “other users” running anything on my machine because there simply aren’t any.

That said, what DSO does do is royally hose up permissions in WordPress because the settings that it needs to upload images, edit themes, update plugins, etc… don’t work because now the web server runs as a separate user (“nobody”) instead of whatever user happens to own the files that it’s trying to execute.

…SOOOOOO…

I finally decided to spend some time digging in to fix this. For a few months, I actually did this very much the wrong way by chmodding the uploads folders of the main sites I was using at the time to 777 … which is bad, so don’t do that!!!

Instead, it seems that the solution wasn’t too crazy after all – to fix the file uploads, I just did a chown -R nobody:nobody uploads and that cascaded the new ownership recursively through all of the subfolders … no need to change any actual permissions, except to change them back from 777, anyways!

I was also able to do this for my Disney site that runs NextGEN Gallery and the results were the same (sorry, can’t remember the specific folder, but it’s in there somewhere!).

Now as for plugins and theme updates, this got a little trickier because I tried the same above and that didn’t seem to work, and I really didn’t want to open up permissions on these folders … even though there’s apparently a way to mask them back to normal by inserting something like these into your wp-config.php file:

define('FS_CHMOD_FILE', 0755);
define('FS_CHMOD_DIR', 0644);

Instead, I inserted these into my wp-config.php file…

define('FTP_HOST', 'localhost');
define('FTP_USER', 'username');
define('FTP_PASS', 'password');

You may have noticed as I did many times throughout this ordeal that if WordPress tries to make an update, but can’t because it doesn’t have the right permissions, it will jump to a screen asking for FTP credentials and then make the changes it wants to do via FTP instead. For the longest time I just entered these manually out of frustration, but now that I think I’ve settled on as close to a “solution” for this as I can get, the above three lines prevent it from prompting me for credentials and I’m now able to install, update, and delete plugins and themes from within WordPress just as if I was running under SuPHP!

Admittedly, I am a little curious to know if there are any other security flaws with having some folders owned by nobody, but from what I can tell it’s still feasible and loads safer than 777. And I get to keep running APC, which I’ve now thrown enough memory at to keep roughly 99% of the php files from all of my sites caching out of system memory instead of parsing off the disk, so that’s a nice little speed improvement that you may have noticed around here!

…but if you do know something I should know about setting up permissions and ownership this way, do be a good samaritan and let me know, though, would ya? Right now I’m cautiously content … so take that for what you will… 😕

WordPress Theme Malware

June 29, 2014 7:16pm
Tagged with:

I’ve been working on a new WordPress redesign for one of my sites this weekend because my head just hasn’t been in the place to get much writing done, and for whatever reason I somehow stumbled onto this article from a few years back that talks about the dangers of malware within a WordPress theme and why it’s so important to download your themes from trusted sources, or ideally directly from the free theme repository hosted by WordPress themselves…

http://ottopress.com/2010/anatomy-of-a-theme-malware/

I mean, I’ve come across the themes that use a little trickery to preserve the SEO spam links that they’ve sold and built into the footers where they typically create a function to look for those specific links that won’t display the site if it doesn’t find them, but reading through the example above, I never would’ve thought of something as elaborate as concealing a piece of code at the end of an otherwise expected preview image, then breaking it back out on the fly and searching for places to execute it to create a backdoor into the server that is triggered by the attacker setting a cookie and then simply visiting your site … it’s really a pretty crazy scenario if you’ve got a few minutes and you know enough about PHP to follow along!

I know that every so often when I notice something odd on my server, one of the first things my mind jumps to is whether I did something stupid that opened myself up to being hacked. So far I’ve kind of lucked out and they’ve been fairly benign – once I got a notice for sending spam because I had created a test email account a long time ago with “test” as the password (?!) and then forgotten about it … and somebody else found it. Another time I actually found a piece of malicious code in a random sub-directory that was a little creepy – again for sending out spam.

You like to think, “Bah – I’m nobody and my sites hardly see any traffic … who would bother targeting me?!” But a quick check of the logs is all it takes to reinforce that most web attacks aren’t really targeted at all … they’re just randomly scanning for machines that can be compromised, sometimes to be used for DDOS or spam boxes, and no doubt sometimes just as another notch in the bedpost to see who can infiltrate the most systems.

As if we didn’t have enough to worry about around this crazy, mixed up interweb! 😉

Happy Birthday, WordPress!

June 1, 2013 10:46am
Tagged with:

So I haven’t been using WordPress for 10 years, but even despite my late arrival to the game, it turns out that my now favorite CMS officially turned 10 years old a few days ago.

It actually wasn’t until around 2008 that I first discovered WordPress and began using it first for my humor site, and then eventually for everything else. Before that I had used a myriad of home brew options … obviously, I used LiveJournal for my personal blog, something where I copied all of my posts into PHP files as text for one (maybe an early PHP-Fusion?), I think I toyed around with Drupal at one point, but it ended up being more confusing than I could deal with at the time!

So needless to say, I was a little skeptical when I stumbled across WordPress simply because I’d been so used to doing everything the hard way all of those years. It was weird to have an interface that wasn’t Notepad to work in, and even though I’ve still spent plenty of time tinkering with plugins and themes to get my sites where they are today, it’s meant a lot more time actually spent writing as opposed to fighting with code for simple, core features, and really at the end of the day, I’d much rather be writing than creating a system to facilitate writing, anyways. 😉

I’m very grateful for all of the amazing work that goes into WordPress, and even infinitely more so that it’s all available to me free of charge. It’s really crazy to see just how vast the open source community is with regards to WordPress, and it’s something that I have to actively push myself to keep in mind so that when I manage to figure out something new and cool on my own, I too share it forward for other people just like me.

So in five years time, I’m now running WordPress on 10 different sites, across which I’ve published an excess of 1.5 million words. WordPress makes it easier for me to share my writing with the world, and in celebration of this 10-year milestone, I for one am looking forward to seeing what Matt and his team manage to come up with over the next ten years!  :mrgreen:

Congrats, and thank-you, guys.

I just upgraded this blog to 3.5 on a whim as I was writing tonight and although the new Media Manager seems kinda cool, I hate that they removed the max embed size from the Settings menu and are now apparently just deriving the content dimensions for embeds from your theme directly. I mean, it sounds cool in theory, except that WordPress somehow came up with a 640 pixel width out of my theme, whereas I wanted the limit set to 575 px … I’m guessing that maybe it doesn’t take margins into account or something?

Anyways, in the meantime luckily I found a quick, little function that overrides the oEmbed settings and lets you set your own instead – here’s what I ended up throwing into my theme’s functions.php file to get things looking back to normal again…

function example_custom_oembed_dimensions($html, $url, $args) {
 
// Set the width of the video
 $width_pattern = "/width=\"[0-9]*\"/";
 $html = preg_replace($width_pattern, "width='575'", $html);
 
// Now return the updated markup
 return $html;
 
} // end example_custom_oembed_dimensions
add_filter('embed_oembed_html', 'example_custom_oembed_dimensions', 10, 3); 

WordPress Santa Smiley!

December 13, 2012 12:22am
Tagged with:

So you noticed that cute, little guy at the end of my last post, did ya?

:santa:

He was actually pretty easy to add to the standard smilies catalog in WordPress!

  1. Just save the image above and upload to /wp-includes/images/smilies/
  2. Then add a new line to the end of the array in /wp-includes/functions.php (assuming WordPress 3.0+; I believe you want /wp-includes/vars.php for earlier versions)
':|' => 'icon_neutral.gif',
';)' => 'icon_wink.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
':santa:' => 'icon_santa.gif',

Now I should note that if you happen to be using a smilies plugin like I realized that I am here, you’ll likely need to do step #2 in the config file for that plugin instead. I’m using Smilies Themer, so the file I ended up updating was /wp-content/plugins/smilies-themer/default/package-config.php.

You’ll also probably notice that this particular icon is just a tad taller than the standard WordPress smilies, so it tends to throw off line heights if you’re using a default. I thought about scaling it down a bit to try to put it in line with the others, but you can just as easily put it on its own line and it saves you a trip to the Photoshop! Nonetheless, it seemed like a fun, little way to spruce up your WordPress blog around the holidays – enjoy…

:santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa: :santa:

© 1999 - 2017 Comedic-Genius Media, All Rights Reserved.