4

I'm trying to write an extension for php using swig. I need to know the absolute path of the current php file in my extension code. I used __ FILE __ in my C code but it returns current c file name.

ChoiZ
  • 747
  • 1
  • 5
  • 23
Ali choobdar
  • 121
  • 6

2 Answers2

1

finally i found the solution. to access __ FILE __ in your php extension, you can use like this:

char *file_name = zend_get_executed_filename();
Ali choobdar
  • 121
  • 6
0

You can use the realpath() function. Specify the name of your current file.

hint: man 3 realpath or http://www.freebsd.org/cgi/man.cgi?query=realpath&sektion=3

Sébastien P.
  • 526
  • 3
  • 14