Friday, November 22, 2013

mod passenger httpd.conf configuration

Example configuration:

RailsEnv "development" # to setup default environment for passenger
  PassengerEnabled on
  AllowOverride None
  Options FollowSymLinks ExecCGI
  Order allow,deny
  Allow from all
  PassengerBaseURI /mydir
  PassengerAppRoot /var/www/mydir


Tuesday, November 12, 2013

prestashop, sometimes save does not work?

Thats why i hated PHP.
It took me half a day to finally realize, prestashop was posting too much variables on the product form with my additional fields.
There wasn't any error, but the form just return back to the front page with no exception, no error logs...
just plain - "not working".

after testing

echo "keys: ".count(array_keys($_REQUEST));

i found 990 keys posted.
then i went into whm and change php.ini in /usr/local/lib
max_input_vars 5000
then i found the keys posted is 1800+ keys..

PHP sucks!

Wednesday, October 9, 2013

changing git remote origin

#to list all remote url
git remote -v

#to remove existing remote (not reversible)
git remote remove [name]
eg: git remote rm origin

#then you may add your new remote
git remote add origin ssh://git destination/...


Tuesday, October 8, 2013

rails mysql2 install fail

if you encounter No such method for Nil Class,
its due to a bug in mysql2 v0.3.13,

so try to install
gem install mysql2 -v 0.3.11

to get it installed on windows, you will need the right connector library to be installed.
first, download the zip file of the mysql connector, and extract it.
v0.3.11 requires mysql-connector-c-noinstall-6.0.2-win32

next, install using this command:
gem install mysql2 -v 0.3.11 --platform=ruby -- --with-opt-dir="C:\path-to\mysql-connector-c-noinstall-6.0.2-win32"

after installed, makesure to copy C:\path-to\mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll to c:\Ruby200\bin\

Note: nokogiri currently desnt support ruby 64bits.
so try to use 32bits if you need to use it.

Wednesday, September 18, 2013

phpmyadmin blank page

due to hosting configuration,
some hosting don't allow use of ini_set.
to fix it,
edit libraries/session.inc.php and comment off all ini_set
edit libraries/common.inc.php and comment off all ini_set

in config.inc.php, maksure to set:


$cfg['Error_Handler']['display'] = true;
$cfg['Error_Handler']['log'] = true;
$cfg['Error_Handler']['gather'] = true;
$cfg['Servers'][$i]['auth_type'] = 'cookie';

//optional
$cfg['Servers'][$i]['extension'] = 'mysql'; //if mysqli isnt supported

//and off these:

//$cfg['Servers'][$i]['controluser'] = 'root';
//$cfg['Servers'][$i]['controlpass'] = '';



Wednesday, September 11, 2013

mac ruby iconv not found

#if you are using rbenv to setup your ruby, use this command:
CONFIGURE_OPTS="--with-iconv-dir=/usr/bin/iconv" rbenv install [version]

#to locate your iconv, use
which iconv

eg:
CONFIGURE_OPTS="--with-iconv-dir=/usr/" rbenv install 1.9.3-p448

otherwise for rvm, you may use instruction from here:
http://stackoverflow.com/questions/7829886/in-require-no-such-file-to-load-iconv-loaderror

Friday, September 6, 2013

php $_POST return empty

its most likely due to ini setting post_max_size.
make sure to set your post_max_size to higher than upload_max_filesize in php.ini,
other wise your $_POST variable or $_REQUEST variable might become empty...