Monday, June 18, 2012

Install APC for PHP in CentOS

yum install pcre-devel gcc httpd-devel php-pear
pecl install apc
64bit: restorecon /usr/lib64/php/modules/apc.so
32bit: restorecon /usr/lib/php/modules/apc.so
echo "extension=apc.so" > /etc/php.d/apc.ini
service httpd restart

Solution: Fatal error: Cannot inherit previously-inherited or override constant LEVEL_TOP from interface Swift_Mime_Message in Symfony

There is a bug in APC. You need install the latest version of APC to solve the problem between Swiftmailer and APC: Install the Latest APC on Debian

Friday, June 15, 2012

sfOTPPlugin - OTP Payment Plugin for Symfony, OTP PLUGIN SYMFONY

OTP PLUGIN SYMFONY
If you need it, please send me a mail to sakramenta [AT] gmail [DOT] com
Ha szükséged van rá, küldj egy levelet a sakramenta [KUKAC] gmail [PONT] com címre.

Thursday, June 14, 2012

Default Permission In Linux (Debian)

Set Default Permission to 777 for FTP:
  1.  /etc/vsftpd.conf
  2. local_umask=000
  3. /etc/init.d/vsftpd restart
  4. ftp clients have to reconnect.

Monday, June 11, 2012

List Form Errors in Symfony

<?php if( $form->hasErrors() || $form->hasGlobalErrors() ) : ?>
  
    <?php foreach( $form->getGlobalErrors() as $name => $error ) : ?>
  • <?php echo $name ?> : <?php echo $error ?>
  • <?php endforeach; ?> <?php $errors = $form->getErrorSchema()->getErrors() ?> <?php if ( count($errors) > 0 ) : ?> <?php foreach( $errors as $name => $error ) : ?>
  • <?php echo $name ?> : <?php echo $error ?>
  • <?php endforeach; ?> <?php endif; ?>
<?php endif; ?>

Friday, June 8, 2012

Doctrine Schema: float(18,4) ?

Use decimal instead of float in this situation:

    sale_price_eur:
      type: decimal(18)
      scale: 4

Monday, June 4, 2012

Unzip with PHP

     if(!class_exists('ZipArchive')) die('ZipArchive missing');
     $zip = new ZipArchive;
     $res = $zip->open('my_zip_file.zip');
     if ($res === TRUE) {
         $zip->extractTo('my_extract_to_dir/');
         $zip->close();
         echo 'ok';
     } else {
         echo 'failed';
     }