QProcess & Apache



  • When I try to start httpd.exe with QProcess, I get an error. Is there a way to start httpd.exe with QProcess?

    I'm currently using:

    [code]
    QProcess *httpd;
    QString program = "./apache/bin/httpd.exe";
    httpd->start(program);
    [/code]


  • Moderators

    What kind of error are you getting? I suspect you need to run this program using QFrocess::startDetached(). But it is hard to tell without more details.

    BTW: you are using relative paths. This approach will fail if your application is started from a different directory. It is more secure to use this:
    @
    QString program(QCoreApplication::instance()->applicationDirPath() + "/apache/bin/httpd.exe");
    @



  • [quote author="sierdzio" date="1391578111"]What kind of error are you getting? I suspect you need to run this program using QFrocess::startDetached(). But it is hard to tell without more details.
    [/quote]

    I'll take a screen shot later and upload it. The message say something along the lines of windows wouldn't allow some process to start, etc. Using startDetached, would that allow httpd.exe to run seperatly? When I use execute, apache starts, but the qt program won't allow you to drag it, or interact with it. I'm assuming, I would need to do the same thing with mysql as well? Yes, I know there's other programs like XAMPP, but I'm programming WinLAMP to have features that XAMPP doesn't.

    Edit: looking at the docs, I'm guessing what happened was apache tried to start, but failed because it wasn't its own separate process. I'll try using startDetached, and update based on results.

    http://qt-project.org/doc/qt-5.0/qtcore/qprocess.html#startDetached


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.