mtgriffiths Posted March 26, 2008 Share Posted March 26, 2008 Hey all, I am using jpgraph to create a bar chart using data from my database. It works fine when i am running it on localhost but when i transfer it onto my webspace i recieve the following error: Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/29/d239295547/htdocs/DDWA4/jpgraph/src/jpgraph.php on line 278 As it is to do with jpgraph i am stumped as i did not write this myself. The line that the error is pointing to is: 277 class JpgTimer { 278 private $start, $idx; Has anybody encountered this error before or know how to sort it out Thanks in advance Matthew Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 26, 2008 Share Posted March 26, 2008 Code that runs on one server and you get parse errors when moving it to a different server are usually caused by short open tags being used in the code. You would need to post more of your code to get any help with what it causing the problem. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 26, 2008 Share Posted March 26, 2008 What version of PHP are you using? The code you supplied will only work on PHP5+. Try changing 'private' to 'var' if you are using PHP4. Quote Link to comment Share on other sites More sharing options...
mtgriffiths Posted March 26, 2008 Author Share Posted March 26, 2008 I downloaded the jpgraph file and the other files needed off the internet from a website that was sent to me. The jpgraph file is over 7000 lines of code so im not too sure if its just that but thats the error that i am getting. Doesnt seem like im being to much help to what the problem is but as im completly new to jpgraph only using it for the first time today i am unsure. The hosting company that i am using supports both php 4 and 5. I will check to see what version of php i am using and then get back. thanks again Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 26, 2008 Share Posted March 26, 2008 Edit: Or as rhodesa states, a php4 problem. (Here it is again) - The end of life of php4 was announced 13-Jul-2007. The final bug fixes in php4 were released 03-Jan-2008. Php4 is a dead product. Everyone should have already made the switch to php5 or have a short term schedule in place for doing so. If you have php5 available, change over to it. Quote Link to comment Share on other sites More sharing options...
mtgriffiths Posted March 26, 2008 Author Share Posted March 26, 2008 php5 version of jpgraph is the one that i downloaded. Seems the error is th private to var functions. Im guessing i must be using php4. Cant find out what version i am using tho Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 26, 2008 Share Posted March 26, 2008 create a new PHP file, and but this in it: <?php phpinfo(); ?> Load that page up in a browser and you'll see the version Quote Link to comment Share on other sites More sharing options...
mtgriffiths Posted March 26, 2008 Author Share Posted March 26, 2008 The version i am using is PHP Version 4.4.8 I need to ask my hosting company to upgrade to PHP 5 then i think Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 26, 2008 Share Posted March 26, 2008 If that is an option, I would definitely go to PHP5 Quote Link to comment Share on other sites More sharing options...
mtgriffiths Posted March 26, 2008 Author Share Posted March 26, 2008 I was told by the FAQ page on my hosting companies site to put: AddType x-mapp-php5 .php4 into an .htaccess file. Didnt work anyhow...anyone know what this does? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 26, 2008 Share Posted March 26, 2008 Are you using 1&1 hosting? That is who I use and I put that code on all my sites. Try using this instead though: AddType x-mapp-php5 .php It tells Apache to send any .php files through the PHP5 compiler Quote Link to comment Share on other sites More sharing options...
mtgriffiths Posted March 26, 2008 Author Share Posted March 26, 2008 Yea im using 1and1 I will try the code u said. Should i put that code in a htaccess file like ive been doing? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 26, 2008 Share Posted March 26, 2008 yup, in a .htaccess file Quote Link to comment Share on other sites More sharing options...
mtgriffiths Posted March 26, 2008 Author Share Posted March 26, 2008 That seems to have made a change. I am getting a jpgraph error now saying that: /usr/X11R6/lib/X11/fonts/truetype/verdana.ttf is not readable or does not exist. Any idea why that is? It works fine localhost and ive put the same files in my directory as on my pc Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 26, 2008 Share Posted March 26, 2008 I've never used jpgraph, but is there a config variable to set the path to the Font dir? Quote Link to comment Share on other sites More sharing options...
mtgriffiths Posted March 26, 2008 Author Share Posted March 26, 2008 Just spoke to my mate... He suggested to change FF_VERDANA to FF_FONT1 and that worked. Seems like its working fine now. Thanks alot Rhodesa, that code u gave me for .htaccess worked great. Thanks again Matthew Quote Link to comment 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.