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
  • Forgotten Administrator
  • 8,694 posts
  • LocationWA

Posted 20 April 2017 - 10:29 AM

There is no good way to do this.

What do you really want to do?

#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
  • Forgotten Administrator
  • 8,694 posts
  • LocationWA

Posted 20 April 2017 - 01:37 PM

Are you trying to execute C from PHP or PHP from C?

#5 kicken

kicken
  • Gurus
  • Wiser? Not exactly.
  • 3,227 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?
Recycle your old CD's, don't trash them!
Did I help you out? Feeling generous? I accept tips via Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users