Installing JPGraph with Hostgator website - php

I've been trying to install jpgraph to my hostgator website but there's a problem somewhere which I can't figure out. There's a few things which are causing me to think the problem could be in several places;
first, when unpacking the file to my desktop ready to put into the server I get an error of 'The destination folder is a subfolder of the source folder', for this I just click continue and it seems to be OK.
This unpacks the folders which I rename to jpgraph as per the example FAQ on http://jpgraph.net/download/manuals/chunkhtml/ch02.html#id2475509
second, when I look at the examples the original code is [code]require_once ('jpgraph/jpgraph.php'); though the file structure is such that it should be jpgraph/src/jpgraph.php though even when I update the file structre the file doesn't work.
Third, I noticed when looking at different files some of the file structures reference jpgraph 3.xxx(version)/jpgraph.php but others use the short form jpgraph/jpgraph.php
I can't find any reasonable installation (see:Any) installation tutorials from youtube and the other thread on SO wasn't very helpful as it was solved in the background.

From your comment it looks like your php script just cannot find the jpgraph scripts, p.e. wrong path.
Try something like this, if you're using jpgraph as the graph lib of your choice:
$jpgraph_dir = '/your/path/to/your/jpgraph/';
require_once($jpgraph_dir . 'src/jpgraph.php');
If you still receive this error message, your path is just wrong.

Related

My PHP page refer to Error:Missing controller

I´m new in PHP and creating dynamic webpages and after I installed Apache and my PHP IDE(codelobster) I face a serious problem.I really don´t know what I´m doing wrong but when I create new PHP project and I try to open it via my browser through localhost/...it always return me back a error page with this description:
Error:Missing controller
Cake\Routing\Exception\MissingControllerException
My php file is called oneironaut.php so it gives me also:
Oneironaut.phpController could not be found.
In the case you tried to access a plugin controller make sure you added it to your composer file or you use the autoload option for the plugin.
Error: Create the class Oneironaut.phpController below in file:
src\Controller\Oneironaut.phpController.php
I tried to create different projects like with different names and there was always this bug diference only with name of my .php webpage.So I think this must be some system error and something in my xampp/php or Apache settings must change.Maybe there could be some connection with my unfunctional debugger , I tried to download Xdebug from https://xdebug.org/wizard.php and even though I follow instructions on this website and another websites too I can´t successfully get xdebug extensions into my computer.So in this some help will be highly appreciated too.
So give me someone please help what to do with these problems? Thank You so much.
This seems to be happening because the server is loading files in "case-sensitive" mode.
You call your PHP file "oneironaut.php", however, the page is looking for "Oneironaut.php"
A similar question has been answered here, please try:
Missing Controller Error on remote server using Beta 3

php included file not updating after edit

I am using Pear Mail to send an email via php. I first ran into trouble when all the includes didn't work in the Pear Mail library - but found the answer when research showed I needed to change all the file paths to absolute file paths. I am doing that... BUT, after changing one and refreshing my browser window, the error message did not change:
the line in question:
include_once "Net/SMTP.php";
and this is the warning I get:
Warning: include_once(Net/SMTP.php): failed to open stream: No such file or directory in /usr/local/lib/php/Mail/smtp.php on line 348
I changed "Net/SMTP.php" to be: "/home/username/php/Net/SMTP.php" in the file path, and I continue to receive that same error. In a previous change (where I messed up) I got the error and saw the new incorrect file path in the Warning, so I know that part of the message should be at least changing.
I checked many things to make sure I'm not crazy:
that my edits went through - I opened the file I edited in 2 separate editors and saw my changes were correct.
that my file path was correct - again, checked both separate editors to make sure the file path was correct.
searched for a duplicate file name in another folder - in case I was editing the wrong file.
And I did the following to try to fix it:
changed the file path to something different
changed all "include_once" to "include" (in case my browser didn't want to reload a file
refreshed the heck out of my browser/cleared the cache/viewed on several browsers and computers
Googled everything I could think of
looked in a real-life paper book for possible newbie mistakes
My intuition tells me my browser isn't refreshing the included files.
But perhaps it's my server that isn't?
My intuition also tells me this is a basic mistake you would learn to avoid on day one.
Any help, clues, leading questions, links, etc... are greatly appreciated.
Thank you!!!
You should use this in the command line window:
pear install Mail
pear install Net_SMTP
Then your paths are not required any more since PHP takes care of it.
If you do not have installed pear before you of course have to do it first.
https://pear.php.net/manual/en/installation.php

Getting Braintree client token using PHP?

I'm following Braintree's instructions to create a client token using this page.
I made a Sandbox Account. Then, I downloaded the PHP library. The file downloaded as braintree-php-2.37.0.tgz, which I unzipped.
Then, using Eclipse for PHP Developers and following these directions, I:
went to Eclipse, then Preferences..., then PHP, then Libraries, then New...
made a new library called braintree
chose Add External folder... and added the braintree-php-2.37.0 folder which I had earlier unzipped.
went to the Properties of the app I'm working on
went to PHP, then Include Path, then Libraries, then Add Library...
then chose User Library and clicked Next >, then selected braintree (which I had just made) and clicked Finish
finalized by clicking OK
After I've done all of the above, I see that within the project's PHP Include Path folder, braintree is present with Braintree.php and all.
I then continued with the first set of instructions and my PHP file basically looks like this:
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('<my_merchant_id>');
Braintree_Configuration::publicKey('<my_public_key>');
Braintree_Configuration::privateKey('<my_private_key>');
$clientToken = Braintree_ClientToken::generate();
But nothing happens. It seems like the code won't even get past Braintree_Configuration::environment('sandbox');.
I see in many places that require_once 'PATH_TO_BRAINTREE/lib/Braintree.php'; is included but I don't know how to write the path to the Braintree.php file. I added the actual path which leads to where I downloaded the Braintree folder, but that didn't help at all. And I'm also further confused because I figured that Braintree.php is already added as a library.
I'm also using Google App Engine and uploading my PHP code to their server. I'm not sure if this is part of the problem or not.
EDIT:
I took the unzipped folder (braintree-php-2.37.0) and copied it into the PHP folder so it could be uploaded to Google App Engine as well.
I then edited my PHP code to be this:
<?php
require_once('./braintree-php-2.37.0/lib/Braintree.php');
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('<my_merchant_id>');
Braintree_Configuration::publicKey('<my_public_key>');
Braintree_Configuration::privateKey('<my_private_key>');
$clientToken = Braintree_ClientToken::generate();
?>
The code now won't get past require_once('./braintree-php-2.37.0/lib/Braintree.php');.
After discussing the details over with the staff from Braintree, we've come to the conclusion that, at the present moment, Google App Engine using PHP will not play nicely with Braintree's setup.
Hopefully there will be an answer to this problem in the future.

Error: Template Directory Not Found

I have cloned a git repo that someone made for a CodeIgniter website. I have a WAMP server set up fine in my computer and it works fine. In the Apache modules I enable the rewrite_module and in the PHP Settings I enable short open tag. I also put my database settings in the application\config\database.php file. After that, I put the CodeIgniter folder in the C:\wamp\www\CodeIgniter folder.
Now the problem is that when I go to localhost/CodeIgniter I get this:
Error: Template Directory Not Found!
I have looked for several hours online for this error but I could not find anything similar. If someone has seen this error before and knows how to solved it I will really appreciate any help or if you could point me in the right direction since I am new to CodeIgniter.
It sounds to me like your app is using a third-party Template library, and a config is incorrect
Search your application dir for "Template Directory Not Found" - that will take you to where the error message is in the code, and you can then figure out what library is calling it. Or, take a look in your application/config - most likely there's a file for it
"Template Directory Not Found" is not part of Codeigniter.

Opening a local file in Eclipse from the web

Right now, when I notice a problem on a page on my PHP web site, I have to look at the URL, mentally deduce what file is responsible for displaying that page, then navigate the Eclipse PDT file tree to open that file. This is annoying and uses brain power that could have been applied to solving the issue instead.
I would like my PHP web site to display on every page a link that I could click to automatically open the correct file in Eclipse.
I can easily compute the complete absolute path for the file I need to open (for example, open C:/xampp/htdocs/controllers/Foo/Bar.php when visiting /foo/bar), and I can make sure that Eclipse is currently open with the correct project loaded, but I'm stuck on how I can have Firefox/Chrome/IE tell Eclipse to open that specific file.
Edit
I'm going along the way of a data: URI, by adding a link to my file that contains the name of the file, with an unusual MIME type.
<a href="data:link/php;base64,IkM6XHhhb[snip]GhwIgo=">
View controller
</a>
The base64-encoded content is the absolute path to the file on my computer. When I click the link, Firefox lets me bind the content type to a new application, so I chose a batch file I wrote myself:
for /f "delims=" %%i in (%1) do (
notepad.exe "%%i"
)
This works. Now, I would like the file to be opened in the already opened window of Eclipse. What do I have to replace notepad.exe with in the above batch?
[pathtoeclipse]\eclipsec.exe -name Eclipse --launcher.openFile [fullpathtoyourfilehere]
I am not sure if it works with Galileo (i am on Helios)
Further reading: https://bugs.eclipse.org/bugs/show_bug.cgi?id=4922 (it is a long, long story)
I've tried similar things in the past, but this isn't as easy as it should be. The end result was always that Firefox would need an extension to execute a local file (I never found one that would do the job), and IE won't do it at all any more (save, maybe, for some complicated proprietary VBScript/WScript).
I see two workarounds to do this:
A function that displays the file path on your page in a big fat dialog window, making it easy to copy and paste into the Windows + R "Execute" Dialog
Alternatively, registering a custom Protocol (e.g. eclipse://) in your operating system, and tying that protocol to Eclipse. This is a pretty great way actually, I haven't tried this yet but definitely will in the next project I need this. Mozillazine: Register protocol (see the .reg file example)
You get the local path with FILE.
Maybe you try something like this?
<?php
'127.0.0.1' == $_SERVER["REMOTE_ADDR"] and print __FILE__;
?>
Is integrating Eclipse with Xdebug an option? I've done this with TextMate so that generated error messages are clickable to take me to the correct line in the right file. (See this question for details).

Categories