Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP Question

Options
  • 13-11-2011 4:28pm
    #1
    Closed Accounts Posts: 183 ✭✭


    Hi all,

    I am making a prison break fan website and want to use the php classes FPDI

    http://www.setasign.de/products/pdf-php-solutions/fpdi/

    I'm using php version 4.2.2.

    However, I get the following error

    Warning: Wrong parameter count for class_exists() in /....../fpdi.php on line 24

    Line 24 reads:

    if (class_exists('TCPDF',false)) {

    Has anyone any experience with this?

    Thanks


Comments

  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    The second parameter of class_exists() was added in PHP 5.0, and so that isn't going to work for you with PHP 4.2.2

    http://www.php.net/manual/en/function.class-exists.php

    You could try changing Line 24 to:

    if (class_exists('TCPDF')) {

    but I imagine you'll just run into other problems. Is there a reason that you're not using PHP 5?


  • Closed Accounts Posts: 183 ✭✭pvt6zh395dqbrj


    Hey,

    Yeah that seems to have worked. Thanks alot.

    Now I get an error saying

    Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /mnt/home/external/extatic/public_html/fpdf_tpl.php on line 262

    Fatal error: Class fpdi: Cannot inherit from undefined class fpdf_tpl in /mnt/home/external/extatic/public_html/fpdi.php on line 31

    The first one is probably a misplaced comma or something. But I don't know about the second one.

    line 31 is

    class FPDI extends FPDF_TPL {

    and the file fpdf_tpl.php is in the same folder as fpdi.php


  • Closed Accounts Posts: 183 ✭✭pvt6zh395dqbrj


    Ah I think I worked it out.

    The parse error in fpdf_tpl.php is on a line which starts with

    public function


    public and private and so on are only for php 5, is that correct?


  • Closed Accounts Posts: 183 ✭✭pvt6zh395dqbrj


    Ok parse error is gone but undefined class error remains. I may try declare them both in the same file.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Again though, why are you using PHP 4.2? That release is almost 10 years old and is no longer supported. I strongly suspect the library you're trying to use was not built with a ten year old PHP version in mind.

    Current stable release of PHP is 5.3.8.


  • Advertisement
  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    Goodshape wrote: »
    Again though, why are you using PHP 4.2? That release is almost 10 years old and is no longer supported. I strongly suspect the library you're trying to use was not built with a ten year old PHP version in mind.

    Current stable release of PHP is 5.3.8.
    he's probably using a hosting provider which has 4.2.2 installed, again this would ring alarm bells in my mind.


  • Closed Accounts Posts: 183 ✭✭pvt6zh395dqbrj


    Hi,

    Yes the people who host my website have 4.2.2 installed.


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Sometimes you can decide which PHP version to run and this is configurable via the host's control panel. I'd update to 5 if you can.


  • Registered Users Posts: 2,660 ✭✭✭Baz_


    The bigger question here is why would anyone make a fan website for a show cancelled years ago...

    I mean season one was entertaining enough and a site made then would have made sense, but the show got progressively worse (I think the writers must have been suffering the same illness as the lead guy and came out with progressively worse ****e) to the point that it made me throw up in my mouth after the last episodes, which I had to watch because I had invested so much time in the show.

    My advice is that you'll get better advice about your technical issue here if you are more forthcoming with information youre asked for, you seem pretty cagey. I mean why is your host using 4.2, php is free and you can have multiple versions installed on a machine so it sounds dubious...

    My second piece of advice, do a fan website for an as yet uncancelled show, person of interest is at season one and quite entertaining for example...


  • Closed Accounts Posts: 183 ✭✭pvt6zh395dqbrj


    Hi,

    1) Prison Break rules. Every episode is great and I take offence to your choice of language.

    2) My host uses PHP 4.2.2. I have contacted them to ask them to upgrade to the newest PHP and they said they would.

    What I wish to do is extract data from a pdf form. Now, I have written a script that will extract information from a pdf and store it as text. However, the specific pdf file I wish to work with has editable fields. You cannot stably extend rights to adobe reader users which allow them to save the data in the fields. THis means that when the text is extracted, the data in the fields is not. This is a problem because that is the very data I wish to store in a data base. And so the solution I have thought of (and I'm not sure if it will work so I didn't describe it in detail) is to read in the pdf, then make an image of it which is pdf'd and then convert that to text. To do all this I have to use the aforementioned pdf library that I spoke of.

    Thanks


  • Advertisement
Advertisement