Featured

More Features

Browse our Featured collection

Latest News

More News

Post Browser

Hello friends, i wanted to get the list of facebook pages that logged in user created using graph api. But i have to research a lot and didn't get code online. So i have placed this tutorial to get list of pages that a user is admin of. Hope it will help. Please don't forget to place comment if it helps. Thanks.
$query1 = 'select page_id from page_admin where uid =' .$userid;
$query2 = 'select page_id, name, page_url from page where page_id in (select page_id from #query1)';
$queries = '{ "query1": "' . $query1 . '",
"query2": "' . $query2 . '"}';
$result = $facebook->api(array(
'method' => 'fql.multiquery',
'queries' => $queries ,
'access_token' => $access_token));

var_dump($result);
?>

Topic: How to get list of pages using fbl multi query?

Cron is a system daemon used to execute desired tasks (in the background) at designated times. I am demonstrating most simple form of cronjob in ubuntu.

  1. Open terminal and enter the following command:crontab -e
  2. Enter following line of code: 34 09 * * * env DISPLAY=:0 gedit
  3. Save this settings

Description: Here 34 represents minute, 09 represents hour and *,* and * are for every day, month and weekdays and * represents always. This will open text editor on 9 am and 34 minutes everyday, every month and every weekdays. Change 34 and 09 to your nearest upcomming time. For eg if your current time is 10:20 AM then change 34 to 24. So that you can see result within few minutes. So your modified command will look like this 24 10 * * * env DISPLAY=:0 gedit. Command env DISPLAY=:0 is for displaying gui programs like gedit. You can replace gedit with skype or any programs you like. crontab -e command is for editing the existing cron jobs. To check your existing cron job hit crontab -l in the terminal.

Topic: Easiest and Quickest way / tutorial to learn cronjob in ubuntu

To enable curl package php5-curl should be installed. Run the following command in your terminal

sudo apt-get install php5-curl


Now restart apache by running following code

sudo /etc/init.d/apache2 restart

Hope this solution will help to enable curl in your ubuntu system.

Topic: How to enable curl in ubuntu?

For a beginner its really a difficult to install LAMP on Ubuntu. Even if it is installed its very difficult to run phpmyadmin properly.
I am going to share my personal experience and difficulties we may encounter during installation.
First of all we are going to install apache, php, mysql and phpmyadmin
A) Installing Apache
B) Installing Php
C) Installing Mysql
D) Installing Phpmyadmin

A) Installing Apache

1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:

sudo apt-get install apache2

2. The Terminal might ask you for your password, type your password and then press enter.

3. Testing: Run http://localhost/ url in your browser. If you get a message "It works!" then Apache is sucessfully installed.

B) Installing Php

1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:

sudo apt-get install php5 libapache2-mod-php5

2. The Terminal might ask you for your password, type your password and then press enter.

3. Restart apache by runing this code to make Php compatible with Apache.

sudo /etc/init.d/apache2 restart

4. Testing PHP

i. In the terminal copy/paste the following line:

sudo gedit /var/www/testingphp.php

ii. Copy and Paste following line code into the testingphp file:

< ? php echo "Hello World!!!"; ?>

iii. Save the file.

iv. Run http://localhost/testingphp.php in your browser. If it displays 'Hello World!!!' then PHP is alswo sucessfully installed.

C) Installing Mysql

1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:

sudo apt-get install mysql-server

2. If you need to give access to the server you have created for others computer in your network you must edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Modify the line

bind-address = 127.0.0.1

to

Change 127.0.0.1 to your IP address (eg 192.168.0.1)

(Note you can skip this step)

3. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:

mysql -u root

If you get Following error message

"ERROR-ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

COMMAND:mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

ERROR:mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');"

then run

mysql -u root

4. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:

sudo gedit /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf file:

Include /etc/phpmyadmin/apache.conf

and restart Apache:

sudo /etc/init.d/apache2 restart

5. Now copy and paste this line in your terminal:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

Note: You can change password of your choice. But if you wish to work without your password then you should modify /etc/phpmyadmin/config.inc.php file

i. Run the following code in your terminal

sudo gedit /etc/phpmyadmin/config.inc.php

2. Change

//$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

line to

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

D. Installing Phpmyadmin
1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

2. Edit php.ini file by running following code in your terminal

gksudo gedit /etc/php5/apache2/php.ini

Change

;extension=mysql.so

to

extension=mysql.so

If you dont find ;extension=mysql.so then skip it uncomment other mysql lines eg.

3. Run following code in your terminal to restart apache

sudo /etc/init.d/apache2 restart

4. Testing: Run http://localhost/phpmyadmin in your browser if you get window of phpmyadmin then you might be asked with username and password.

Username: root

Password: (If you had set password from step C.5. then enter that password or leave it empty)

If you get login then congrats. Now you have got installed all Apache, PHP, Mysql and Phpmyadmin.

Topic: Easiest way to install LAMP On Ubuntu

Some times while we wish to run any project on xamp or wamp or lampp we might this error message as:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
Mon 24 Oct 2011 07:45:12 PM NPT
Apache/2.2.17 (Unix) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0c PHP/5.3.5 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

This is due to the permission problem. By default we don't have permission to access files so we need to change its permission. I have installed my xampp on /opt/lampp/ folder and my project folder name is testproject. To avoid this error i have granted permission as:

sudo chmod -R 0777 /opt/lampp/htdocs/testproject

After running this code on terminal. It works fine.

Topic: How to solve “Access forbidden! You don’t have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster. Error 403 localhost Mon 24 Oct 2011 07:45:12 PM NPT Apache/2.2.17 (Unix) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0c PHP/5.3.5 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1″ problem?
  1. Gjon: Thank You!!...
  2. gringo: If the permission change does ...
  3. Marco: It works!!! :D...
  4. admin: @nirav: welcome brother......
  5. nirav ( india): hi i m nirav from india a soft...
  6. admin: @geetanjali: Did u solved it n...
  7. Derian: Thank's buddy, it's really hel...
  8. geetanjali: no,i am still getting the prob...
  9. princess: It is not working.... I am sti...
  10. Alexandre: Good job man! You solved my pr...

Subscribe

Subscribe to News Feed Subscribe to Comments Feed

Enter your email to receive updates:

Uncategorized

More in Uncategorized

Uncategorized

More in Uncategorized

Photo Gallery

Copyright © 2012 Programmer to Programmer. All rights reserved.
Powered by WordPress.org, Custom Theme and ComFi.com Calling Card Company.