Click Fraud Protection
PHP related blog, freelancer to hire!


Logging page rendering time in Symfony 1.xx

Change your SF_APP/web/index.php file to be: $timer = sfTimerManager::getTimer(‘myTimer’); sfContext::getInstance()->getController()->dispatch(); $timer->addTime(); $elapsedTime = $timer->getElapsedTime(); $fullRealUri = str_replace( sfContext::getInstance()->getRequest()->getUriPrefix(), “”, sfContext::getInstance()->getRequest()->getUri()); file_put_contents(‘/tmp/time.log’,date(‘Y-m-d H:i:s’).”|$fullRealUri|$elapsedTime\n\r”,FILE_APPEND);

Read more

Symfony admin generator problem

When you change your schema.yml file, especially removing column which you used before for sorting you can have face problem with 500 internal server error. Why? If you look closer into cache directory with auto-generated files you can see: protected function addSortCriteria($c) { if ($sort_column = $this->getUser()->getAttribute(‘sort’,

Read more

Zend Framework on-line tutorials/documentation

Last time I was using ZF when it was something around 1.5, so I was quite shocked when downloaded version 1.7 and started to use it. Documentation is quite ok, when you know what you want to do, but of course it is better when someone else

Read more

mod_rewrite on

To use it you need to include below line in your .htaccess file RewriteBase /

Read more

sFTP for PHP 5.xx

Install SSh2 extension for PHP, then you can use class below: <?php /** * Class to deal with sFTP connections * to use install * */ class SFTPConnection { private $connection; private $sftp; public function __construct($host, $port=22) { if (!extension_loaded(‘ssh2’)) { throw new Exception(“Extension ssh2 has

Read more

PHP CLI Progress Indicator

Today I wanted to create some progress indicator PHP command line, after minute googling I found After slight change: function progressBar($current, $total, $label) { $percent = round($current / $total * 100); if ($current == 0) { if ($label == “”) echo “Progress: \n”; else if ($label

Read more

HTML code in Zend Forms description

If you want to use HTML as description in Zend Forms use : $name = new Zend_Form_Element_Text(‘fullname’); $name->setLabel(‘Full name:’); $name->setDescription(‘Find customer’);

Read more

sfMemcachePlugin limitations

I’m using quite hapilly sfMemcachePlugin, but recently i needed to store object which was around 2Mb, and problems started. I’ve spend couple minutes trying to figure out why app is not working, finally i Found that memcache doesn’t store stuff more than 1Mb. To solve that, I’ve

Read more

Online CSS and JS compressor – save your visitor time

Today I needed to reduce size of CSS and JS which was almost 400Kb all together. Spending some time found usefull tools for it. and are winners Before compressing javascript file make sure that You don’t have anything compressed already there, all lines are ending with

Read more
Page 5 of 512345