Jump to content


Photo

C compiler to php compiler


  • Please log in to reply
4 replies to this topic

#1 rajnaveen

rajnaveen
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 20 April 2017 - 10:09 AM

Hi Guys,

I have an function in php in the format of in-built source code file of that function in c language.So now what i do is that on compile the c file i got an executable file using those executable file in c.I want to run the php function to get the output in php.

For clarification Example:
One of the function in php -> crypt( )
I have an source code of that crypt( ) function which is built in c language.
I do some of the modification in that in-built code which is in c language.
After that now i compile the in-built code and got an executable file in c.
By using this executable file i want to run the crypt() function in php compiler and want the output in php.



#2 requinix

requinix
  • Administrators
  • Maddening Administrator
  • 9,561 posts
  • LocationWA

Posted 20 April 2017 - 10:29 AM

There is no good way to do this.

What do you really want to do?
The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"

#3 rajnaveen

rajnaveen
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 20 April 2017 - 11:41 AM

The function in php can be built using the c language.

Then how the code in c language can be executed in the php function.



#4 requinix

requinix
  • Administrators
  • Maddening Administrator
  • 9,561 posts
  • LocationWA

Posted 20 April 2017 - 01:37 PM

Are you trying to execute C from PHP or PHP from C?
The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"

#5 kicken

kicken
  • Gurus
  • Wiser? Not exactly.
  • 3,345 posts
  • LocationBonita, FL

Posted 20 April 2017 - 07:05 PM

If you want to run some C function code from PHP then you basically have two options:

1) Implement a PHP Extension in C so you can expose the function to your scripts or
2) Build an executable that you can run and use functions like exec or proc_open to execute it with your input then capture the output.

What kind of changes are you wanting to make to the standard crypt() function and why?
Did I help you out? Feeling generous? I accept tips via Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7
Kicken's World⦄ ⦃Recycle old CD's




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users