Dec 25, 2015

Resolved issue aborting test with jasmine via PhantomJS

Weird issue when executed:

grunt test

I got:
...
Running "concurrent:ts_test" (concurrent) task

        Running "jasmine:ts_dist" (jasmine) task
        Testing jasmine specs via PhantomJS

        Warning: Cannot read property 'pid' of undefined Use --force to continue.

        Aborted due to warnings.
...

After googling solution, found a way work around:

cd node_modules/phantomjs/
npm install

Jasmine working again then.

Oct 16, 2015

Install zmq extension to phpbrew

phpbrew doesn't (seems) support zmq in its official extension list.

Have to find a way around this issue.

Firstly, turn off phpbrew
  phpbrew off

Now using system php.

Next, upgrade system php to 5.6:
  sudo add-apt-repository ppa:ondrej/php5-5.6
  sudo apt-get update
  sudo apt-get install python-software-properties
  sudo apt-get update
  sudo apt-get install php5

Now, install zmq:
  sudo pecl install zmq-beta

After zmq.so created, copy it to the phpbrew directory:
  sudo cp /usr/lib/php5/20131226/zmq.so ~/.phpbrew/php/php-5.6.6/lib/php/extensions/no-debug-non-zts-20131226/zmq.so

Bingo! Now I can composer require react/zmq under my project!!

Links:
http://www.dev-metal.com/install-setup-php-5-6-ubuntu-14-04-lts/

Jun 1, 2015

Solved phpbrew problem with posix function not found

This morning apache complained to me that:

  posix_geteuid() function not found

So weird, because I installed this php version definitely with posix enabled, via phpbrew.

So I installed again:

sudo -s
phpbrew init -c config.yaml
phpbrew install 5.3.29 +dev (i have predefined a dev shortcut in the config file for convenience)
...
phpbrew switch 5.3.29
exit
sudo service apache2 restart

Not working....

So I decided to do it manually instead, guessing the config file not configuring phpbrew very fitting.


phpbrew install 5.3.29 +default +mysql +pdo +apxs2=/usr/bin/apxs2 +dba +filter +gettext +iconv +mcrypt +openssl +posix +session +soap +sqlite +gd -- \
--with-libdir=lib/x86_64-linux-gnu --with-gd=shared --enable-gd-natf --with-jpeg-dir=/usr --with-png-dir=/usr

This time the installed php version working.

So my guess is correct.

ps, the content in my config.yaml:

variants:
    dev:
        bcmath:
        bz2:
        calendar:
        cli:
        ctype:
        dba:
        dom:
        fileinfo:
        filter:
        gettext:
        ipc:
        iconv:
        json:
        mbregex:
        mbstring:
        mhash:
        mcrypt:
        mysql:
        openssl:
        pdo:
        posix:
        session:
        soap:
        sqlite:
        gd:
          - --with-libdir=lib/x86_64-linux-gnu
          - --with-gd=shared
          - --enable-gd-natf
          - --with-jpeg-dir=/usr
          - --with-png-dir=/usr
extensions:
    dev:
        xdebug: stable
        yaml: stable
        curl: stable
        gd: stable

Jan 9, 2015

解决 phpbrew gd 的 undefined symbol: php_gd_gdImageJpegCtx in Unknown on line 0

Issues coming one after one, started from the day I upgrade my machine from ubuntu 12.04 to 14.04.

Thanks to our ancient symfony 1.4 project, I had to ask phpbrew for php version 5.3.x, and then I got a problem with gd when project rebuild on the step of regenerating avatars.

It said in bloody color:

The image processing library GD is not enabled. See PHP Manual for installation instructions.

WTF?

I checked the extensions of current php:

  $phpbrew ext

Oh well, gd ext not enabled, so

  $phpbrew ext enable gd

However, it complained:
 
PHP Warning:  PHP Startup: Unable to load dynamic library '/home/htsg/.phpbrew/php/php-5.3.29/lib/php/extensions/no-debug-non-zts-20090626/gd.so' - /home/htsg/.phpbrew/php/php-5.3.29/lib/php/extensions/no-debug-non-zts-20090626/gd.so: undefined symbol: php_gd_gdImageJpegCtx in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/home/htsg/.phpbrew/php/php-5.3.29/lib/php/extensions/no-debug-non-zts-20090626/gd.so' - /home/htsg/.phpbrew/php/php-5.3.29/lib/php/extensions/no-debug-non-zts-20090626/gd.so: undefined symbol: php_gd_gdImageJpegCtx in Unknown on line 0
===> Enabling extension gd
gd extension is not installed. Suggestions:
$ phpbrew ext install gd

Damn it, how could it suggest to install an extension already installed, sth wrong with it definitely....

Googling time....... with painful tries...ruined my whole lovely friday morning....

When it turned to be hopeless, found a working solution:

$cd
$cd .phpbrew/build/php-5.3.29/ext/gd/
$make clean
$phpbrew ext install gd -- --with-libdir=lib/i386-linux-gnu --with-gd=shared --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr

This time it said install ok as before, but I saw gd in the enabled list when check extensions.

Thanks to this link for saving the rest of my Friday!






Jan 5, 2015

Solved the PHPunit not found problem after updated it by composer

PHPUnit now supports installation via composer:

$sudo composer global require "phpunit/phpunit=4.4.*"
$sudo composer global require "phpunit/phpunit-selenium"
$sudo composer global require "phpunit/dbunit"

But before installation, you would have to uninstall them via phear:

$sudo pear uninstall phpunit/PHPUnit_MockObject  \
 phpunit/PHP_CodeCoverage \
 phpunit/DbUnit \
 phpunit/PHPUnit_Selenium \
 phpunit/PHPUnit \
 phpunit/PHP_Timer \

However, symfony phpunit task lost its link to phpunit after above operations.

sh: 1: phpunit: not found

I had to link phpunit to /usr/local/bin, seems a temporary solution:

sudo ln -fs /home/ACCOUNT/.composer/vendor/bin/phpunit /usr/bin/phpunit

Reference links:
https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method