In fact, it’s becoming increasingly common for websites to host their own pastebins. It can give you more freedom. There are many open source pastebin implementations; in researching this article, I came across at least twenty pastebin projects in active development. I tested a few of their online demos and settled on using Stikked for its advanced features and streamlined user interface. Stikked is built with PHP and jQuery and uses the CodeIgniter framework.
Installing Stikked
Stikked requires that your server is running:
PHP 5 Apache MySQL
To download the latest version of Stikked, visit the Stikked GitHub page or go to your command line and run: Using git clone will give you a folder called “Stikked.” Within that folder is another folder called “htdocs”; copy the contents of htdocs to a directory of your choosing on your web server. Before you can run Stikked, you need to prepare a few things. First create a MySQL database. If your server uses cPanel, you can do this by going to your administration page and clicking on “MySQL Databases.”
Create a database, add a user to it, and grant the database user all privileges. Now that you’ve set up a database for your Stikked installation, you need to modify the file application/config/stikked.php to point to it. Go to lines 18 through 21 and change the database information appropriately. For example: Now you should be able to access your-stikked-installation.com/index.php and see this:
The stikked.php file contains some other settings you can change as well. For instance, to require LDAP authentication, edit line 117: Note that if you set this to true, you must also configure your LDAP settings in application/config/auth_ldap.php. Fun fact: Line 99 lets you let you set the default name for anonymous posters to a random phrase: Scroll down to line 136 to view or edit the list of random nouns, followed by the list of random adjectives.
Styling Your Stikked Installation
All of the style data exists in the directory called “static.” For kicks, take a look inside the sub-directory “fonts” to see some interesting choices. Most of the styling choices are made in the file “static -> styles -> main.css”. I modified main.css to include one of the pre-installed fonts using the @font-face rule: Here is my “Create” page after I had a bunch of fun with main.css:
Features
Stikked has a number of interesting features that make it stand out from the crowd of other pastebin scripts. First off, it runs the gamut when it comes to syntax highlighting. Stikked supports a huge list of programming and scripting languages, from 4CS to Oz to ZXBasic. Whatever you’re coding in, your Stikked installation has (probably) got you covered. Each snippet’s language is displayed in a table on the “Recent” page; if the poster didn’t specify a language for a paste, then it is labeled “text.” The table also displays the title, poster’s name, and recency, along with an RSS icon. The RSS feed is located at your-stikked-installation.com/lists/rss. The “Trending” page is nearly identical but with the addition of a “hits” column and no RSS feed. Hits appear to be calculated based on visits from unique IP addresses.
When you create a paste, you have the options to set an expiration date, create a short URL using the service at gw.gd, and/or make the post private. Note that a “private” paste is not truly private; any user who has the paste’s URL can see it, unless you’ve enabled LDAP authentication – in that case, every registered user with the URL can see it. “Private” only means that the post won’t show up on the Recent or Trending pages. Security aside, Stikked provides some neat utilities for viewing a paste. I’m especially pleased with the embed code.
You can also reply to pastes and add your own edits from a form below the original paste. The only downside to this is that replies don’t link back to the original post; if your pastebin has many different posts and replies made at different times, it’s easy to lose track of their structure. I can only hope that the developer will at some point introduce a solution, such as threading the replies and implementing a diff viewer. One last feature I’ll mention is spam control, which Stikked refers to as “spamadmin.” Set it up by entering credentials in config/stikked.php on lines 79 and 80: Go to your-stikked-installation.com/spamadmin to log in. There you can see which pastes came from which IP addresses, remove pastes, and block IP ranges.
API
Stikked’s API allows you to paste to it from pastebin clients. The API URL to use in your client is your-stikked-installation.com/api/create. A basic example is to use the cURL command to upload a file called “smalltalk.st,” setting the title, name, privacy, language, and expiration time in minutes: This will return the URL of the paste.
Conclusion
If you’ve read that Stikked is dead, you’re wrong. While the old Stikked was abandoned after version 0.5.4, the new Stikked is going strong and continuing to introduce useful features with every release. I recommend you give it a try if you want an easy way to collect and share text snippets on your own website. What do you use pastebins for? Do you have a use for your own pastebin?