Best Encode for PHP5 and support symfony

In symfony, encoded classes excluded from config_autoload_yml.php. Because when symfony found the classes and read the contents, symfony can not find the words that contain abstract class|interface, final class|interface, class.

Following is the solution to make it work.

1. create config_handlers.yml in sf_root_dir/config folder and add

  class:    myAutoloadConfigHandler

2. add myAutoloadConfigHandler.class.php to sf_root_dir/config

3. change ProjectConfiguration.class.php and add myAutoloadConfigHandler.class.php

public function setup()

4. using ionCude Encoder to encode the files and add comment "class sfClassName" to the encode file.
Example: myTools.class.php

// class myTools
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');@dl($__ln);if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}@dl($__ln);}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file '.__FILE__.' requires the ionCube PHP Loader '.basename($__ln).' to be installed by the site administrator.');exit(199);

5. Now your files will be able auto load by the symfony.

6. Some link for ionCube
* The ionCube Home page
* The Standalone Encoder

ionCube Standalone PHP Encoder

* The online Encoder

ionCube Online PHP Encoder

7. Finally, I have write a task to encode the files, if you need the task file, please send a email to me. I will send the file to you.


Symfony 1.2 APC Cache

;##### APC config ###
;apc.enabled = On
apc.enable_cli = On
apc.shm_size = 128

Doctrine cache

As of sf 1.4

Setup for sf 1.2

In the ProjectConfiguration:

  •   public function initialize()
        //enable Doctrine cache
        $manager = Doctrine_Manager::getInstance();
        $cacheDriver = new Doctrine_Cache_Apc();
        $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver);

Example query (in UllFlowAppTable.class.php):

  •   /**
       * Find by Id
       * @param integer $id
       * @return Doctrine_Record
      public static function findById($id)
        $q = new Doctrine_Query;
          ->where('id = ?', $id)
        return $q->execute()->getFirst();

Compile apc and ssh2 for PHP 5.2.xx in Linux (ssh2, apc)

APC for Php 5.2.xx:

  1. wget
  2. unzip the download file
  3. run phpize in the unzip folder
  4. ./configure –enable-apc –with-php-config=/usr/local/bin/php-config
  5. make && make install
  6. enable the in php.ini

SSH2 for Php 5.2.xx

  1. wget
  2. wget
  3. unzip all downloaded files
  4. in libssh2 folder
  5. ./configure && make && make install
  6. in SSH2 folder
  7. phpize
  8. ./configure && make && make install
  9. enable the in php.ini

Update Boost in CentOS 5 x86_64

yum install libicu-devel
yum install libicu
yum install icu

export ICU_PATH=/usr
export ICU_LINK=-L/usr/lib64
export EXPAT_INCLUDE=/usr/include
export EXPAT_LIBPATH=/usr/lib64

yum install openmpi-devel

yum install expat-devel

./ --prefix=/usr

Edit project-config.jam
using mpi;

./bjam install