Score:0

Apache cannot find PHP

in flag

I have a shortcut:

c:/path/to/app1/current_php-cgi.exe.lnk

I am trying to do this:

FcgidWrapper "c:/path/to/app1/current_php-cgi.exe.lnk" .php

And Apache has no issue with the syntax but after reboot, any requests for a PHP file result in this error:

[Mon Jun 12 12:57:50.962946 2023] [fcgid:error] [pid 25564:tid 680]
(OS 193)%1 is not a valid Win32 application.:
mod_fcgid: can't run c:/path/to/app1/current_php-cgi.exe.lnk

^ separated to multi-line for easier reading

Is my desire simply unsupported?


If you want to know why, it's because I wish to have absolutely minimal downtime/reconfiguration when a PHP upgrade needs to happen. I want "app1" to have it's own PHP install and let app1 happily live even if "app2" might be ready for a PHP upgrade or maybe "app3" requires an older version of PHP.

Score:2
pt flag

a link is not an executable that can be run as is, so that's not surprising. The error message is on point:

is not a valid Win32 application.

Hence

Is my desire simply unsupported?

Yes, but it's also that it doesn't make any sense. Instead of specifying a link there, just specify the path to the actual executable. That's why that path is configurable.

I want "app1" to have it's own PHP install and let app1 happily live even if "app2" might be ready for a PHP upgrade or maybe "app3" requires an older version of PHP.

You can have different FCGI wrappers for different locations. That's way more sensible than trying to bend some link.

MonkeyZeus avatar
in flag
So would this be a limitation of `mod_fcgid` not resolving `lnk` files? I'm able to successfully use `lnk`s in `bat` files and it has no problem with them.
Marcus Müller avatar
pt flag
no, that's not a restriction of mod_fcgid. You're simply attributing properties to .lnk files that they don't have. In a batch file, the command interpreter reads the link file and just executes the code. That happens only there and when you double-click in windows explorer. A lnk file on windows is *not* in a way equivalent to the executable it links to.
MonkeyZeus avatar
in flag
I figured it out finally, see my answer below =)
Score:0
in flag

I've found that the most cross-compatible way to achieve my goal is to use a symlink to PHP's parent folder:

cd C:\path\to\app1\php
mklink /d current_php_dir C:\path\to\app1\php\8.2.1_x64

and then use this in the Apache config:

FcgidWrapper "c:/path/to/app1/php/current_php_dir/php-cgi.exe" .php

This now allows for the Apache app1 vhost, scheduled app1 tasks, and shell executions made by app1 to seamlessly point to the same PHP version at all times.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.