Jump to content

HTML_BBCodeParser (PEAR)


Tandem

Recommended Posts

I'm having all sorts of problems trying to set up HTML_BBCodeParser on a linux server via Shell.

I've installed the package and got the structure of it right according to:
http://www.sitepoint.com/article/bb-code-php-application

I have got it working on my local server which runs on windows, so i'm probably doing something wrong to do with linux.

Here is the code for my test script:
[code]<?php
error_reporting(E_ALL);
if (!empty($_POST['text'])){

require_once '/usr/share/pear/HTML/BBCodeParser.php';
$parser = new HTML_BBCodeParser(parse_ini_file('BBCodeParser1.ini'));
$parser = new HTML_BBCodeParser();
echo $parser->qParse(htmlspecialchars($_POST['text']));

}

?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
   <textarea name="text" style="width: 300px; height: 200px"><?php echo @$_POST['text']; ?></textarea>
   <br />
   <input type="submit" />
</form>
[/code]

Can anyone spot anything that i'm doing wrong from this?

Or if thats right can anyone suggest anything else i might be doing wrong? I will be happy to provide anything you may need to know in order to help me.

You can test my test script at http://217.174.251.128/testbb.php, which at the moment is producing complete nothingness.

Thanks in advance for any help.
Link to comment
Share on other sites

Sorry, thats just some freaky thing. At very least, the form should always display.

To be honest, I don't see anything in particular wrong with your code. There must be something within the HTML_BBCodeParser that is (maybe throwing an error and then) exiting the script.

Is there any is_error() method or something of the sort?
Link to comment
Share on other sites

I've managed to get errors to appear after some adjusting of php.ini...

Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/usr/share/pear/HTML/BBCodeParser.php) is not within the allowed path(s): ...

Warning: require_once(/usr/share/pear/HTML/BBCodeParser.php) [function.require-once]: failed to open stream: Operation not permitted in ...

Fatal error: require_once() [function.require]: Failed opening required '/usr/share/pear/HTML/BBCodeParser.php' (include_path='.:/usr/share/pear') in ...

Does that help at all?
Link to comment
Share on other sites

That produces .:/usr/share/pear

I changed the require_once path to include the .: and now the first error message is gone and i'm left with:

Warning: require_once(.:/usr/share/pear/HTML/BBCodeParser.php) [function.require-once]: failed to open stream: No such file or directory in ...

Fatal error: require_once() [function.require]: Failed opening required '.:/usr/share/pear/HTML/BBCodeParser.php' (include_path='.:/usr/share/pear') in ...

Link to comment
Share on other sites

it'd be worth trying out [url=http://uk2.php.net/manual/en/function.set-include-path.php]set_include_path[/url] to include the /usr/share/pear/HTML path, as .:/usr/share/pear/HTML isnt a valid path in itself. the colon ( : ) is a seperator for all of the allowed paths. the dot before signifies the current directory. so in effect, if the include_path is set to .:/usr/share/pear, what it's basically saying is "when including a file, look in either the current directory or the usr/share/pear directory.

add the /usr/share/pear/HTML like this:
[code]
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/pear/HTML');
?>
[/code]
Link to comment
Share on other sites

[quote author=thorpe link=topic=122025.msg503733#msg503733 date=1168655191]
Use this...

[code]
<?php
  set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/pear/HTML');
?>
[/code]

Then, by all rights you should only need....

[code]
<?php
  require_once 'BBCodeParser.php';
?>
[/code]
[/quote]

Ok i've done that and now i'm getting the following:
Warning: require_once(BBCodeParser.php) [function.require-once]: failed to open stream: No such file or directory in ... on line 9

The file is definitely there and i'm sure i've got the case right too. I'm totally stumped. Any suggestions?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.