Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Windows to run script in Unix Box

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
[COLOR=red yellow]THE SCENARIO:[/color]
Working on a project where the server is running on WIN 2K3 and data is kept in a unix box running a non-ODBC compliant application.

I need to push CSV or XML format data between the two.

I normally use system() to trigger a script at the OS where the PHP info is passed, parsed by the application and data is written to a flat file according to given parameters.

PHP in turn looks for flat file and does what it has to do.


[COLOR=red yellow]THE PROBLEM:[/color]
How can I bridge PHP WIN to/with unix box, run process in unix and extract flat file from unix?

Thank you all in advance for your time and assistance!




--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Ehm, through HTTP?

Just post the contents to a PHP script on the unix box. That script then finds it in the raw post data and can act on it.


+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
why not set up a php web service between the two? just serve the file from a php script?
 
Could you guys please speculate a bit more? [ponder]

Perhaps you could direct me to the PHP commands/functions you figure should get me started !!!

I am not sure setting up apache and php would be possible on the unix box.

Thanks,


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Is FTP an option?

Just search for "PHP ftp_put" or "PHP ftp_get". If you need help with some code let us know.

Mark
 
when you say
southbeach said:
not sure whether setting up apache and php would be possible on the unix box

are you saying that you don't have root privileges or that you're not sure whether combo would work on *nix?

if you can be clearer about your requirements, and perhaps explain why you are trying to achieve this as well as what you are trying to achieve, then we may be able to suggest more imaginative alternatives.
 
A couple of questions....
Is this a new app ?
Do the users interact with the Unix app
Sre you trying to expose legacy app data with PHP?
Where does the windows box come in ?
Is windows just for the php?
I think you have a number of options, perhaps the acceptable latency of the data is the key. You might be able to cron code on the Unix box (or rexec and FTP back to the windows box or use something like Samba to see the unix mounts as shares on the windows box.
I must say your original description is a little confusing e.g.
I normally use system() to trigger a script at the OS where the PHP info is passed
So might be worth while re-expressing you you need to do
 
[COLOR=red yellow][bold]Kozusnik[/bold][/color], yes, ftp daemon is running on unix box. I will research ftp_* as per your suggestion.

[COLOR=red yellow][bold]jpadie[/b][/color], At this point, I do not have admin access to the unix box and my contact at the site lead me to believe that they would like to not mess with it. I had them check if apache was installed and it was not.

[COLOR=red yellow][bold]Ingressman[/b][/color], you asked
Is this a new app ?
Yes
Do the users interact with the Unix app
Yes
Sre you trying to expose legacy app data with PHP?
Yes
Where does the windows box come in ?
As a web server (WAMP) - We could also setup a LINUX box ...
Is windows just for the php?
Yes, it is only for the web ...

When I said that I normally use system() and meant command(). That being said, I normally write a set of shell scripts which are called upon by PHP to run specific processes, produce specific reports (xml, csv or html) and these in turn are parsed by PHP and push back to web as needed.

I was hoping there was a way to open a "socket", if you will, connecting PHP/WIN to "LEGACY APP/UNIT" and do the data extraction that way.

The application is a very old, character based type of application. There is no ODBC nor any type of medium to map its data to anything at all. I can only write the code to export the data (which I can do very easily) but I need to trigger the command as if I were running it off the command line.

Thank you all ...




--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
just out of interest what is the underlying file/database on the Unix box?
 
it is called filePro (
I have developed filePro based applications for years and I am very fluent with it. Until now, PHP has ran within the same box thus presenting a challenge this time around.

filePro is pretty cool, fast, stable and easy to develop with (I have a full blown application I am giving away should you be even more interested ...).

Regards,


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
The web site says it's PHP compliant.
Wouldyou be able to install samba (or whatever) so you can see the Unix disc as windows shares ?
You couldthen create an ODBC data source on windows that points to the Unix box. You could then do all your processing from PHP
 
sorry ODBC compliant not PHP - that would be too easy !
 
I am thinking that instead of using windows for web server, we could go with linux and set a filesystem in both the SCO BOX and the LINUX box.

This route may be the easiest way to a functional environment.

Thanks,


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top