PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Running a Unix Command-Line App via PHP?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Running a Unix Command-Line App via PHP?

Réponse
 
LinkBack Outils de la discussion
Vieux 18/09/2007, 10h25   #1
Vik Rubenfeld
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Running a Unix Command-Line App via PHP?

I'm developing a web site in PHP for an Apache server.

I have a particular stand-alone application that takes a text file as
input, and produces a text-file as output. It's usually run from the
Unix command line. I'd like my PHP code to provide the input text file,
run the stand-alone application, and then read the output text file and
reformat it for display on the site.

Is there a way for my PHP app, to cause this Unix command-line
application to run?

Thanks in advance to all for any info.
  Réponse avec citation
Vieux 18/09/2007, 10h40   #2
Lars Eighner
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Running a Unix Command-Line App via PHP?

In our last episode,
<vikr-1ED27C.01253918092007@earthlink.vsrv-sjc.supernews.net>, the lovely
and talented Vik Rubenfeld broadcast on comp.lang.php:

> I'm developing a web site in PHP for an Apache server.


> I have a particular stand-alone application that takes a text file as
> input, and produces a text-file as output. It's usually run from the
> Unix command line. I'd like my PHP code to provide the input text file,
> run the stand-alone application, and then read the output text file and
> reformat it for display on the site.


> Is there a way for my PHP app, to cause this Unix command-line
> application to run?


> Thanks in advance to all for any info.


see the system() function in the manual. If your application can write to
STDOUT instead of writing to an output file, you can use the backtick
operator (see execution operators in chapter 15).


--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 490 days to go.
What do you do when you're debranded?
  Réponse avec citation
Vieux 18/09/2007, 11h52   #3
panda31
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Running a Unix Command-Line App via PHP?

On 18 sep, 10:25, Vik Rubenfeld <v...@mindspring.com.invalid> wrote:
> I'm developing a web site in PHP for an Apache server.
>
> I have a particular stand-alone application that takes a text file as
> input, and produces a text-file as output. It's usually run from the
> Unix command line. I'd like my PHP code to provide the input text file,
> run the stand-alone application, and then read the output text file and
> reformat it for display on the site.
>
> Is there a way for my PHP app, to cause this Unix command-line
> application to run?
>
> Thanks in advance to all for any info.


Hi,

I suppose you work with a LAMP configuration so, to execute on your O/
S an application, you must use system() or exec() functions.
Take care about input! If you use directly data from user input, think
about escaping them.

More information: http://fr.php.net/manual/en/function.system.php

Ciao

  Réponse avec citation
Vieux 19/09/2007, 09h11   #4
Vik Rubenfeld
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Running a Unix Command-Line App via PHP?

Thanks very much, guys. That worked great.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h38.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12149 seconds with 12 queries