Jump to content
The Uniform Server Community

Different shebang for server running as program and server running as a service?


sacoman
 Share

Recommended Posts

Platform: Windows, UniserverZ 11, ActivePerl.

I use several directories for cgi. In each of them there is a .htaccess file with two lines: Options +ExecCGI and AddHandler cgi-script .pl .cgi .exe.

The Perl programs start with #!perl.

Starting the server with UniController.exe, Perl programs run properly.

Starting the server as a service using UniService.exe, I get error 500.

For error 500, the Apache log reports /dir1/dir2/.../someprogram.pl was not found.

Running as service I can solve the problem using absolute address for perl.exe, for example, #!C:/UniServerZ/core/perl/bin/perl.exe.

I'm thinking of the possibilities:

[1] This is a bug of the service or

[2] That's right, but I have not found documentation about or

[3] I'm missing something.

Thank you for the answers.

Link to comment
Share on other sites

Your solution "I can solve the problem using absolute" is correct! It is a requirement for Window XP.

However I noticed you are using Windows 7 there is a more elegant solution that allows you to use the Unix shebang "#!/usr/bin/perl" when running the servers either as a standard program or service.

Create two new files (link_create.bat and link_delete.bat) in folder UniServerZ with the following content:

link_create.bat

rem working directory current folder
pushd %~dp0

rem save us path
set us_path=%cd%

rem change to top level
cd \

rem create link
mklink /D usr %us_path%\core\perl

rem restore original
popd
pause

link_delete.bat

rem working directory current folder
pushd %~dp0

rem save us path
set us_path=%cd%

rem change to top level
cd \

rem delete link
rd usr

rem restore original
popd

Run link_create.bat (right click on file link_create.bat and run as administrator) allow program to make changes. This creates a symbolic link to the Perl executable.

Start UniController. From the Perl tab run "Force Unix Shebang" you only need to perform this once.
From UniController start Apache and check your Perl scripts run.
Close Apache and UniController.

Start UniService install and run Apache. Again check your Perl scripts run.

Note: To remove the link double click on file link_delete.bat

All the best
Ric

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...