The Blog

PHP

Loading assets from a different server

Posted on

In a production environment you’ll eventually want to load assets (images, CSS and JS) from a different server. Perhaps you’re running your own asset server or you’re even using a CDN. This will require the files to be linked with an absolute URL. But in your development environment you don’t want this – you want assets to be loaded directly from the same server.
Read More

Posted in Symfony3 Leave a comment

Installing dbase.so for PHP5 on Ubuntu 14.04

Posted on


sudo apt-get install php-pear
sudo apt-get install php5-dev

sudo pecl install dbase

sudo vi etc/php5/mods-available/dbase.ini < extension=dbase.so
sudo php5enmod dbase

sudo service apache2 restart

That should do it. I would do that on a temp Ubuntu and just copy the dbase.so to the prod, so you do not install all that dev stuff in your prod env.

Posted in Linux, PHP 71 Comments

Time to move into PHP Framework

Posted on

Few of mine ecommerce client started to outgrow the ecommerce that I custom made for them. They’re into tens of thousands of orders and some sales reps have few hundred ship to addresses, things are no longer working well since concept of paging was not included in my original code and it feels like it’s too much work to individually try to think of all the areas where drop down menus or pages shows thousands of records that renders them useless.

So I’m going to try to recreate what I got for them in one of the available PHP framework. So far I’m looking at CodeIgniter, Symphony2 or Yii.

Idea is to create something that I can reuse for all those clients and also to create something that I can use just as a CMS for my other clients.

Main objective is scalability, security and future easy of expending, something that I’m missing in my current way of doing things.

Posted in PHP Leave a comment

Slick way to deal with 301 and 302 from Ajax call.

Posted on

On the Server side response with similar code:

header('HTTP/1.0 278 Ok');
echo json_encode(array('redirect' => "/"));
exit;

In JQuery bind AjaxSuccess to this function. Somewhere in a global header or layout page, so it get accesses from all pages.

$('body').bind('ajaxSuccess',function(event, request, settings){
if (request.status == 278){
jsonresponse = $.parseJSON(request.responseText);
$('form').dirtyForms('setClean');
window.location.href = jsonresponse.redirect;
}
});
Posted in PHP Leave a comment
« Previous PageNext Page »