Welcome! » Log In » Create A New Profile

Please help me: Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}''

Posted by Kangajo 

I just start to program with PHP.

I found the error -->Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}''in C:\AppServ\www\Kangajo\htmlpurifier\library\HTMLPurifier\Bootstrap.php on line 37

My coding is:

<?php require 'C:\AppServ\www\BossJam\htmlpurifier\library\HTMLPurifier.auto.php'; $purifier = new HTMLPurifier(); $dirty_html = ""; $clean_html = $purifier->purify($dirty_html); echo $clean_html; ?>

I don't know how to fix it, please help me.

use require_once not require.

not seen that error before tho. what version are you using?

$dirty_html = "";

could be because you are trying to sanitize an empty string?

You are probably using PHP4. What does echo PHP_VERSION; output?

Last error that I had posted maybe my mistake about php installation.
I tried to install PHP5 without re-install Apache, just my silly.
I don't know so much about PHP version and Apache version relation.
So (after googling for many hours) I re-installed to PHP5 and Apache 2.2 (with AppServ 2.5.9)that should fix it.

Thank you so much for every comments.

Anyway, now I still have some problem that I can't start Apache after re-install.
The error is "could not bind to address 0.0.0.0:80".
I notice that Apache Monitor show 2 servers that we can start -> Apache and Apache2.2 (but I can't start both - -!)

Maybe it because it was not completed uninstall the last Apache.
So,now I am searching how to fix it again(sine many hours ago).

If enyone can help me, please comment.

Now I can start Apache 2.2 after changed the LISTEN 80 to 79 in httpd.conf (also I had removed IIS that I used during programming with asp.NET).

Now the server is starting with Apache 2.2.4 and PHP5.2.0RC3 but I don't know why the "http://localhost/" still show "HTTP 404 - File not found" instead of index.php that existing in the location.

Assuming you're on Windows, you'll want to permanently stop the previous Apache processes by going to Windows Services.

You likely have another httpd.conf floating around that is pointing the DocumentRoot to another directory. Check your install directories.

Liberal googling is suggested with this post. I recommend you start off with XAMPP or some other pre-packaged server stack that will give you the least grief when you're starting off with PHP. Uninstalling everything you previously installed will help get you back on a blank slate.

OK, now I could fix it. I had re-installed windows (the last method that I can do) and after install AppServ (Apache2.2,PHP5) every thing is perfect.

I think maybe that problem is because of the uninstallation of the previous version Apache or PHP and I don't know why.

I will start to learn HTMLPurifier now.

Thank you for every helps.

Hello I get this same error: Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /htmlpurifier/library/HTMLPurifier.php on line 85

I'm trying to user HTML Purifier in www.awardspace.com and there should be PHP 4 & 5 both allowed.

What could I do to make it work (other than commenting all the html purifier lines in my php code lol)?

EDIT: I noticed that Awardspace is still using PHP 4.4.1 (at least on my account). So I should try to use HTML Purifier 2.x?

i wouldn't recommend at all using PHP 4.. if your webhost is still using PHP 4, then i'd ask them to upgrade to PHP 5 or you find a new host. PHP4 is dead and is no more supported or updated by the people who develop PHP, hence it's not only your site that could be compromised but even their own servers.

really, webhosts still using PHP4 need a wake up call, and fast, because they don't have their customers interests at heart, or their own for that matter.

&lt;blockquote cite=&quot;vaughan&quot;&gt; &lt;p&gt;i wouldn't recommend at all using PHP 4.. if your webhost is still using PHP 4, then i'd ask them to upgrade to PHP 5 or you find a new host. PHP4 is dead and is no more supported or updated by the people who develop PHP, hence it's not only your site that could be compromised but even their own servers.&lt;/p&gt;

&lt;p&gt;really, webhosts still using PHP4 need a wake up call, and fast, because they don't have their customers interests at heart, or their own for that matter.&lt;/p&gt; &lt;/blockquote&gt;

LOL I agree 100% ! :)

However, I need the site to work on their servers until I find better servers or they update to php 5.

Many webhosts, even though they don't state it explicitly, give you PHP5 if you ask for it. It can't hurt to try (unless their support really really crappy).

if your webhost doesn't allow php 5, i'd recommend surpasshosting.com

you could try with .htaccess for php 5.. add the following to .htaccess in your root folder :)

AddHandler application/x-httpd-php5 .php

If we're on the subject of webhosts, ICDSoft is pretty solid.

Sorry, you do not have permission to post/reply in this forum.