0

I have a problem with importing a vendor class in my Cakephp 1.3 project on my server.

I have just upgraded from Ubuntu 12.04 LTS server to Ubuntu 14.04 and I hit this problem: my vendor class in not imported corectly and crashes my whole project.

My error looks like this:

xmlDocument = file_get_contents($url); $this->parseXMLDocument(); } /** * parseXMLDocument method * * @access public * @return void */ function parseXMLDocument() { try { $xml = new SimpleXMLElement($this->xmlDocument); $this->date=$xml->Header->PublishingDate; foreach($xml->Body->Cube->Rate as $line) $this->currency[]=array("name"=>$line["currency"], "value"=>$line, "multiplier"=>$line["multiplier"]); } catch(Exception $e) { pr($e); } } /** * getCurs method * * get current exchange rate: example getCurs("USD") * * @access public * @return double */ function getCurs($currency) { foreach($this->currency as $line) if($line["name"]==$currency) return $line["value"]; return "Incorrect currency!"; } function getValue($currency) { foreach($this->currency as $line) if($line["name"]==$currency) return (String)$line["value"]; return "Incorrect currency!"; } } 

Fatal error: Class 'cursBnrXML' not found in /var/www/html/amsrentacar/app/app_controller.php on line 875

The code above the Fatal Error is actually the content of the class that was supposed to get imported using:

App::import('Vendor', 'bnr');
$currency = new cursBnrXML("http://www.bnr.ro/nbrfxrates.xml");

This code still works on my local Ubuntu 14.04 LAMPP powered desktop, but not on the server, and I cannot understand why.

Does anyone here have any ideeas?

I really need to get this working ASAP.

  • Does `app/Vendor/Bnr.php` exist? Where is the class cursBnrXML? What are you expecting to include/require that file? `The code above the Fatal Error is actually the content of the class` Sounds like you have php shorttag usage and the upgraded server has them disabled. – AD7six May 14 '14 at 08:15
  • Can you please ASAP format the error message so it's readable? – AD7six May 14 '14 at 08:16
  • The file exists in app/vendors/bnr.php and was working before the upgrade. If the problem is caused by shorttag being disabled, how can I enable them ? – Balaianu Andrei May 14 '14 at 08:18
  • bnr != cursBnrXML. If that file exists, it only means your App::import call is probably doing what you asked, that doesn't clarify what or how you are expecting to load the cursBnrXML class that is causing the problem. _Are_ php shorttags being used? Did you try typing "how to enable php short tags" in a search box? Remember to reply ASAP =). – AD7six May 14 '14 at 08:21
  • I did this [link](http://stackoverflow.com/questions/2185320/how-to-enable-php-short-tags) and the short tags are stil not working. (the file was using them, it seems). EDIT: I changed the wrong php.ini file, I needed to change /etc/php5/apache2/php.ini. Problem now fixed! :) – Balaianu Andrei May 14 '14 at 08:23

0 Answers0