PHP BBCode

software development

#1

Hey Guys,

I’ve been with Dreamhost for a few months now, and it’s been great. I’ve recently come across a problem though; I am trying to implement BBCode into my blog, in the comments. I want to use this because it is secure and works well. I have a custom BBCode class, but this has many security loopholes, and I wish to use the official one. Does any one know how to set this up on my dreamhost account?

Regards,
Chris Haseler


#2

Give up before you get tangled into the more issues that you will have created for yourself.

DreamHost Promotion Codes
Make a Website


#3

Hi Chris,

Adding the PECL version into your own PHP is really easy on DreamHost :slight_smile:

After compiling PHP, (pseudocode):

wget $bbcode.tgz tar -xzf $bbcode.tgz cd $bbcode $bindir/phpize ./configure --enable-bbcode make install cp $libdir/php/extensions/no-debug-non-zts-20060613/bbcode.so $extdirAdd to your php.ini:

extension_dir = " [ $extdir ] " extension=bbcode.so Key for the mess above:

$bbcode = bbCode package version $bindir = your bin directory $libdir = your library directory $extdir = your extensions directoryBig props for investigating the secure route straight up as well. Being security conscious is of paramount importance and will always eradicate any “tangles” that might crop up, rather than “create” them :wink:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#4

Thanks for the reply!

I ran into an error while trying to install the PECL extension. When I phpize I get the following error:

[broncos]$ /home/cjhaseler/php5/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

I googled around, but I couldn’t find anything to fix it. I tried installing autoconf, but that didn’t work. I also tried installing bbcode using “pecl install bbcode”, but that hit a memory limitation.

Any idea what to do?

Thanks!

Regards,
Chris Haseler


#5

Sorry for the tardy reply - been having some awesome network issues here.

Did you follow a Wiki script? If so, which one?

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#6

To install PHP 5 I used the “Main PHP5 Install Script” with the first method described at http://wiki.dreamhost.com/Installing_PHP5. It has correctly loaded my custom PHP because in the phpinfo() it says: “Loaded Configuration File: /home/cjhaseler/php5/etc/php5/haselerstudios.com/php.ini”

I couldn’t find a Wiki script to install the BBCode extension, though there were scripts for other PECL extensions, such as Zip (http://wiki.dreamhost.com/PECL_Zip). Should I try to modify that script for BBCode?

Thanks Again!

Regards,
Chris Haseler


#7

Yep, that would probably work. If you use other scripts as a guideline for what you’re trying to do then you won’t have any trouble at all on DreamHost. I was inquisitive of which script you had chosen in order to try visualise your current paths in my head.

Change the DOMAIN variable below:

[code]#!/bin/sh

DOMAIN="[color=#CC0000]yourdomain.com[/color]"

loc="$HOME/php5"
export PATH=$loc/bin:$PATH
export LD_LIBRARY_PATH=$loc/lib:/usr/local/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$loc/lib:/usr/local/lib:$LIBRARY_PATH
export CPATH=$loc/include:/usr/local/include:$CPATH
export tmpdir=$HOME/tmp
repos=http://source.sabrexhost.com/files/
current=/etc/php5/haselerstudios.com
autoconf="autoconf-2.64"
automake="automake-1.9.6"
bbcode="bbcode-1.0.2"
m4=“m4-1.4.13"
extdir=$loc/extensions
libdir=$loc/lib
srcdir=$loc/src
mkdir -p $tmpdir
mkdir -p $loc/{bin,etc,extensions,include,lib,src}
cd $srcdir
wget -q $repos$m4.tar.gz
tar -xzf $m4.tar.gz
cd $m4
./configure --prefix=$loc
nice -n 19 make
make install
cd $srcdir
wget -q $repos$autoconf.tar.gz
tar -xzf $autoconf.tar.gz
cd $autoconf
./configure --prefix=$loc
nice -n 19 make
make install
cd $srcdir
wget -q $repos$automake.tar.gz
tar -xzf $automake.tar.gz
cd $automake
./configure --prefix=$loc
nice -n 19 make
cd $srcdir
wget $repos$bbcode.tgz
tar -xzf $bbcode.tgz
cd $bbcode
phpize
./configure --enable-bbcode
make install
cp $libdir/php/extensions/no-debug-non-zts-20060613/bbcode.so $extdir
perl -p -i -e ‘s/.extension_dir./; extension_dir =/’ “$loc$current/php.ini"
mv -f $loc$current/php.ini $loc$current/php.tmp
echo “” > $loc$current/php.ini
echo “[extensions]” >> $loc$current/php.ini
echo “extension_dir=”$extdir/”” >> $loc$current/php.ini
echo “extension=bbcode.so” >> $loc$current/php.ini
echo “” >> $loc$current/php.ini
cat $loc$current/php.tmp >> $loc$current/php.ini
rm -f $loc$current/php.tmp
rm -rf $srcdir
echo "All done."
exit 0
[/code]
Note that this creates (and sets) an extensions directory: /home/cjhaseler/php5/extensions

…if it works! :wink:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#8

It works!!!

Thanks sooooo much!!! I really appreciate it!

Regards,
Chris Haseler