Entries Tagged as 'Apache'

mod_cfml graphic

I'm working on the mod_cfml site and while playing with Photoshop and working up graphics for it, I made the following. I really like it! Hope you do too.

mod_cfml logo

The tricky little "httpd -M" command

A project I'm doing requires that I write a BASH shell script that checks what modules are installed in Apache (to make sure some requirements are met before an install is attempted), however, I had a HECK OF A TIME figuring out how to script the checking of the httpd -M command (the command that shows the installed Apache modules). I was tring to run the following on a CentOS 5 server:

# httpd -M | grep -c perl

And the results of the command were not being piped to grep. Instead, the results were being sent to the screen. Irritating! There's clearly a pipe character there. I kept thinking I was writing the command wrong or something. I tried the command on my Ubuntu desktop, and lo and behold it worked just fine:

$ sudo apache2ctl -M | grep -c perl

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Syntax OK
1

Broken ApacheThe "1" was the result I was looking for, because I knew mod_perl was installed.

Long story short, for some reason the CentOS 5 version of Apache sends the "httpd -M" results to stderr, rather then stdout. I have no freaking idea why it does this, because that's not error data. It seems like a bug in the HTTPD executable. The end result was that I needed to write my command as follows:

# httpd -M  2>&1 | grep -c perl

1

The 2>&1 sends the stderr data to stdout which is what the pipe character sends to the grep command.

How annoying. For the record:

# httpd -v

Server version: Apache/2.2.3
Server built:   Oct 20 2011 17:00:12

Hope this helps someone avoid the frustration and confusion I went through finding it.

Install PHP 5.2 on CentOS 5 (for phpMyAdmin)

phpmyadmin logoIt's pretty annoying to me that the latest version of phpMyAdmin requires PHP 5.2, which as some of you may know, is NOT installed on CentOS 5 by default. Instead, you have to use scary-looking RPM's with the word "testing" in them. So... to remove some of the scaryness/complexity of installing PHP 5.2 on CentOS 5 for use with phpMyAdmin, I've written down the following steps that makes the upgrade process pretty easy.

  1. First install the yum-priorities package. This enables you to specify which repo you want yum to prioritize when it's checking for updates.

    # yum -y install yum-priorities

  2. Next, you'll want to add the scary "CentOS 5 Testing" repository to your listof repo's for YUM to check. You can do that by adding the contents of THIS FILE to your own /etc/yum.conf. I just copied and pasted the contents of that file to the very bottom of my yum.conf and it worked fine.

  3. Now you should be able to perform a PHP upgrade with YUM by specifying that you want to use the "testing" server as a priority:

    # yum --enablerepo=c5-testing upgrade php

    or... if you haven't installed PHP yet:

    # yum --enablerepo=c5-testing -y install php

  4. You will probably also want to install the following modules for use with phpMyAdmin:

    # yum --enablerepo=c5-testing -y install php-mysql php-mcrypt php-mbstring

  5. After you're done installing/upgrading php and all required modules, don't forget to give Apache a quick restart so your upgrades take effect:

    # /etc/init.d/httpd restart
php logo


That's all there is to it! Your phpMyAdmin install should work great now.

 

Making CFIDE Available to all Apache VirtualHosts

When working with ColdFusion on Linux, you may encounter a situation where you want to make the contents of the CFIDE folder available to all sites that are hosted on that server. The reason you might want to do this is for things like CFFORM to work properly on a host that doesn't physically have the CFIDE directory located in that site.

The solution for this is an Apache Alias. Add an alias to the Apache httpd.conf file similar to this:

Alias /CFIDE /var/apache/htdocs/CFIDE/
Alias /cfide /var/apache/htdocs/CFIDE/

Adjust the second path to actually point to where your primary CFIDE folder is located. It's usually your default site, but it can be changed during the install.

Further, for best security practices, take a look at Pete Freitag's guide to locking down the CFIDE directory. The PDF file he provides offers cusotm apache configs for locking down unused CFIDE services and thus lowering the attack surface that bad guys might use to access your box:

http://www.petefreitag.com/item/758.cfm

abolition-dr