OpenPNE (http://docs.openpne.jp/) is an open source (GPL) project to allow you to set up your own social networking site. The next thing you need to know is that this is Japanese software and it is not at all easy to use for any other language. At the time of writing this tutorial is the only English documentation that I know of.
The document covers getting and installing the system, configuration and basic use. The target reader is someone wanting to install it on their local machine for evaluation. There would be additional steps if installing on a production server.
My installation examples are for a Fedora Core 4 linux system, using the versions of Apache (2.0.54), PHP (5.0.4) and MySQL (4.1.19) that come with Fedora. Hopefully the instructions should be easy to adapt to your own configuration. However I have used specific paths in all examples to make them easy to copy-and-paste
Disclaimer: This document is simply my own notes as I went about learning how to use and customize OpenPNE; I am not an expert, and I am not one of the developers.
(SNS is an abbreviation meaning "Social Networking Site" and is used a lot;I have yet to discover what PNE stands for.)
Get the latest stable version from the download page. If you don't read Japanese the stable version should be the first download link on that page. At the time of writing the version number is 18.104.22.168, and it is a 1.9MB zip file.
The setup guide is here, and should be mostly understandable with only basic Japanese skills.
Here is how I installed it. Unzip the zip file somewhere. Move the public_html subdirectory to /var/www/html, and rename it to be "openpne". Now make a "system" subdirectory and move all the other files into that (i.e. into /var/www/html/openpne/system/). If you are using a public server alter your apache configuration to deny all access to that system directory (I tried keeping the system files outside the /var/www/html/ directory tree initially, but it did not work and I did not want to spend time working out why).
Next create a mysql DB called "openpne", and a mysql user called "openpne"; give that user the usual select/insert/update/delete permissions, but also permission to create tables/indexes. Create the DB with utf8 encoding and utf8_general_ci collation. I did those steps from phpMyAdmin, but they should work fine from the commandline as well.
Then to create the tables type these commands from the shell:
cd /var/www/html/openpne/system/setup/sql/ mysql -u openpne -p --default-character-set=utf8 openpne < mysql_001_table_structure.sql mysql -u openpne -p --default-character-set=utf8 openpne < mysql_002_init_data.sql
Now edit a couple of configuration files (all files are in UTF-8; gedit will work). The first is /var/www/html/openpne/config.inc.php. Change the first line to look like: define('OPENPNE_DIR', realpath('system/')); This setting just says where to find the rest of the openPNE system.
The second is in the system subdirectory, called config.php. The first four settings are the ones to change, and mine look like:
define('OPENPNE_URL', 'http://127.0.0.1/openpne/'); $GLOBALS['_OPENPNE_DSN_LIST']['main'] = array( 'dsn' => array( 'phptype' => 'mysql', 'username' => 'openpne', 'password' => 'your_password_here', 'hostspec' => 'localhost', 'database' => 'openpne', 'new_link' => false, ), ); define('ENCRYPT_KEY', 'your_encrypt_key_here'); define('MAIL_SERVER_DOMAIN', '127.0.0.1');
If blindly copy and pasting, please note that you have to insert your own mysql password, and your own ENCRYPT_KEY. The ENCRYPT_KEY setting just needs to be some string of ascii characters and is used to encrypt certain data (e.g. to obfuscate email addresses that are placed in URLs).
One final step: the var subdirectory needs to be made writable by everyone (well, making it owned by the "apache" user is probably sufficient):
chmod -R 777 cd /var/www/html/openpne/system/var/
Now open up a browser at http://127.0.0.1/openpne/. If you have installed correctly you should see a login screen.
Note: the Japanese setup instructions also mention email configuration, and cron configuration. These seem to be optional. The email configuration is just for mobile users. The cron configuration is to send out daily reminder emails to users.
Go here: http://127.0.0.1/openpne/?m=setup and follow the instructions. You'll give a name for your SNS, the administator username and password, and create the first (non-administration) user. You only get to run setup once: if you visit the URL again later it says "setup already done".
You can then administer your system at any time using http://127.0.0.1/openpne/?m=admin. If you read Japanese this should all be quite straightforward.
Go to http://127.0.0.1/openpne/ and login (using the email/password for your general user, not the admin user).
Usage is similar to Mixi (http://mixi.jp) and other social networking sites. Invite friends, write your profile, upload photos, write diary articles, join discussion groups, etc. Note that most profile items have a drop-down box giving you three options: show to everyone, only show to my friends, do not show to anyone.
When you invite a friend they get an email with a custom link allowing them to join. Until they join you see them as pending in your "invite friends" page. Once they join you see them in your "my friends" page, and also in your top page.
By default the SNS is set up as invite-only. However there is an option in the administration settings allowing you to make it open.
This section is a list of problems I had and the solutions I found.
By default mails sent from PHP have a sender address of "firstname.lastname@example.org", and many servers out on the real internet will refuse to accept them. So, as root, edit /etc/php.ini, and look for the sendmail command. I changed it from "sendmail_path = /usr/sbin/sendmail -t -i" to "sendmail_path = /usr/sbin/sendmail -t -i -f email@example.com". (Needless to say use your own email address here - friends will not see this address, but it is where bounce emails will go to.)
Any emails you sent before doing this setting are probably stuck in your queue and expire after 5 days. You may get a mail after 4 hours and after 5 days telling you about this. You can ignore them; you don't need to do anything.
You see the blank page because PHP had a fatal error but was set to not report the errors (due to placing "@" in front of the function call: see t_check_image_format() in openpne/system/webapp/lib/util/image.php). If you remove the @ sign the error message is:
Fatal error: Call to undefined function imagecreatefromjpeg()
And what that means is you need the GD PHP extension. To see what PHP extensions you do have installed type:
rpm -qa | grep phpIf you see "php-gd" listed there, then the problem is something else. Cannot help, sorry, good luck.
To install the php-gd extension I used yum like this (as root):
yum install php-gdIf you have yum installed and setup correctly it should all work like magic (php-gd is in the "updates-released" repository). If not, refer to http://fedorafaq.org for some yum advice.
After installing a new PHP extension you have to restart apache. As root type:
service httpd restart
Probably due to not having the gd extension; see previous item.
Just a guess, as I did not have this problem, but make sure you have the mbstring PHP extension installed and enabled. Refer to the previous question ("Photo Upload Didn't Work...") for how to add a PHP extension.
Here is a typical URL:
The m=pc means the "pc" module ("pc" meaning not mobile). See the /web/htdocs/openpne/system/webapp/modules directory for the others.
The a=page_f_home is the action to perform. The type is the part before the first underline, and the rest is the action. Two types are "do" for actions that may update the database (e.g. photo uploads); see /web/htdocs/openpne/system/webapp/modules/pc/do for the list of possible do actions. "page" is for the more passive display actions; see /web/htdocs/openpne/system/webapp/modules/pc/page for the list of possible page actions.
All actions start with a prefix, usually a single letter, which have these meanings:
Everything is in the database (as far as I can tell at the current time). This includes images and logs. So to do a backup you just need to dump your mysql "openpne" database regularly.
The only other files you may want to backup are the two config files that you edited when doing the setup. Or if using some mirroring tool such as rdiff-backup then set it to mirror /var/www/html/openpne once a day or so, but set it to exclude /var/www/html/openpne/system/var/.
The system/var subdirectory was set to be writeable when doing the setup. This is used for caching: images and html (smarty templates). Therefore the data does not, and in fact should not be, backed-up.
I have not done anything with OpenPNE since writing this tutorial: this page is the sum of my knowledge. But is has generated a few email queries, so I think there is demand for a high quality, open source SNS system.
If you have more questions, or want to get involved in translating it to other languages, the best place to go would be OpenPNE's own SNS: http://openpne.jp/, which has an i18n group. However you need an invite, and basic Japanese skills, to be able to use this site. There is also an i18n mailing list at: http://ml.pne.jp/mailman/listinfo/kokusaika which may be more useful if you do not speak Japanese..
If you want to see OpenPNE in action, in English, I can recommend Friends Gate: http://www.friendsgate.com/ - especially if you have an interest in Japanese culture. It uses OpenPNE, is free, and does not require an invite from an existing member. It now has over a thousand members.
© Copyright Darren Cook, 2006
About The Author: I am a freelancer programmer, living and working in Tokyo, Japan. You can learn more about my skills and experience at http://dcook.org/work/ and you can contact me directly at firstname.lastname@example.org.
Last updated: 18th Dec 2006, © Copyright Darren Cook, 2006.