Unix | Brain Goo https://www.popmartian.com/tipsntricks Carpe Crap 'em Wed, 21 Oct 2026 14:52:32 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.10 HOW TO Install mcrypt for PHP on RedHat Linux 6 and Oracle Linux 6 https://www.popmartian.com/tipsntricks/2014/06/04/how-to-install-mcrypt-for-php-and-redhat-linux-6-or-oracle-linux-6/ https://www.popmartian.com/tipsntricks/2014/06/04/how-to-install-mcrypt-for-php-and-redhat-linux-6-or-oracle-linux-6/#comments Wed, 04 Jun 2014 15:05:42 +0000 http://www.popmartian.com/tipsntricks/?p=317 This tutorial shows you how to install libmcrypt and the companion PHP module under RedHat Linux 6 and Oracle Linux 6. By default, RHEL and OL do not provide mcrypt or libmcrypt packages for the 6.x release. Subsequently, they don’t … Continue reading →

The post HOW TO Install mcrypt for PHP on RedHat Linux 6 and Oracle Linux 6 first appeared on Brain Goo.

]]>
This tutorial shows you how to install libmcrypt and the companion PHP module under RedHat Linux 6 and Oracle Linux 6.

By default, RHEL and OL do not provide mcrypt or libmcrypt packages for the 6.x release. Subsequently, they don’t provide PHP5 mcrypt modules either. Many PHP apps including PHPMyAdmin and Magento make use of the better crypto support of libmcrypt.

So how do you install it? You have to build it.

Part 1: Building libmcrypt

Part 1, Step 1: Install your build environment
libmcrypt is written in C++ so you need a C++ compiler.
sudo yum install gcc-c++.x86_64
That will install the compiler and dependencies.

Part 1, Step 2: Get the software
Download it here: http://sourceforge.net/projects/mcrypt/files/
Remember, download libmcrypt, not mcrypt.

Part 1, Step 3: Pick a location and unpack it
Most people install software in to the default location, but I’m going to install in to somewhere that isn’t owned by root just to illustrate how to separate your custom app components from the OS.
mkdir /myappserver
cd /myappserver
cp /path/to/download/libmcrypt-2.5.8.tar.bz2 /myappserver/
bunzip2 libmcrypt-2.5.8.tar.bz2
tar xf libmcrypt-2.5.8.tar
mv libmcrypt-2.5.8 libmcrypt-install

Part 1, Step 4: Build it!
cd libmcrypt-install
./configure --prefix=/myappserver/libmcrypt-2.5.8 --exec-prefix=/myappserver/libmcrypt-2.5.8 --disable-posix-threads
make
make install

Part 1, Step 4: Make a Symlink
In order to make life easier for upgrades later, symlink libmcrypt to the version you built. This will let you compile a new version later and simply move the symlink. Anything else you build against this package will only need to know about the symlink.
ln -s /myappserver/libmcrypt-2.5.8/ /myappserver/libmcrypt

You have successfully installed libmcrypt. You can move it from server to server by simply copying /myappserver/libmcrypt-2.5.8/ to any other machine.

Part 2: Building the PHP Module
Building the PHP module can be done in one of two ways.

  1. Build your own PHP and copy the module to an existing PHP installation
  2. Build your own PHP and use it

I’m not going to do a full tutorial on building PHP here (Option 2). Just note that the steps are the same as Option 1, but instead of copying the extention in to your PHP installation, compile PHP with all the modules you need, then install and use the PHP you built.

Option 1: Build your own PHP and copy the module to an existing PHP installation

Part 2, Option 1, Step 1: Install your build environment
PHP is written in C so you need a C compiler.
sudo yum install gcc.x86_64
That should give you everything you need to compile PHP.

Part 2, Option 1, Step 2: Get the software
MAKE SURE YOU DOWNLOAD THE PHP VERSION THAT MATCHES YOUR INSTALLATION
Download it here: http://us3.php.net/downloads.php

For this tutorial, I used PHP 5.5.13

Part 2, Option 1, Step 3: Pick a location and unpack it
I’m going to use a non-standard location since I’m just building the software. I’m not going to use it from here.
mkdir /myappserver
cd /myappserver
cp /path/to/download/php-5.5.13.tar.bz2 /myappserver/
bunzip2 php-5.5.13.tar.bz2
tar xf php-5.5.13.tar
cd php-5.5.13

Part 2, Option 1, Step 4: Build it!
./configure --prefix=/myappserver/php-5.5.13 --exec-prefix=/myappserver/php-5.5.13 --with-mcrypt=/myappserver/libmcrypt
make

Note the --with-mcrypt=/myappserver/libmcrypt option. This points to the symlink above. If you need to upgrade libmcrypt later or rebuild the module for any reason, you don’t need to worry about what version of libmcrypt you have, just use the symlink!

You should now be able to find your module in /myappserver/php-5.5.13/ext/mcrypt

Part 2, Option 1, Step 5: Use it!

  • Copy the mcrypt directory above in to the ext directory in your PHP installation.
  • Restart your Apache server

Test it with a little PHP code:
<?php
extension_loaded('mcrypt') ? print 'Mcrypt is working' : print 'Mcrypt is not working';
?>

Did you find this post useful or have questions or comments? Please let me know!

The post HOW TO Install mcrypt for PHP on RedHat Linux 6 and Oracle Linux 6 first appeared on Brain Goo.

]]>
https://www.popmartian.com/tipsntricks/2014/06/04/how-to-install-mcrypt-for-php-and-redhat-linux-6-or-oracle-linux-6/feed/ 1
HOW TO Extract the contents of a .scexe file https://www.popmartian.com/tipsntricks/2014/01/17/how-to-extract-the-contents-of-a-scexe-file/ https://www.popmartian.com/tipsntricks/2014/01/17/how-to-extract-the-contents-of-a-scexe-file/#comments Fri, 17 Jan 2014 21:18:31 +0000 http://www.popmartian.com/tipsntricks/?p=307 HP Releases self-extracting firmware update files for Linux as .scexe files. These files usually contain an installer and a bunch of XML controlls. A -h flag provides a couple options for running the installer, but sometimes you don’t want to … Continue reading →

The post HOW TO Extract the contents of a .scexe file first appeared on Brain Goo.

]]>
HP Releases self-extracting firmware update files for Linux as .scexe files. These files usually contain an installer and a bunch of XML controlls. A -h flag provides a couple options for running the installer, but sometimes you don’t want to run it, you want to get at the contents.

.scexe files contain a hidden --unpack flag that will unpack the contents to the directory of your choosing.

For example:

# ./SOMEFILE.scexe --unpack=/tmp/test/
SOMEFILE.xml
SOMEFILE-PayLoad-version.version.version-1.zip
something.txt
installer
readme.txt
reference.xml

Did you find this post useful or have questions or comments? Please let me know!

The post HOW TO Extract the contents of a .scexe file first appeared on Brain Goo.

]]>
https://www.popmartian.com/tipsntricks/2014/01/17/how-to-extract-the-contents-of-a-scexe-file/feed/ 5
Removing a File Beginning With Dash – https://www.popmartian.com/tipsntricks/2009/10/28/removing-a-file-beginning-with-dash/ https://www.popmartian.com/tipsntricks/2009/10/28/removing-a-file-beginning-with-dash/#respond Wed, 28 Oct 2009 18:03:20 +0000 http://www.popmartian.com/tipsntricks/?p=124 I get this a lot from friends and Google is full of examples, but here it is again. If you have a file that begins with a hyphen (one of these: -) you’ll have a tough time removing it unless … Continue reading →

The post Removing a File Beginning With Dash – first appeared on Brain Goo.

]]>
I get this a lot from friends and Google is full of examples, but here it is again.

If you have a file that begins with a hyphen (one of these: -) you’ll have a tough time removing it unless you remember something simple from Command Line 101. In most CLI environments, your shell has two ways to access a file: relative path and absolute path.

See, all I had to do was type that and 90% of you just went “Durr!” and removed your file.

For the rest of you, just refer to the file by it’s full path. Example:

/tmp$ ls -la|grep ^\-
-rw-r--r-- 1 bob bob 0 2009-10-28 12:50 -somefile

Oh look, I have a file in /tmp called -somefile. What ever shall I do to remove it?

/tmp$ rm -somefile
rm: invalid option -- s
Try `rm ./-somefile' to remove the file `-somefile'.
Try `rm --help' for more information.

Oh my! That didn’t work at all! The rm command thinks I’m passing it a flag called -somefile. Conveniently, rm knows I’m not very bright and tells me how to remove it!

/tmp$ rm ./-somefile
/tmp$

Well blow me down! Alternately, you can refer to the file with the full path:

/tmp$ rm /tmp/-somefile
/tmp$

The key is to remember that the shell knows where you are, but doesn’t know what you want. If you imply that you want to delete something, the shell does it’s best guess. In this case, it guesses wrong because rm command flags take precedence over arguments. If you are explicit in what you want, the shell does not have to guess.

Of course, being fully explicit means issuing the full command for rm:

/bin/rm /tmp/-somefile

But you have to know where rm lives. You can guess, or you can find it with which:

$ which rm
/bin/rm

But how do you know where which is?

``/usr/bin/which which` rm` /tmp/-somefile

Ok, that’s dumb. Go remove your file.

Did you find this post useful or have questions or comments? Please let me know!

The post Removing a File Beginning With Dash – first appeared on Brain Goo.

]]>
https://www.popmartian.com/tipsntricks/2009/10/28/removing-a-file-beginning-with-dash/feed/ 0