radi8 Posted May 17, 2011 Share Posted May 17, 2011 I am using a PHP class for a web app that works perfectly well when developing on local machine (PHP 5.2) using the NuSphere IDE. NuSphere sees the class, and when I run the app locally everything seems to work, but when i port the app to the host (Linux Ubuntu with Apache2, PHP 5.3, MySQL 5.1 ), the class is not found (using the remote host debugger). The exact mesage is: Class 'ExcelXML' not found at <line of code>. Here is the code snippet: <?php function setExcelData($sql, $title, $fileName, $idref=0) { $retVal=false; //$fileName=$fileName.'.xml'; $fileName=$fileName.'.xls'; include ('ExcelXML.inc.php'); include_once $_SERVER['DOCUMENT_ROOT'].'/truck/inc/db.inc.php'; $input = ($idref==0?"blank1.xml":"blank.xml"); // create ExcelXML object $xml = new ExcelXML(); // read template file if (!$xml->read($input)) { echo "Failed to open Tempalate Excel XML file<br>"; } ... ?> Here is the class <?php /** * Class ExcelXML * Provide functions to modify the content of file in Excel's XML format. * * REQUIRED: * - An ExcelXML file as template * * FEATURES: * - read, modify, and save Excel's XML file * - create download stream as Excel file format (*.xls) * * CHANGELOG: * 06-08-2008 * - Update setCellValue function * - Fix setCellValue bug * 13-07-2008 * - First created * * * @author Herry Ramli (herry13@gmail.com) * @license GPL * @version 0.1.1 * @copyright August 06, 2008 */ class ExcelXML { var $domXML; var $activeWorksheet; function ExcelXML() { } ... ?> The class is in the same folder location as the calling php file. Any ideas? I don't get it. Quote Link to comment https://forums.phpfreaks.com/topic/236638-class-not-found-issue/ Share on other sites More sharing options...
KevinM1 Posted May 17, 2011 Share Posted May 17, 2011 Look at your text highlighting with the code you just posted. You're missing the opening ' in your first include statement. Quote Link to comment https://forums.phpfreaks.com/topic/236638-class-not-found-issue/#findComment-1216504 Share on other sites More sharing options...
radi8 Posted May 17, 2011 Author Share Posted May 17, 2011 That was a formatting issue I injected on this forum post and not a problem in the actual code page. Sorry for the confusion. Quote Link to comment https://forums.phpfreaks.com/topic/236638-class-not-found-issue/#findComment-1216506 Share on other sites More sharing options...
KevinM1 Posted May 17, 2011 Share Posted May 17, 2011 Have you checked your file/folder permissions? Quote Link to comment https://forums.phpfreaks.com/topic/236638-class-not-found-issue/#findComment-1216508 Share on other sites More sharing options...
micmania1 Posted May 17, 2011 Share Posted May 17, 2011 Start stepping through your code and debugging. Start by putting error_reporting(E_ALL) at the top of your main script. Try echoing text from you ExcelXML classes page (not actually in the class). Just to make sure its being included etc. Quote Link to comment https://forums.phpfreaks.com/topic/236638-class-not-found-issue/#findComment-1216512 Share on other sites More sharing options...
anupamsaha Posted May 17, 2011 Share Posted May 17, 2011 Few observations along with comments from others: 1. In your code, the include statement for the class is missing with a starting single quote. include('ExcelXML.inc.php'); If the above is not the issue, then: 2. This might be an issue with the location of the class file where you store it. In your localhost system, the file might be available through the "include_path" directive as set in the php.ini file. Now, if you stored the "ExcelXML.inc.php" in a folder, e.g. "includes" under your web root, include the class as follows: include($_SERVER['DOCUMENT_ROOT'].'/includes/ExcelXML.inc.php'); If the class file is available in the same location as the calling script, then: 3. If your local system is Windows, then ExcelXML.inc.php and excelxml.inc.php might be same for the script, i.e. Windows is not case sensitive. So, if you can rename the file in the LINUX server to the exact casing as in the code, it will resolve your issue. Hope, this might help you. Quote Link to comment https://forums.phpfreaks.com/topic/236638-class-not-found-issue/#findComment-1216513 Share on other sites More sharing options...
radi8 Posted May 17, 2011 Author Share Posted May 17, 2011 It was a permissions issue on the file. This is a new Linux LAMP server and I guess we are still learning. Thanks to all for your help and assistance. As always, you are the best source of help and support. Quote Link to comment https://forums.phpfreaks.com/topic/236638-class-not-found-issue/#findComment-1216529 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.