Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4252006
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:44:15+00:00 2026-05-21T04:44:15+00:00

I have a PHP web application that needs to call a function in a

  • 0

I have a PHP web application that needs to call a function in a C++ library. This library is provided by a vendor (libfoo.a on a linux machine).

  1. My first instinct is to create a C++ executable that links against libfoo.a, and passes command-line parameters to the function. The PHP web application can then do a system() call to my c++ executable. This would be easy to implement. My concern is whether it would add a lot of overhead to create a new system process for each call. How much would this overhead be?

  2. An alternative is that I could use SWIG to wrap the C++ function in a PHP extension, but I don’t have the C++ source code. Does SWIG support linking with a “.a” library? Would it require every other engineer on my team to change their PHP configuration to build in libfoo.a?

If the overhead of the system() call is small (< 30 ms), I would prefer option #1, as it seems much simpler to create the C++ executable once, and not build it into the PHP application. What are your recommendations on the two options?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:44:16+00:00Added an answer on May 21, 2026 at 4:44 am

    Not sure what you did finally but I’ve done a simple php wrapper extension years ago calling a C++ lib. Like this you will not have overhead of a system call. I’ts not an issue for you, but you’ll have finer control over calls to the lib. For example keeping the wrapper loaded in memory as opposed to loading it on each call, keeping custom configuration parameters etc. I depends on the nature of your lib.

    Just some references that might be of interest:

    • Have a peek at this question: Extending PHP with C++?
    • You mentioned Swig but here is also an example using Zend on VS2005
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP web application on an intranet that can extract the IP
I have a PHP web application which uses a MySQL database for object tagging,
In my (PHP) web app, I have a part of my site that keeps
I have created a PHP-script to update a web server that is live inside
I'm using Eclipse and XDebug to develop a PHP application that relies on web
I've got a PHP application which needs to grab the contents from another web
I have a web application that has a WebDav share for Word that uses
I have a unique setup for a web application that I need to get
I have a web application, written in PHP, where we have a couple of
We have a web application which needs to store uploaded images with EdgeCast or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.