PHP

Tag Archives: PHP

The HipHop Compiler (HHVM) for PHP 27Nov, 2014

The HipHop Compiler (HHVM) for PHP

Today I am going to share an interesting article with you all. Although we all know, Facebook, the most used social network with over 1.3 billion active users worldwide, as of June 2014, is built on PHP. PHP is the most common scripting language for server side web development. So the problem in scripting language in general is their performance. They are easy to learn, easy to use, feature rich, but lack in performance. Below is the set of different languages for it’s performance against the CPU timing.   Therefore, this performance issue creates lots of implications for facebook. Bad performance can limit a lot of features for users, and requires lots of resources. So that raises a question for facebook….

Posted in: PHP
Cakephp – Logable behaviour 31Dec, 2010

Cakephp – Logable behaviour

This behavior is created to easily let you (the developer) log users activities that relates to database modifications (ie, add, edit and delete). If you just want to see what your users are doing or need to be able to say “That is not a bug, I can see from my log that you deleted the post yesterday.” and don’t want to spend more time that it takes to do “var $actsAs = array(‘Logable’);” then this behavior is for you.

Posted in: Cakephp
Facebook Connect in Php 30Dec, 2010

Facebook Connect in Php

Facebook Connect in PHP,Just Follow these Steps :- Upload all the files of zip folder on server.(Attached with this post) Step 1 : Just open the file where you have to use facebook connect.(e.g abc.php) Step 2: Just include this javascript file in head :- “<script src=”http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php” type=”text/javascript”></script>”. Step 3: Include the file “facebook.php”(Uploaded with this post). Step 4: To put login button of facebook connect :- <fb:login-button onlogin=’window.location=”http://www.xyz.com/abc.php”;’ size=”medium” background=”white” ></fb:login-button> Step 5: create the object :- $facebook = new Facebook(‘Facebook API key’,’Facebook App Secret Key’,true); Step 6: To get the user id of facebook login person:- “$fUserId = $facebook->get_loggedin_user();” Step 7: To get the session key for the api -> $fc = new FacebookRestClient(‘facebook Api keyApi secret key’,$facebook->api_client->session_key);…

Posted in: PHP
How to run a PHP script as Cron job from SSH (Linux shell) 12Nov, 2010

How to run a PHP script as Cron job from SSH (Linux shell)

You can run a PHP script on cron by setting up a crontab For this, first login to your shell using an SSH client such as PuTTY. And on the command line, type the following command (here # means the shell prompt): # crontab -e That will put you in the Vi editor editing your crontab. First press “i” to begin inserting, then type out your cron line following the format below for each line, then press the “escape” key on your keyboard to get out of insert mode, and then type “:wq” and press “enter” to save it. The form of a crontab file is: minute hour day month weekday command For example: 42 4 1 * * /usr/bin/php…

Posted in: Cron, SSH
PHP script – how to find the working days from a specified date? 21May, 2010

PHP script – how to find the working days from a specified date?

<?php /* This is a function to find out working days from a specified date and format of date must be dd-mm-yyyy First parameter to function is the date from which working days are to be calculated (working day exclude Sun and Sat) Second parameter to function is the number of working days to be calculated */ function workingDays( $fromDate, $interval ) { $date_array = explode(‘-‘, $fromDate ); $day = $date_array[0]; $month = $date_array[1]; $year = $date_array[2]; $working_date = array(); for ( $i = 1; $i <= $interval; $i++ ) { $day_text = date(“D”, mktime( 0, 0, 0,$month,$day + (int)$i,$year)); if( $day_text == ‘Sat’ || $day_text == ‘Sun’ ) { $interval++; continue; } $working_date[] = date(“F j, Y”, if (1==1)…

Posted in: PHP