I recently installed Windows 7 on my laptop. I also configured IIS 7.5 on it, installed php 5.3.1 and MySQL 5.1.
Everything seemed to be installed correctly: I could see the IIS 7 Welcome screen, I could look at the php configuration with phpinfo() and I could see the MySQL tables using the MySQL Administrator GUI.
But when I tried to use phpMyAdmin, I got stuck: after trying to load the homepage of phpMyAdmin for 20-30 seconds, I got an HTTP Error 500. I searched the internet for hours, trying to find somebody with a similar experience, but I did not find any valuable resources.
Even a very simple test-script like
echo "#1. Try to connect to mysql server...";
mysql_connect("localhost", "username", "password") or die(mysql_error());
echo "Connected to MySQL<br />";
generated a HTTP 500-error, after a 20-30 seconds wait.
Eventually, I decided to look at what I had installed when I was still using Vista. The difference seemed to be php: on my previous system, php 5.2.10 was installed.
I finally uninstalled MySQL and php 5.3.1, and then reinstalled php 5.2.11 and MySQL 5.1.41. That combination seemed to work without issues.
Conclusion: IIS 7.5 + php 5.3.1 + MySQL 5.1 does not seem to be a workable solution (for now). Stick to the 5.2-branch of php if you want to use it on Windows 7/IIS 7.5.
A few weeks ago, I blogged about my first tests with Facebook Connect. Since then, Facebook has made it a bit easier by introducing the Facebook Query Language, or FQL.
FQL allows you to use a SQL-style interface to more easily query the Facebook social data. As an example, you can use statements like
SELECT name, pic FROM user WHERE uid=211031 OR uid=4801660
to get the name and picture of specific users.
Details about FQL can be found on the Facebook Developers website. To implement it in PHP, you use the following code:
$fbid = $facebook->user;
if ( $fbid )
$query = sprintf("SELECT name, pic_square_with_logo FROM user WHERE uid = %s",$fbid);
$user_details = $facebook->api_client->fql_query($query);
<? if ( $user_details["pic_square_with_logo"] != ''
<img src="<?=$user_details["pic_square_with_logo"]?>" />
<? } ?>
You can test FQL queries with the Facebook API test tool.
With 250 million users worldwide, Facebook can’t be ignored. If you have a website where users can log on to, Facebook Connect can help getting your usage numbers increased. Facebook Connect allows for an easy way for users to log on to your site.
A simple button will allow the user to log on to your site with their Facebook credentials. They don’t have to register, choose and remember a password, click on a confirm link, … The advantages seem to be clear.
Adding Facebook Connect to your website is not that hard, as a lot of information can be found at http://developers.facebook.com/connect.php. But there are some missing pieces to make it really easy if you have a website running PHP. So let me try to fill in the gaps.
The main steps can be found at http://wiki.developers.facebook.com/index.php/Connect/Setting_Up_Your_Site:
- Create an application with the Facebook Developer application. This will provide you with an Facebook Platform API key.
Follow steps 1-9 and note your public API key and a secret code.
- Download the Facebook PHP Client Library from http://wiki.developers.facebook.com/index.php/PHP.
- Upload all files in the /php folder to a folder on your webserver:
- facebookapi_php5_restlib.php, facebook.php, facebook_desktop.php
- all files in the /php/jsonwrapper subfolder
To use the API in your php-pages, you need to create a new Facebook object with your public AND secret API key:
$facebook = new Facebook('public_key','secret_code');
$fbid = $facebook->user;
$facebook->user is the facebook userid. If this is empty, the user has not yet logged in. You can get show a Facebook login button by using some XFBML-code:
<p>Log in with your facebook-account:
For this to work, you need to set up your site. Follow steps 1-5 for the XFBML code to work.
If the facebook userid is not empty, you can get information about the user with the users_getInfo method:
$user_details = $facebook->api_client->users_getInfo($fbid, 'first_name,
if ( isset($user_details) )
<p><? if ( $user_details['pic_square'] != '' )
<img src="<?=$user_details['pic_square']?>" />
<? } ?>
Hello <?=$user_details['first_name']?>, you are logged on