Redhat – Sort log file by date
Sunday, February 12th, 2012$ ls -l -r –sort=time
$ ls -l -r –sort=time
After you ssh into server:
$ vi /etc/passwd
You should see something similar to
bloom:x:502:503::/var/www/vhosts:/bin/bash
devuser:x:48:505::/home/devuser:/bin/bash
bloomcom:x:503:506::/var/www/vhosts:/bin/bash
Just change the part where is says: /var/www/vhosts
to whatever folder you want
$ df -h ( hit enter )
Will return something similar to:
Filesystem Size Used Avail Use% Mounted on /dev/sda5 128G 80G 47G 64% / /dev/sda2 2.0G 264M 1.6G 15% /tmp /dev/sda1 99M 23M 71M 25% /boot tmpfs 16G 0 16G 0% /dev/shm
After logging in to your server via ssh:
$ find / -type f -printf "%s %h/%f\n" | sort -rn -k1 | head -n 50 | awk '{ print $1/1048576 "MB" " " $2}' ( hit enter )
Using terminal
$ ps ax | grep httpd | wc -l
Edit PHP config file: /etc/php.ini
$ sudo nano /etc/php.ini
Do a search for pdo_mysql_default
In nano, type <control button> and press W
type in pdo_mysql_default and hit enter
Change to
pdo_mysql.default_socket=/tmp/mysql.sock
Restart apache:
$ sudo apachectl restart
Taken from http://craigwaterman.com/2011/07/21/adding-mcrypt-to-php-on-os-x-10-7-lion/ but cleaned up a few potential gotchas:
This is a guide for those who need to install (or re-install) mcrypt under PHP in OS X 10.7 (Lion).
You’ll need the following:
phpinfo() just in case./Users/sushi/Source/lion/$ cd ~/Source/lion ( hit enter ) $ tar xvfj libmcrypt-2.5.8.tar.bz2 ( hit enter ) $ tar xvfz php-5.3.6.tar.gz ( hit enter )
Let’s configure libmcrypt for installation:
$ cd libmcrypt-2.5.8 ( hit enter ) $ MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O2 -fno-common -arch i386 -arch x86_64' \ LDFLAGS='-O2 -arch i386 -arch x86_64' \ CXXFLAGS='-O2 -fno-common -arch i386 -arch x86_64' \ ./configure --disable-dependency-tracking ( hit enter )
If you get some errors, try removing a few items:
$ MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O2 -fno-common' \ LDFLAGS='-O2' \ CXXFLAGS='-O2 -fno-common' \ ./configure --disable-dependency-tracking ( hit enter )
Now let’s build and install libmcrypt itself.
$ make ( hit enter ) $ sudo make install ( hit enter )
You can run make -j8 if you’re on a Quad-Core i7 and are curious how much it speeds up compilation, it makes no difference for installing mcrypt.
With libmcrypt ready to use, we need to compile the php extension for it.
$ cd ~/Source/lion/php-5.3.6/ext/mcrypt ( hit enter ) $ /usr/bin/phpize ( hit enter ) MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O2 -fno-common -arch i386 -arch x86_64' \ LDFLAGS='-O2 -arch i386 -arch x86_64' \ CXXFLAGS='-O2 -fno-common -arch i386 -arch x86_64' \ ./configure --with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config ( hit enter )
( You might have to hit enter again to make it execute )
If you get some errors try removing a few things like we did above:
MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O2 -fno-common' \ LDFLAGS='-O2' \ CXXFLAGS='-O2 -fno-common' \ ./configure --with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config ( hit enter )
$ make ( hit enter ) $ sudo make install ( hit enter )
Everything should be ready to hook up at this point, we’ll need to update /etc/php.ini to tell php to load the extension.
Verify that /etc/php.ini exists. If you’ve never worked with it before, or have just upgraded to Lion, you’ll need to copy php.ini.default to php.ini with:
# skip this step if /etc/php.ini already exists. $ sudo cp /etc/php.ini.default /etc/php.ini ( hit enter )
Update php.ini and tell php to load our newly compiled mcrypt.so
$ sudo nano /etc/php.ini ( hit enter )
Add the following to the end of the file, then save and exit:
extension=mcrypt.so
Now restart Apache:
$ sudo apachectl graceful ( hit enter )
OR
$ sudo apachectl stop ( hit enter )
THEN
$ sudo apachectl start ( hit enter )
OR using Macs typical user interface:
Verify in your phpinfo() that mcrypt is really there, it should look like this:
And that should be it
To fix your Magneto log: Mage::log() that is not logging you need to change the update the permissions for the magento var folder.
$ cd magento/location/on/server ( hit enter )
$ chmod -R 777 var/ ( hit enter )
That will prevent Magento from trying to use a default setting: /var/tmp//magento/var
Took me 2 hours, but hopefully this saves someone else from the same pain I had.
$ find folder/to/count/ -type f | wc -l ( hit enter )
$ du -h /foldertogetsizeof ( hit enter )
To get the size of the folder you are in:
$ du -h ( hit enter )