Category Archives: PHP

Smarty templates needs to be reload twice to see changes

I was having some issues with Smarty, when i updated a template i have to reload it twice to see my changes.

After some digging i realized that Zend OPcache was causing it.

So i jut disable Zend OPcache and now is working as it should.

just edit php.ini as root.

sudo nano /etc/php5/apache2/php.ini

Find the line where “opcache.enable=1” is and change it to 0, if it has a “;” remove it and that’s all

[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=0

Then we simple reload apache

  1.  
  2. sudo /etc/init.d/apache2 restart
  3.  

Make a post request usign CURL and PHP

  1.  
  2. $fields = array(
  3.         ‘a’=>‘1’,
  4.         ‘b’=>‘2’,
  5.         ‘c’=>‘3’,
  6.         ‘d’=>‘4’
  7. );
  8. $ch = curl_init();
  9. curl_setopt($ch,CURLOPT_URL, ‘http://mysite.com’);
  10. curl_setopt($ch,CURLOPT_POST, count($fields));
  11. curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($fields) );
  12. curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
  13. $result = curl_exec($ch);
  14. curl_close($ch);
  15.