0

I need to call PHP function within my custom module controller. But the relevant PHP file contain in different folder. How I solve this? `

<?php function doLog($text) { 
// open log file
$filename = "form_ipn.log";
$fh = fopen($filename, "a") or die("Could not open log file.");
fwrite($fh, date("d-m-Y, H:i")." - $text\n") or die("Could not write
file!");
fclose($fh);
}
doLog("This is test");
?> 
asked Feb 26, 2016 at 12:07
3
  • Can you please be more specific? Is the code in a PHP class? What kindof classis? Model or Helper? Commented Feb 26, 2016 at 12:16
  • @RiccardoT No this is just a PHP file that containing function to write/append log file. Path for the file magento->testing->test.php. I have updated my question with code. Commented Feb 27, 2016 at 3:21
  • Why on earth are you doing this in the first place? Use the logging functionality provided in magento framework Commented Feb 27, 2016 at 5:33

1 Answer 1

1

You can mention URL like $url = 'http://127.0.0.1/magento/testing/curl.php'; or you should get base directory like $media_path = Mage::getBaseDir('media'); or you can redirect to relevant URL.

answered Feb 29, 2016 at 4:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.