Archive for the ‘php’ Category

PHP and stuff

Lately I have been working so hard that I haven’t even had any desire to do any fun computering at home. Today that changed a bit.

I decided this morning that it was high time I upgraded my all time favorite rss feed reader, tiny tiny rss. Well, wouldn’t you know it, after I did the install I found it required a version of php higher than I had available on my server. Time to upgrade.

I run Centos 5 on my main server and, by default, that carries a php 5.1.x. I needed 5.2 or greater. As it happens, php 5.3 is available in the repos, so I did the upgrade. For the uninitiated, that entails doing a “yum list installed | grep php”, which gives you a list of what you *have* installed. Next you remove php by doing “yum remove <and name all the packages in the prior list here>”. This, followed by “yum install <list of files for php 5.3>”. For example, I had php-common.i386 and php.i386 installed, so I did a “yum remove php-common php” and then “yum install php53-common php53” to get all my php 5.3 packages on there. This was followed by a quick “service httpd restart” to make sure my webserver was using the new version.

Murphy’s law states that “something will go wrong if it can”. Well, *MY* law states that “something will go wrong”, and it did. As it turns out, I had built a whole bunch of php applications maybe 7 years ago that my wife uses almost daily. In the olden days of php, you could declare a php script at the top by doing a “<?”. NOW, you need to declare it by doing “<?php”. Consequently, nothing I had written worked. It only took me a minute or two to identify why the problem was occurring, but fixing it was another story.

So, how do you find all the files you have to fix? Well, I used the “grep” command. More specifically, egrep. I went to my html root directory and searched by doing “egrep -r “<\?” * | egrep -vi “<\?php” | egrep -vi “<\?xml” | grep -v inary”. What does all that do? The first stanza looks recursively through the directory structure at every file and outputs the ones that have any “<?”‘s in them. The second takes that output but does NOT pass through any that are “<?php”. Why, because they would already be ok! The third takes the results and doesn’t pass through any that contain “<?xml”. The last one doesn’t pass through results from binary files. The end result is I had a list of directory / file / line information of all the files I had to change / update. A few minutes later, after using vim, the best text editor around, I was back up and running!

Saturday, July 14th, 2012

PHP 5.3.X on RHEL 5 / CentOS 5

PHP

PHP

Another one for posterity here. I was asked to find out how to upgrade on PHP RHEL 5 / CentOS 5 to v 5.3.x and to test the procedure. It turns out to work pretty well and is not as difficult as you might think as long as you have the right repositories enabled:

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh epel-release-5-4.noarch.rpm
rpm -Uvh remi-release-5.rpm
yum –enablerepo=remi update php php-* mysql

This, of course, assumes that your LAMP stack is already installed. If not, you would change the “update” to “install” and away you go. This will currently set you to php v 5.3.3 and mysql 5.1.51..

Thursday, October 7th, 2010

The NEW Oldest Linux Show

NewTLLTS

NewTLLTS

  I don’t even remember where the idea came from, but it was decided that after 365 shows, that’s one for every day of the year, folks, that we would consider that “season 1” for the LinuxLink TechShow, and we would then, finally, start on “season 2”. Those 365 episodes comprise 7 years of weekly recordings and add up to roughly 30 days of continual audio, day and night. I guess you could say we have been doing this for a while….

  Since last year’s Ohio Linux Fest we have had a few TLLTS Elders meetings to decide upon what we saw as the problems of the first TLLTS season, what we could do to fix them and what kinds of things we wanted to pursue for season 2. We tried to take into consideration the things we had positive and negative comments on from our listener base and years of our beloved “hate mail” 🙂

  First and foremost we needed to address our constant audio issues. Long have we had complaints about our audio so we needed to make that a priority. We do have a very complicated setup in that area due to our arrangement of multiple hosts and guests in multiple locations, local and remote, not to mention the extra issues caused by being a live show, which causes us to add even more audio sources. You see, we don’t postprocess audio and dub things in later like promos and intro/outros. They happen as we roll along live, just like everything else. As it turns out though, a lot of our audio issues were actually caused by NOT using the Linux built in goodies. They were caused by our analog setup (mixer, compressor, cabling, etc..) Once we identified that we actually could remove that mess all together and just go digital, things got a lot better pretty fast.

  Other and maybe minor things we needed to address had to do with the loose format of the show, the show and guest planning and general preparedness, the timing of things during the show, regular guest hosts, the website and things of that sort. Boy, there sure were lots of things to work on!

  We decided that we needed to tighten things up a bit with the show format. We settled on trying hard to keep the show times from 8:30pm to 10pm (and no longer). We want to try and divide the show into sections, giving time to any interviews we may have while still sequestering some time for us for a little discussion as well. We decided on using some music as a separator, much like we did early on in the show – an intermission. An exciting addition here would be the possibility of also adding in some “shorts” or short topical audio segments dealing with our hosts specialty subjects. These would be not only a way for us to facilitate an important break in the show, but a way to generate some interest in a recurring topic and also provide a possible stepping stone into the hosts discussion on the second half of the show.

  We decided we would like to get not only some more good new guests, but also to revisit some of our wildly interesting past guests to see what they have been up to. Luckily, the ones I have contacted thus far have not only remembered us, but have also agreed to stop by again to say hello 🙂 Make sure to check the calendar for who’s coming up and send along your suggestions of people you would like to hear from!

  One of the major things I was tasked with working on and updating was the website. I thought the old one was fantastic, mostly because I designed and coded it, but the other hosts assured me it was time for something new 🙂 I pursued the great and famous Richard Querin who graciously came up with a great looking front page and theme and sent it to me. A little php work and content by Dann and I and you have the masterpiece you see now.

  I have to say that I really enjoyed doing the show for the last seven years. I get to talk shop with my buddies every week. I get to talk to really cool linux/open source celebrities. I get to meet and make a lot of geeky friends from all over the world, people who I have come to consider as almost family ove the last 7 years. It has been a helluva fun ride and I am eager to put a good start to the next 7, so make sure and head on over to http://tllts.org and join in the fun. The prelude to season 2 was recorded and put up for distribution right at the end of OLF 2010 and the official start happens 9/15/2010 @8:30pm EDT. See ya there!

Monday, September 13th, 2010

My Web Workers Toolkit

Ahh, it’s been far too long since I have had anything to say here. I have to say that I have been *legitimately* busy this time. As many of you know, we have come to a close on the first season of The LinuxLink TechShow. That’s 365 (about) 2 hour long episodes over the course of the last 6 years. We are due to start our next 365 at the Ohio Linux Fest in a month. This leaves an enormous amount of prep work and a fair bit of reorganization to keep things exciting and help us start out with a bang.

One of the *surprises* in store brings me to my current topic at hand, my web workers toolkit.

People all have differing opinions about what you really need to do decent web work. As an old commandline jockey, I thought I would share my own.

1) Vim.
Quite possibly the best text editor in the world, I use vim for darn near everything. As a system administrator, it’s indispensable (for scripting) and I find it similarly necessary for web work. Vim has a fantastic (imho) syntax highlighting system which does quite well for html and php highlighting. The only caveat is to make sure to set “set background=dark” in your .vimrc file, unless, of course, you are one of those wierdos who uses a light background in your terminal.

2) tidy or the w3c validator.
I DEFY you to write good code without one of these. There is NOTHING as nice as standards compliant code and without a good validator, you will have nothing like standards compliant code. The reason I listed both of these is that tidy is a program you can use locally to check your code and the w3c validator will check any pages that are accessible via the web.

3) Many different browsers.
Unfortunately, all browsers are not made equal. You can be sure that all mozilla based browsers like Firefox, etc., will display things very similarly, and maybe even throw Google Chrome into that mix, but you may really want to check your code with Safari and IE to be sure things still look the way you had intended, and let’s not forget about a text browser like lynx or w3m to make sure your pages are readable and navigable that way too.

4) Lastly, for me, some good reference material.
One can hardly be expected to remember everything and having some reference material handy for those odd css commands and perhaps php/perl/python/someotherprogramminglanguage could really save you some time and frustration. Never underestimate keeping your old code around for example and never ever underestimate the power of the power of the Google Search!

In a nutshell, that’s generally what keeps me cranking out websites and webpages. What kinds of things do you use? What am I missing out on? Send a long a comment and let us all know what works for you! ( Unless, of course, you use emacs 😀 )

Tuesday, August 17th, 2010

Coding FLB style.

In between bouts of making Linc’s World Famous Potato Soup, I had a few minutes to do some catch-up coding today on FreeLinuxBox. It desperately needed an rss feed, so that is what I coded up. How else are you supposed to know there is new stuff there right? Well, all finished and added the feed to LinuxPlanet.org, which you should be subscribing to if you aren’t already 🙂 If you are just looking for the FLB feed, you can find it at http://freelinuxbox.org/rss/rss.php.

Speaking of Free Linux Boxes, Russ, The Techie Geek, was the latest person to put a box up on FLB and he has a GREAT idea. He wants local pickup (because of weight no doubt), but he said he’d be wiling of delivering to the Ohio Linux Fest. Outstanding idea. If you, like me, have some boxes you are putting off giving out because of the hassle in shipping, perhaps following Russ’ example could be the answer!

Saturday, August 15th, 2009

Php Twitter Identica Laconica

ptl
A while back I wrote a little bash script called IdentiBash, which, oddly enough, let me post and read to/from my lacomica account via the bash command line. Well, as of late I decided that that script really didn’t work very well with the xml/rss style feeds. It needed updating. Instead of turning to bash again it occurred to me that php5 has simplexml built in now. Well, that makes things really easy! In just a few minutes I cranked out a command line php script that will let me grab posts from Twitter, Identica, and Laconica servers. It works like a top too. The script is not complete yet as I am not sure quite yet what else I really want it to do and how I want it to handle those things, but it is a great start to any such project and I thought I would share. Especially for those people still using IdentiBash, this reader works much better and it’s really easy to expand upon if you are at all familiar with php. So here you have it, “ptil.sh”..

By the way, if you do anything wonderful with it, let me know, I’d like to see!


#!/usr/bin/php
/tmp/tweet.tmp");
$rss = simplexml_load_file("/tmp/tweet.tmp");
foreach ($rss->channel->item as $item)
{
echo "---------------------------------\n";
echo $item->pubDate."\n";
echo $item->title."\n";
}
?>

You’ll notice 2 puburl lines in there. The first is how I access my account in laconica/identica and the second is for twitter. They are given as examples and you’ll have to replace with your own urls. Simply put your info on the appropriate spots, make it executable and run it from the command line.

Friday, August 14th, 2009