Operating System - OpenVMS
1828228 Members
2716 Online
109975 Solutions
New Discussion

OpenVMS style filename problem with PHP

 
I. Melamed
New Member

OpenVMS style filename problem with PHP

On a Alpha box running OpenVMS V7.3-2, we have upgraded Apache and PHP to
CSWS Apache V2.1 and PHP V1.3.

The prior version the system (Apache V1.3 and PHP V1.1) allowed us to use
OpenVMS style file names in PHP scripts that created files (using the PHP
"fopen" command).

This PHP statement that worked in the prior version now aborts:

$outfile = fopen ("dga38:[phptest]php_test.dat", "w");

with this error message:

Warning: fopen(dga38:[phptest]php_test.dat): failed to open stream: i/o error

If I change the statement to be more UNIX like and remove the VMS square
brackets and colons, like this:

$outfile = fopen ("/dga38/phptest/php_test.dat", "w");

the PHP script will now work.

I do not see any setup/configuration docs that address this issue. I have
added "extension=php_openvms.exe" to our PHP.INI file, but that did not help
(Does anyone know what that extension does do?).

Has anyone else seen this behavior? Is there a way to configure the system
to recognize the VMS type file names? Any assistance or suggestions would
be appreciated...


im

Ira Melamed
Administrative Computing
Farmingdale State
Farmingdale, New York 11735
Email: melameis@farmingdale.edu
Phone: (631) 420-2415
Fax : (631) 420-2696
10 REPLIES 10
Karl Rohwedder
Honored Contributor

Re: OpenVMS style filename problem with PHP

Just a wild guess, but the newer C-RTL has many control logicals to setup such behaviour (only UNIX style filenames, only VMS style, a mix...).
The Openvms extension is demonstrated by the PHP_OPENVMS.PHP script (see installation guide).

regards Kalle
Hein van den Heuvel
Honored Contributor

Re: OpenVMS style filename problem with PHP


There are indeed lots of logical name to influence behaviour.
Full list:

http://h71000.www7.hp.com/commercial/c/docs/5763pro_003.html#feature_logical_tab

The next page has explanations.

Check out: SYS$POSIX_ROOT and DECC$FILENAME_UNIX_REPORT and such/

Hein.

Craig A Berry
Honored Contributor

Re: OpenVMS style filename problem with PHP

A more likely culprit among the feature logicals would be DECC$FILENAME_UNIX_ONLY as that one tells the CRTL not to even bother thinking about VMS-style filename syntax but assume all filenames are in UNIX syntax. Please note that the new version of PHP could enable this feature at start-up time even if it's not present in the environment in which you are running PHP.

You could, however, try

$ DEFINE DECC$FILE_NAME_UNIX_ONLY DISABLE

in the environment where your PHP script will run and see if that makes any difference.
Jan van den Ende
Honored Contributor

Re: OpenVMS style filename problem with PHP

Ira,

Craig wrote

>>>You could, however, try

$ DEFINE DECC$FILE_NAME_UNIX_ONLY DISABLE

<<<

... and if somehow PHP manages to re-define it, you MIGHT even try to add /NOALIAS to the DEFINE.

As always, no guarantee, but the thing I would also try.

Just my EUR 0,02

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Jan van den Ende
Honored Contributor

Re: OpenVMS style filename problem with PHP

Hey, Ira,

just noted you joined the Forums today, and this is your first question, so:

WELCOME to the VMS forum!

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Steven Schweda
Honored Contributor

Re: OpenVMS style filename problem with PHP

If the problem is caused by DECC CRTL feature
settings (like DECC$FILE_NAME_UNIX_ONLY),
then I wouldn't hold out much hope for a
logical name definition (no matter how fancy)
changing anything. As can be seen in any of
the stuff I've worked on in recent years,
these features may be controlled (enabled or
disabled) inside a program using the
decc$feature_set_value() function (and its
friends). The CRTL feature logical names set
default values, but the program can override
anything external.
Robert Atkinson
Respected Contributor

Re: OpenVMS style filename problem with PHP

Ira,
I would personally use the filename translation function OPENVMS_CVT_... :-

#
# Test the OpenVMS convert filename function
#
# openvms_cvt_filename (func_code, file_name)
#
# func_codes:
# OPENVMS_CVT_VMS_TO_UNIX Convert vms filespec to unix filespec
# OPENVMS_CVT_UNIX_TO_VMS Convert unix filespec to vms filespec
#
$VmsFn = "PHP_ROOT:[SCRIPTS]PHP_OPENVMS.PHP";
$UnixFn = openvms_cvt_filename (OPENVMS_CVT_VMS_TO_UNIX, $VmsFn);
if ($UnixFn === FALSE)
echo "openvms_cvt_filename (OPENVMS_CVT_VMS_TO_UNIX, \"$VmsFn\") = " . openvms_message (openvms_status ()) . "
\n";
else
echo "openvms_cvt_filename (OPENVMS_CVT_VMS_TO_UNIX, \"$VmsFn\") = $UnixFn
\n";

#

Robert.
I. Melamed
New Member

Re: OpenVMS style filename problem with PHP

First, thanks to all those that have taken the time to respond to my post.

I have tried two suggested fixes/work-arounds. I think I am able to get the
results I need using the second suggestion.

First, I tried setting the DECC$FILE_NAME_UNIX_ONLY logical, but it had no
positive effect on my .PHP script. I placed the following lines in the
APACHE$WWW users LOGIN.COM and stop/started the server:

$ SET VERIFY
$ SHOW LOG DECC*
$ DEFINE DECC$FILE_NAME_UNIX_ONLY DISABLE
$ SHOW LOG DECC*
$ SET NOVERIFY

The following appeared in the various APACHE$SWS*.LOG'S, and seems to me to
indicate the logical was set as expected:

$ SHOW LOG DECC*
(LNM$SYSTEM_TABLE)
"DECC$CRTLMAP" = "SYS$SHARE:DECC$SHR_EV56"
"DECC$SHR" = "SYS$SHARE:DECC$SHR_EV56"
(DECW$LOGICAL_NAMES)

$ DEFINE DECC$FILE_NAME_UNIX_ONLY DISABLE

$ SHOW LOG DECC*
(LNM$PROCESS_TABLE)
"DECC$FILE_NAME_UNIX_ONLY" = "DISABLE"
(LNM$SYSTEM_TABLE)

"DECC$CRTLMAP" = "SYS$SHARE:DECC$SHR_EV56"
"DECC$SHR" = "SYS$SHARE:DECC$SHR_EV56"

$ SET NOVERIFY

As I said, my original .PHP scripts still failed.

The second test - ran the sample code to execute the OPENVMS_CVT_VMS_TO_UNIX
and OPENVMS_CVT_UNIX_TO_VMS functions. The output of this test displayed:

openvms_cvt_filename (OPENVMS_CVT_VMS_TO_UNIX,
"PHP_ROOT:[SCRIPTS]PHP_OPENVMS.PHP") = /php_root/scripts/php_openvms.php

and translated the VMS file name to a UNIX style file name...and the reverse
function OPENVMS_CVT_UNIX_TO_VMS worked also.

So I guess I need to re-write my scripts to open/close files using UNIX style
file names and when I need access to the VMS style name use the function
OPENVMS_CVT_UNIX_TO_VMS. Maybe something like:

$unix_style = "/dga38/iratest/ira_test.dat";
$out_file = fopen ($unix_style, "w");
$vms_style = openvms_cvt_filename (OPENVMS_CVT_UNIX_TO_VMS, $unix_style);

It still seems a little odd to me that PHP on VMS can not handle the native
file format, but at least we understand a little of what is going on and
can deal with it.

Thanks again to all those who commented...

im
Steven Schweda
Honored Contributor

Re: OpenVMS style filename problem with PHP

> It still seems a little odd to me that PHP
> on VMS can not handle the native file
> format, [...]

It probably shouldn't seem odd. There's a
lot of UNIX-oriented code out there which
expects, for example, to parse a path name by
finding the slashes. This sort of code can
deal with UNIX-format file specifications
only. In such cases, telling the VMS C RTL
to use only UNIX-format file specifications
is much easier than re-writing a lot of the
code, especially when that code is subject to
frequent changes, and when getting
VMS-specific changes added to the official
code distribution is difficult.

If PHP had been developed on VMS instead, the
situation might be different.
Wim Van den Wyngaert
Honored Contributor

Re: OpenVMS style filename problem with PHP

Note that dga38:[phptest]php_test.dat is a valid unix file name.

Wim
Wim