Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open a file within piwik #7925

Closed
myluis opened this issue May 17, 2015 · 2 comments
Closed

Can't open a file within piwik #7925

myluis opened this issue May 17, 2015 · 2 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@myluis
Copy link

myluis commented May 17, 2015

Hi Folks,

I have a file with some login details that I want to use to connect to an external database. But when I try to use the code below, I get some funny error messages. Can someone tell me what I am doing wrong inside piwik, please? Is it possible to connect to a file inside piwik? If yes, how do you normally do that, please?

I have this code that I want to use to connect to another file within my piwik plugin.

if (!require_once("../../../test_config.php")) {echo "inc failed";}
$con = mysql_connect(DB_HOST_SSOS, DB_USER_SSOS, DB_PASSWORD_SSOS); 
if (!$con) { die('Sorry, could not connect: ' . mysql_error());}
$db_selected = mysql_select_db("ssos", $con);
if (!$db_selected) {die("It was not possible to use test_db : " . mysql_error());}

But when I run the code, I get this error message below.

PHP Fatal error: require_once(): Failed opening required '../../../test_config.php' (include_path='/home/work/company/piwik/vendor/pear/pear_exception:/home/work/company/piwik/vendor/pear/console_getopt:/home/work/company/piwik/vendor/pear/pear-core-minimal/src:/home/work/company/piwik/vendor/pear/archive_tar:/home/work/company/piwik/vendor/phpseclib/phpseclib/phpseclib:/home/work/company/piwik/vendor/phpunit/php-text-template:/home/work/company/piwik/vendor/phpunit/php-timer:/home/work/company/piwik/vendor/phpunit/php-file-iterator:.:/usr/share/php:/usr/share/pear') in /home/work/company/piwik/plugins/TestPlugin/Reports/GetCityContributors.php on line 30

Your help will be appreciated please.

@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label May 18, 2015
@tsteur
Copy link
Member

tsteur commented May 18, 2015

You need to build the path to that file like this PIWIK_INCLUDE_PATH . '/plugins/TestPlugin/test_config.php'.

For further questions please ask in our plugins & platform forum http://forum.piwik.org/list.php?9

@tsteur tsteur closed this as completed May 18, 2015
@myluis
Copy link
Author

myluis commented May 18, 2015

Thank you so much. You suggestion has solved my problem.

On Mon, May 18, 2015 at 9:36 PM, Thomas Steur notifications@github.com
wrote:

You need to build the path to that file like this PIWIK_INCLUDE_PATH .
'/plugins/TestPlugin/test_config.php.

For further questions please ask in our plugins & platform forum
http://forum.piwik.org/list.php?9


Reply to this email directly or view it on GitHub
#7925 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants