Sep 30, 2013

TipsAndTrick: What maid my apache stop?

This error came-up after I installed the subversion on my machine.

Mon Sep 30 16:07:08 2013] [notice] SIGHUP received.  Attempting to restart
httpd: Syntax error on line 223 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /usr/lib64/libxml2.so.2: symbol gzopen64, version ZLIB_1.2.3.3 not defined in file libz.so.1 with link time reference

I cant imaging that apache dependencies has also relation to subversion dependency package. But this is really happen.
As verify my latest Installed and update, zlib was one of them.
$ sudo tail -n 20 /var/log/yum.log
Sep 30 05:13:46 Updated: zlib-1.2.5-7.11.amzn1.x86_64
Sep 30 05:13:46 Updated: apr-1.4.6-1.10.amzn1.x86_64
Sep 30 05:13:46 Installed: libtasn1-2.3-3.4.amzn1.x86_64
Sep 30 05:13:47 Installed: gnutls-2.8.5-10.10.amzn1.x86_64
Sep 30 05:13:47 Installed: neon-0.29.5-1.10.amzn1.x86_64
Sep 30 05:13:47 Installed: subversion-libs-1.7.13-1.32.amzn1.x86_64
Sep 30 05:13:48 Installed: subversion-1.7.13-1.32.amzn1.x86_64
Sep 30 05:13:48 Updated: libxml2-2.7.8-10.26.amzn1.x86_64
Sep 30 05:13:48 Updated: zlib-1.2.5-7.11.amzn1.i686

Solution:
By rebooting my system apache works and run again like miracle. This case I learn something, that in every update made in your system, find a time to reboot. :)


Happy rebooting

Sep 17, 2013

SSH - How to configure ssh-agent.

This is the simple script to activate the ssh-agent

If you are using bash, copy the code below and paste at the end of ~/.profile or ~/.bash_profile file. The user profile file defends on the linux distro you use. But as I notice Debian(OpenSuse, Ubunto) use ~/.profile and RHEL(Fedora, CentOS) use ~/.bash_profile. By the way the code below are need to put the end of you user profile.
SSH_ENV=$HOME/.ssh/environment

function start_agent {
     echo "Initialising new SSH agent..."
     /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
     echo succeeded
     chmod 600 ${SSH_ENV}
     . ${SSH_ENV} > /dev/null
     /usr/bin/ssh-add;
}

# Source SSH settings, if applicable

if [ -f "${SSH_ENV}" ]; then
     . ${SSH_ENV} > /dev/null
     #ps ${SSH_AGENT_PID} doesn’t work under cywgin
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh- agent$ > /dev/null || {
         start_agent;
     }
else
     start_agent;
fi
If you are using tcsh, copy the code below and paste at the end of ~/.login file.
set SSH_AGENT=/usr/bin/ssh-agent
set SSH_AGENT_ARGS="-c"
set TMP_FILE=~/.ssh/ssh-agent-info

#
#  Check for existing ssh-agent process
#
if ( -s $TMP_FILE ) source $TMP_FILE
if ( $?SSH_AGENT_PID ) then
  set this=`ps -elf | grep ${SSH_AGENT_PID} | grep ssh-agent > /dev/null`
  # start ssh-agent if status is nonzero
  if (( $? != 0 ) && ( -x "$SSH_AGENT" )) then
    $SSH_AGENT $SSH_AGENT_ARGS | head -2 > $TMP_FILE
    source $TMP_FILE
    echo "ssh agent started [${SSH_AGENT_PID}]"
    ssh-add
  endif
endif



Sep 5, 2013

Magento: How to enable Profiler in magento?

First thing you my uncomment below code in your index.php
Varien_Profiler::enable();

Enable the store profiler in your magento admin. See the configuration in.
System -> Configuration -> Developer -> Debug -> Profiler

NOTE: if you are working on costumed magento theme be sure the profiler block added in you page.xml
<default translate="label" module="page">
// Some other stup here.
<block type="core/profiler" output="toHtml" name="core_profiler" />
</default>

If you want to profile your own module you can declare do below code.
Varien_Profiler::start('NameOfFragmentToProfile');
//
// ... Some batch of code here.
//
Varien_Profiler::stop('NameOfFragmentToProfile');

Sep 3, 2013

Magento: How to select a collection with one field only.

Here's what one user did. I it work like a charm to me.
$colelction->getSelect()
    ->reset(Zend_Db_Select::COLUMNS) // THis is import thing
    ->columns('MAX(created) as max_created')
    ->group(array('status_id'));

As courtesy to eth original post Magento: Single field collection