You are here: Re: Can't execute external program « PHP « IT news, forums, messages
Re: Can't execute external program

Posted by "Sandy Keathley" on 11/24/05 23:25

> > Here is the php I've created, fairly simple:
> > <?php
> > exec("/var/www/html/myprog -E 123456789098.dat sample1.txt
> > sample1.new");
> > phpinfo();
> > ?>

> > From the command line it runs perfectly

A PHP script runs with the permissions of the user that Apache
runs as, usually "nobody". When run from the command line, it
inherits a different set of permissions (i.e., root).

One option would be to put a copy of the executable in another
directory, but OUTSIDE of your DOCROOT, and give it the same
ownership and perms as "nobody" (or whatever Apache runs as).

Of course, this makes your script 100% non-portable, if that
matters. It is also possible that the executable may not run, if it
depends on compiled libraries elsewhere on the server.

************************************************************
WebDesigns Internet Consulting
E-commerce Solutions
Application Development

Sandy Keathley
Zend Certified Engineer
sandy@KeathleyWebs.com
972-569-8464

http://www.KeathleyWebs.com/
************************************************************

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация