Save info   Get password
Home Submit your blog Edit Account Rules RSS-Archive Contact


Using PHP to Display Version Info
2007-10-15 09:38:11
I’ve been working on this application for work that does some simple server reporting, part of which involves displaying the versions of major software running on the machines. The importance of this to me personally is that since we have over 30 shared servers hosting multiple customers, we are continually moving websites between servers. Some of our older generation servers are still running MySQL 4.0 and PHP 4.3, so I need to be aware of this to make sure that customers are being moved to servers with compatible versions. It’s also good in tracking and planning upgrades. I find it best to use the exec() function since it’s not blocked by most hosts. However, if you are on a shared host it’s very likely that certain PHP functions are disallowed in the php.ini. In that case you may be able to subsitute exec with system, passthru, escapeshellcmd, or shell_exec…unless those are blocked too. Then I guess you’re out of luck. Start by creating so
Read more: Display , Using PHP

Mass-Moving cPanel Accounts
2007-10-22 10:32:50
If you’ve ever needed to move a ton of cPanel accounts from one server to another, you probably know the following: The multiple account move feature in WHM fails miserably It takes forever to do them one by one, esp. when you have other things to do I figure the best way to mass-move accounts is by listing all the accounts in a file, then using a simple bash script to repetitively package all the accounts to they can be moved to another server. First, you need to create a file (like users.txt) to list all the users you wish to move. If you’re only doing a few you can just go ahead and list the users in there manually, but if you’re doing like a whole server, you can get all the users in one file like so: ls /var/cpanel/users > users.txt You’ll then need to manually edit the users file and remove the ‘.’ and ”..’ entries, and any others that should not be included. The users.txt file should also be in a format like this: user1 u
Read more: Moving , Accounts

Halloween…Sucks
2007-11-01 09:12:17
This is probably the first Halloween that was a complete disaster.  First, I dropped almost a couple hundred on this custom-made Greek [hoochie] goddess outfit.  But the lady made the dress too short, kind of to the length of a t-shirt&hellip ;she also made it one size too small which was Ok, but it only accentuated the fact that the dress was so short that half of Hampton Roads would have seen my ass.  When I called the lady up she was like ” Just wear panty hose, no one will notice” but yea, like sheer stocking are going to hide anything. So after my sister forbid me to wear it, I opted to wear this French maid costume that I bought last year and never wore.  Problem with this one is that I dropped a few pounds over the last year, which in turn caused the costume to drop off of me.  I had to use like 30 safety pins to permanently attach the thing to the corset underneath which was uncomfortable as hell.  At lease Capone’s outfit fit him, he just went as Hugh H


How to Make Your System Admin Mad by Creating Huge-Ass Files
2007-10-31 08:43:00
So If you’ve ever woke up in the morning and asked yourself…”Hmm, how can I make my system admin’s job harder to the point where they get mad and shut down my server?” Well, lucky for you I can answer that question. All you have to do is use the ‘dd‘ command to write a 120gb file to an 80gb hard drive. That’s a winner. By ‘dd’ I’m not talking about my bra size, people. It’s sad, but we recently had an over-curious customer try to see what would happen if the hard drive filled up on his dedicated server. You know what happens when you flush a clogged toilet? Yea…. So here’s the command: dd if=/dev/zero of=test bs=1024 count=125829120 This command will write a 120gb file directly to the disk. ‘of’ specifies the name of the output file, while ‘bs’ represents the size of a block and ‘count’ is how many blocks to create. Really, it’s a dangerous thing to
Read more: System , Admin , Creating

Which Programming Language is For You?
2007-10-30 11:23:22
Working with a webhosting company I get asked all the time — which programming language is better? It’s obvious that I’m more bias towards PHP, but there are other great languages out there that may be more suitable for certain people creating certain sites. I’ve decided to write a nutshell comparison on the most common languages, so you can decide for yourself. PHP My preferred language, PHP, is the most popular and widely-used dynamic programming language on the Internet. As a result, it’s increasingly become easy to learn (I have 4 brain cells and even I could do it) and can be run on virtually any operating system. It’s popularity has resulted in the availability of thundreds of contributions, modules, and addons for PHP to increase its functionality and integration with other software. It’s also free to download and easy to install (for most people), and is the most common in CMS’s and prebundled website software. The major do
Read more: Programming

I Live With Lazy Bitches
2007-10-28 08:31:32
I don’t even know…I just came home one day and here they were:
Read more: Bitches

Selling Ad Space
2007-11-04 08:02:28
Those of you who read Corgie’s post on the front page of Digg the other day, the answer is no — I’m not selling ad space (or sponsored reviews) on my site at this time, and obviously not for $560 a month.  I might in the future when I get more traffic but when that time comes the announcement will be made by me, not some idiot who eats roaches for a living.  In case you’re wondering why: At the time of this writing, my monthly traffic totals about 756,000 hits per month and 20,000 per day (give or take a few thousand), only a fraction of which are unique, reflected by the stats counter on the right-hand side of my site.  Corgie claimed that I get millions of hits of day, making it look like $560 is a fair price to pay.   The reality is, most of the sites that I link to already only get 30-100 hits per month from my site, which is probably only worth $2 per month. My site is a personal site mainly focused around programming and the worthless stuff I choose
Read more: Space

Sploggers Don’t Deserve to Get Laid
2007-11-15 11:12:25
Have you ever read an article somewhere and realized that it looks too familiar?  That’s because you probably wrote it a year or so ago, or read it on someone else’s blog.  “Splogs” are usually fake (and some legitimate sites) blogs that harvest your blog’s content via script, then mirror it on their own sites in order to boost pagerank and ad revenue. Honestly I was unfamiliar with this term until a few months ago when I started getting emails about my posts ending up in various places on the Internet.  Some people were accusing me of stealing, others were just looking out for a fellow blogger and letting me know that my boobs weren’t the only thing going around the web.  I think the act of someone’s website being duplicated around the Internet is like web herpes — it spreads around and you can find it all you want, but there’s no stopping it. When it comes time that you find one of your posts lingering on an unfamiliar websit


Installing Mod_Python
2007-11-11 02:46:28
I figured I’d put this out here because it’s come up quite recently with people who are using Apache 1.3.x. If you haven’t gotten the balls to upgrade to Apache 2.x yet, you can still install mod_python…just not as easily. This simple walk through is for Apache 1.x and 2.x. First, you need to determine what version of Python you are running. To check, type ‘python -V‘ at the command line. If you are running Apache 1.3.x, you should use mod_python version 2.7.11. For Apache 2.2.x, use 3.3.1. 1. Download the Python sources for the version of Python that you have installed, the run a configure and make (no install) just to compile them. If you are running Apache 1.3, you should add –without-threads to your configure line. 2. Once you have this, follow these steps to compile mod_python: cd /usr/src wget http://www.trieuvan.com/apache/httpd/modpython/mod_python-2.7.11.tgz tar -xvzf mod_python-2.7.11.tgz cd mod_python-2.7.11 ./configure &ndas


A Simple Way to Save Bandwidth in PHP
2007-11-18 08:05:40
If you were ever looking for a quick and sexy way to save bandwidth on your PHP-based porn high traffic site, all you have to do is add these two lines to the beginning of your PHP scripts: <?php @ini_set(’zlib.output_compression_level’, 1); @ob_start(’ob_gzhandler’); ?> This will automatically tell the server to compress the PHP page before sending it to the browser. However, sometimes this can causes excess load and a decrease in the speed of your website, but it’s hardly noticable.
Read more: Simple , Bandwidth

Switching from Windows to Ubuntu
2007-11-18 05:16:13
I was doing some checking and I found a few websites that have really good tutorials on how to switch from Windows to Ubuntu : https://help.ubuntu.com/community/Switching ToUbuntu/FromWindows http://monkeyblog.org/ubuntu/installing/ http://www.buildyourown.org.uk/pc-installing/ubuntu/ One thing I should mention from personal experience is that the Migration Assistance really sucks sometimes. When I first installed Ubuntu it was quick and painless, but upon a re-install on a dual boot machine the installer would infinitely stick on the account migration. If this happens to you, you’ll need to reboot from the CD, log into the terminal, then run the installer without the Migration Assistant: user@localhost:~$ ubiquity –migration-assistant


Installing IonCube loader with Zend Optimizer
2007-11-18 07:48:15
This is a common request we get for Ioncube to be installed. It’s generally not an issue, but when you factor in other optimization plugins like Zend and eAccelerator, a common misconception is that the three don’t get along. It’s very easy to install Ioncube into a PHP installation that already has Zend and eAccelerator. This tutorial is specific to cPanel, assuming that you are using php 5.2.x with Zend 3.x.x. If you need help installing eAccelerator, you can see this tutorial. For help with installing Zend, you can go here. The versions in both these tutorials are outdated, so you’ll probably want to apply the instructions to the newest versions available. Go to http://www.ioncube.com/loader_download.php and pick your download. This example assumes that you are using php 5.2. cd /usr/src wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz tar -xvzf ioncube_loaders_lin_x86.tar.gz cd ioncube Copy the loader config to the u
Read more: Optimizer

Yum GCC Errors
2007-11-17 05:22:19
This is coming from Shelby as a fix for the CentOS gcc compiler error that occurs when you try run a Yum update on some systems: –> Processing Dependency: glibc-common = 2.3.4-2.25 for package: glibc-dummy-centos-4 –> Finished Dependency Resolution Error: Missing Dependency: glibc-common = 2.3.4-2.25 is needed by package glibc-dummy-centos-4 First you have to remove the existing package: yum remove glibc-dummy-centos-4 Then you have to reinstall gcc: yum install gcc & yum install gcc* Then you should be able to proceed running the yum update command.
Read more: Errors

Securing the TMP Partition and Tracking Hacks
2007-11-16 07:52:34
Are your temp partitions putting out behind your back? Anyone who’s ever administered a Linux server would know the risk of leaving the /tmp directory unsecured, moreso on a webserver that is shared among multiple websites. The tmp directory is world-writeable and used by a majority of services on a machine — including the storage of PHP and MySQL session files. One issue that I’ve seen on older servers is that one customer’s poorly-coded website would get exploited and end up downloading a file into the /tmp directory, then have that hack file executed on the server as a nobody-owned process. Hack processes are the easiest to find, as they always have a little something extra. This should go without saying, but hack processes can run from almost anywhere, not just /tmp. I’m mainly bringing up the tmp directory because it’s the most targeted location for hack files if it isn’t secured properly. Identifying Hack Processes To start out, log i
Read more: Partition , Tracking

How to Commit Genocide on Annoying Processes
2007-11-21 20:20:40
A few days ago I came across some processes on one of our servers that just wouldn’t die. Even after doing a kill -9 and all that good stuff, more would just keep spawing until there were dozens running on the machine. A head system admin of ours gave me this command, which will mass-kill all alike processes so they don’t have a chance to re-spawn each other. The processes running were all some form of “init_”, like init_1, init_13, etc. To kill these: ps aux |grep init_ |awk ‘{print $2}’ |awk ‘{print “kill -9 ” $1}’ | sh -v The ‘grep init_’ should reflect the common name of all the processes.
Read more: Genocide , Annoying

Massive Upgrade Time
2007-12-01 21:33:52
I decided to stop being lazy and get around to those upgrades I needed for my site and server: - Upgrade PHP to 5.2.5 and Apache 2.2.6 (was running 5.2.3 and 2.2.4) - Upgrade Gallery2 and the WPG2 plugin for Wordpress - Upgrade Wordpress to 2.3.1 First, I should admit that I do use the EasyApache installer from WHM, as it has vastly improved to the point where I don’t have to troubleshoot its builds afterwards, nor do I have to go back and reinstall eAccelerator and Suhosin - The current release of cPanel now includes those options and I must say that they have become rather flawless. In other words, it saves me the time of compiling shit by hand when all I have to do is click a few buttons and all the hard work is done for me. Second, I was avoiding the Gallery2/WPG2 upgrade because I remember that the first time I set it up it was hell, and since it was so long ago I didn’t want to go through that again. Third, since my last Wordpress upgrade I had numerous problems wi


MX Validation in PHP
2007-11-30 23:16:38
Hosting companies have all kinds of tactics to keep spam away from their customers, but one very common complaint I get is the amount of spam coming in through contact forms. Even though we don’t allow ‘nobody’ mail through the php mail() function and we provide the best server-side spam filters available, local mail cannot be filtered or limited. In other words, no spam filter in the world is going to save you from your shitty contact form. I started recommending to our customers to implement MX checks in their forms as spam bots nowadays can easily get past things like captcha and textual confirmations. Spammers rarely send email from valid mail hosts so it’s very easy to filter these out with just a few lines of code: <?php list($user, $domain) = split(“@”, $email); if (checkdnsrr($domain, “MX”)) { } else { } ?> To explain the code a little bit, you’re basically taking your stored email address variable ($email) and using the split()
Read more: Validation

GRUB Errors on Windows Dual Boot
2007-11-30 21:24:15
I don’t want to admit that I still have PC’s that dual boot Windows XP and Vista, but given the occasional problems I have after Ubuntu and Fedora updates I’m not ready to give them up yet. Some time in the middle of the night last night my laptop, which used to dual boot Ubuntu and Vista (before I deleted the Ubuntu partition), rebooted and left me with a ginormous GRUB loader error: GRUB Loading stage 1.5 GRUB loading, please wait... Error 15 The issue is that the boot loader probably went apeshit and doesn’t know what to do.  Since Windows is the MBR nazi, it’s best to use Windows to fix it. Luckily with all the luck I’ve had with Vista I still had the install CD and was able to recover quickly. For those of you at home, if you don’t have the original install CD you need to create a boot disk and slide it in <insert giggle here>. From the CD, when the menu comes up hit ‘R’ for recovery console which will bring you into
Read more: Errors

How to Upgrade to a Non-Existent MySQL Version
2007-11-28 21:22:05
Working in webhosting for a while now I’ve had some people ask for really weird shit, and I’ve dealt with a lot of people who try to sound a lot smarter than they actually are (I’m one of them). The latest of the bunch is a guy who asked for MySQL 7.0 claiming that he’s a MySQL programmer and that he specially programmed his database to work with MySQL 7.0. He really didn’t take it to heart very well when I told him that there is no MySQL 7.0 and the most he can hope for is 6.0x alpha (FYI for future readers a year from now, read the damn date on this post). Besides the point, the guy apparently felt like I was talking down to him so he went out of his way to mention that because he has a bachelors degree in computer science and that he’s an avid Microsoft Word user, he definately knows more than I do when it comes to doing my job. So, I gave in and agreed to upgrade him to MySQL 7.0. The trick of the trade here is that you can essentially instal


How to Commit Genocide on Annoying Processes
2007-11-21 20:20:40
A few days ago I came across some processes on one of our servers that just wouldn’t die. Even after doing a kill -9 and all that good stuff, more would just keep spawing until there were dozens running on the machine. A head system admin of ours gave me this command, which will mass-kill all alike processes so they don’t have a chance to re-spawn each other. The processes running were all some form of “init_”, like init_1, init_13, etc. To kill these: ps aux |grep init_ |awk ‘{print $2}’ |awk ‘{print “kill -9 ” $1}’ | sh -v The ‘grep init_’ should reflect the common name of all the processes.
Read more: Genocide , Annoying

A Simple Way to Save Bandwidth in PHP
2007-11-18 08:05:40
If you were ever looking for a quick and sexy way to save bandwidth on your PHP-based porn high traffic site, all you have to do is add these two lines to the beginning of your PHP scripts: <?php @ini_set(’zlib.output_compression_level’, 1); @ob_start(’ob_gzhandler’); ?> This will automatically tell the server to compress the PHP page before sending it to the browser. However, sometimes this can causes excess load and a decrease in the speed of your website, but it’s hardly noticable.
Read more: Simple , Bandwidth

Installing IonCube loader with Zend Optimizer
2007-11-18 07:48:15
This is a common request we get for Ioncube to be installed. It’s generally not an issue, but when you factor in other optimization plugins like Zend and eAccelerator, a common misconception is that the three don’t get along. It’s very easy to install Ioncube into a PHP installation that already has Zend and eAccelerator. This tutorial is specific to cPanel, assuming that you are using php 5.2.x with Zend 3.x.x. If you need help installing eAccelerator, you can see this tutorial. For help with installing Zend, you can go here. The versions in both these tutorials are outdated, so you’ll probably want to apply the instructions to the newest versions available. Go to http://www.ioncube.com/loader_download.php and pick your download. This example assumes that you are using php 5.2. cd /usr/src wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz tar -xvzf ioncube_loaders_lin_x86.tar.gz cd ioncube Copy the loader config to the us
Read more: Optimizer

Switching from Windows to Ubuntu
2007-11-18 05:16:13
I was doing some checking and I found a few websites that have really good tutorials on how to switch from Windows to Ubuntu : https://help.ubuntu.com/community/Switching ToUbuntu/FromWindows http://monkeyblog.org/ubuntu/installing/ http://www.buildyourown.org.uk/pc-installing/ubuntu/ One thing I should mention from personal experience is that the Migration Assistance really sucks sometimes. When I first installed Ubuntu it was quick and painless, but upon a re-install on a dual boot machine the installer would infinitely stick on the account migration. If this happens to you, you’ll need to reboot from the CD, log into the terminal, then run the installer without the Migration Assistant: user@localhost:~$ ubiquity –migration-assistant


Yum GCC Errors
2007-11-17 05:22:19
This is coming from Shelby as a fix for the CentOS gcc compiler error that occurs when you try run a Yum update on some systems: –> Processing Dependency: glibc-common = 2.3.4-2.25 for package: glibc-dummy-centos-4 –> Finished Dependency Resolution Error: Missing Dependency: glibc-common = 2.3.4-2.25 is needed by package glibc-dummy-centos-4 First you have to remove the existing package: yum remove glibc-dummy-centos-4 Then you have to reinstall gcc: yum install gcc & yum install gcc* Then you should be able to proceed running the yum update command.
Read more: Errors

Securing the TMP Partition and Tracking Hacks
2007-11-16 07:52:34
Are your temp partitions putting out behind your back? Anyone who’s ever administered a Linux server would know the risk of leaving the /tmp directory unsecured, moreso on a webserver that is shared among multiple websites. The tmp directory is world-writeable and used by a majority of services on a machine — including the storage of PHP and MySQL session files. One issue that I’ve seen on older servers is that one customer’s poorly-coded website would get exploited and end up downloading a file into the /tmp directory, then have that hack file executed on the server as a nobody-owned process. Hack processes are the easiest to find, as they always have a little something extra. This should go without saying, but hack processes can run from almost anywhere, not just /tmp. I’m mainly bringing up the tmp directory because it’s the most targeted location for hack files if it isn’t secured properly. Identifying Hack Processes To start out, log in
Read more: Partition , Tracking

Importing CSV Into MySQL
2007-12-08 15:53:17
The newer versions of phpMyAdmin for some reason no longer include the option to import CSV files. If you are trying to import an Excel or other delimited file, first make sure that it’s in CSV format (with Excel you can export it as CSV). Then log into phpMyAdmin or your MySQL prompt and run this command: load data local infile ‘/path/to/file.csv‘ into table yourtablename fields terminated by ‘,’ enclosed by ‘”‘ lines terminated by ‘ ’; With phpMyAdmin this is done within the ‘SQL’ section, indicated by the ‘SQL’ tab.
Read more: Importing

Common PHP Errors
2007-12-07 21:44:14
I’m going back to the basics here, you know, when you wrote your first PHP script and saw an ugly-ass error message pop up on your screen? Error messages are the best tool a programmer has. Set up Error Reporting Most PHP errors are straight forward, but there are times where you don’t see any which makes it very difficult to tell what the problem is. The first step of PHP troubleshooting is to turn error reporting on. For security reasons you’ll want error reporting off by default, but if something goes wrong you’ll need the information for debugging. You can usually enable error reporting by adding this line to the problem script: <?php error_reporting(E_ALL) ?> Or you can add these lines to the root .htaccess: php_flag display_errors on php_value error_reporting 6143 This will usually display an error useful for troubleshooting, that is, if the software and your server configuration allows it. Parse Errors Parse error: parse error, unexpected T_STRING
Read more: Common

Convert Database to UTF-8
2007-12-06 21:25:18
We seriously see a ton of customers coming in with the type of databases that are a nightmare to move over. When you’re dealing with special characters in a database, you have to make sure that the charset and collation are dumped *with* the database, so that when you move it to another server the tables and data create properly. The biggest annoyance so far is converting tables back to UTF-8, as when this is done through the MySQL shell or phpmyadmin is had to be done table-by-table. So, I wrote this simple PHP script to do it all at once: <?php // Database info $dbhost = ‘localhost’; $dbuser = ‘db_user’; $dbpass = ‘password’; $dbname = ‘db_name’; //————— header(’Content-type: text/plain’); $dbconn = mysql_connect($dbhost, $dbuser, $dbpass) or die( mysql_error() ); $db = mysql_select_db($dbname) or die( mysql_error() ); $sql = ‘SHOW TABLES&rsquo
Read more: Convert

Using an .htaccess with PHP Compiled as CGI
2007-12-06 19:57:21
We recently started installing suPHP on a few of our servers, which is an implementation of phpsuexec, only a ton faster and with less overhead. Yesterday I posted a tutorial on how to install suPHP on a PHP5/Apache server outside of EasyApache, but today I shall go over how to enable PHP directives in your .htaccess instead of using the php.ini. First of all, if you’d rather use the .htaccess than the php.ini capabilities of a phpsuexec environment, then shame on you. But, we have some customers who are terrified of php.ini and would rather use the .htaccess. So what? Ok, well there is a workaround. Mr. Joye released a newer version of htscanner that now works with suPHP, and allows you to use php directives in your .htaccess just like you did when PHP was installed as and Apache module. All you have to do is download the tarball and install like any other PHP module: wget http://pecl.php.net/get/htscanner-0.8.1.tgz tar -xvzf htscanner-0.8.1.tgz cd .htscanner-0.8.1 ./conf


Interactive RoR Tutorial
2007-12-05 21:24:57
So it’s official, I’ve started my Ruby programming classes in school and I’ll finally be able to see what it can do.  We started offering Ruby on some of our servers here and we’re all learning a little bit about it before we start offering it on our mainstream hosting…because you have to have at least one person who knows the feature well enough to help other people.  From what I’ve played with so far it seems to be the same logic as PHP and perl, so let’s just see how it goes.  For those of you wanting to try out some Ruby, there’s a nifty little Ruby emulator and mini-tutorial at http://tryruby.hobix.com/
Read more: Tutorial

Page 3 of 5 « < 2 3 4 5 > »
eXTReMe Tracker