Thursday, July 21, 2005

HOWTO replace ^M with real carriage return using vi

You can search for or replace a carriage return by using the character that is created when you hit these buttons:

<CTRL><RETURN>

Occassionally, you'll see a document in vi that has lots of ^M characters. To replace them with nothing type this:

:%s/<CTRL><M>//g

Remember that <CTRL><M> means you actually hit those buttons on your keyboard, not type 'less-than' symbols, etc. This is a search and replace tool in vi, the '%' makes it search across all lines, the 'g' on the end makes it replace every instance on that line.

If you want to replace those guys with a real carriage return type this:

:%s/<CTRL><M>/<CTRL><RETURN>/g

Friday, July 08, 2005

Postfix phantom transport

Are you getting an error like this?

postfix/qmgr[22615]: warning: connect to transport spamassassin: No such file or directory

Except it doesn't have to be "spamassassin", just any program that is being run that shouldn't be running anymore. I actually was getting this:

postfix/qmgr[22615]: warning: connect to transport smapassassin: No such file or directory

"smapassassin"... somewhere along the way, I tried to get postfix to use "smapassassin." But ever since then, there was no no program like this and I looked in everyfile for this to see where it was coming from, but I couldn't find it! Very frustrating.

Here's the line, which I use all the time to look inside files:

find . -type f -print0 | xargs -0 grep "smapassassin"

Anyway, I ran:

$ newaliases

to processes the file(s) specified with the alias_database configuration parameter, thus clearing up the phantom command.

Then, since this error was coming from the queue manager ('qmgr' above), I requeue messages:

$ postsuper -r ALL


for more on these commands:

# man postsuper
# man newaliases

Tuesday, July 05, 2005

preg_match: internal pcre_fullinfo() error -3

There are several posts about this being an apache2, php5 bug, blah blah blah. None of that was helpful for me. What *had* happened in my case, and maybe this can help you, was I had pcre 3.9 installed, but installing php 4.3.11 from source on apache 2 required me to upgrade to 4.5 (I think). Anyway, in phpinfo() it was showing it was using the 3.9 version because the configration string was using "--with-pcre-regex=/usr/local", but it needed to use 4.5.

Resolution
I just removed the path and rebuilt the configuration with "--with-pcre-regex" and it came through fine. I think it needed 4.5 to build it and then needed it to point to the right path when it was done.

enabling xslt on php install

[as seen on php.net]

If you're on a new Linux machine (especially CentOS), you'll need to install all the *-devel versions of stuff you want to compile against. This takes care of a lot of 'em:

# yum install httpd-devel ===>httpd-devel-2.0.40-11.9.i386.rpm
# yum install bzip2-devel ===>bzip2-devel-1.0.2-5.i386.rpm
# yum install libjpeg-devel ===>libjpeg-devel-6b-21.i386.rpm
# yum install libpng-devel ===>libpng-devel-1.2.2-8.i386.rpm
# yum install freetype-devel ===>freetype-devel-2.1.2-7.i386.rpm
# yum install imap-devel ===>imap-devel-2001a-15.i386.rpm
# yum install mysql-devel ===>mysql-devel-3.23.58-1.80.i386.rpm
# yum install postgresql-devel ===>postgresql-devel-7.2.4-5.80.i386.rpm
# yum install pspell-devel ===>pspell-devel-0.12.2-14.i386.rpm
# yum install net-snmp-devel ===>net-snmp-devel-5.0.9-2.80.1.i386.rpm
# yum install unixODBC-devel ===>unixODBC-devel-2.2.2-3.i386.rpm
===>unixODBC-2.2.2-3.i386.rpm
===>cups-libs-1.1.17-0.9.i386.rpm
===>XFree86-Mesa-libGLU-4.2.1-23.i386.rpm
===>qt-3.0.5-17.i386.rpm


---on to original php posting---
If your 'make' is complaining about not finding -lstdc++, you'll need to install libstdc++-devel:

# yum install libstdc++-devel

Also, make sure you have the libstdc++, but that usually comes standard. You can check by doing: # yum info libstdc++

This is, of course, in addition to exporting:

# export LDFLAGS=-lstdc++
# export EXTRA_LDFLAGS=-lstdc++

The issue will be coming from the Makefile, so you could edit that file also to include these in their definitions instead.

Remember, if you have to run make again, you should start off fresh with:

# make clean

changing localtime / timezone on Linux

[$ is root prompt]
Assuming your Linux kernal clock is set to the correct GMT time.
$ date -u
will give you the current UTC time.

$ cd /usr/share/zoneinfo
$ ln -s US/Central localtime
$ ln -s localtime posixrules
$ cp localtime /etc/localtime
$ date

----
"date" should show you the timezone changed.
After changing directories into /usr/share/zoneinfo, you can see all the other timezones there, just tab complete to find yours.