简体   繁体   English

允许Apache运行的Perl脚本使用system()

[英]Allowing Perl Scripts run by Apache to use system()

I Have a perl soap service that I am using to bring together different user's data. 我有一个Perl Soap服务,用于将不同用户的数据汇总在一起。 The service works fine, however I would like to run "sort -u file1 file2 > file1" to consolidate the data collected with the data already on the server. 该服务运行良好,但是我想运行“ sort -u file1 file2> file1”来合并收集的数据和服务器上已有的数据。 I would like the perl script to call the system function once it has completed it's task 我希望perl脚本在完成任务后调用系统功能

Is this an issue of setting the correct permissions for Apache or something else? 这是为Apache或其他东西设置正确权限的问题吗?

directory listing: 目录清单:

var/www/script.pl var / www / script.pl
var/www/file1 var / www / file1
var/www/file1 var / www / file1
var/www/index.php var / www / index.php

Any help would be great. 任何帮助都会很棒。 Thanks 谢谢

sort -u file1 file2 > file1

Isn't going to do what you say you want it to do. 不会按照您说的去做。 Have you tried it from the command line? 您是否从命令行尝试过?

After you run that command, file1 will not contain anything that was in file1 to begin with, because the redirection will clobber file1 before sort gets to act on it. 运行该命令后,file1将不包含file1开头的任何内容,因为重定向将在file1对其执行操作之前破坏file1。

sort -u file1 file2 >file3; mv file3 file1

You seem to want to use system(), what happened when you tried it? 您似乎想使用system(),尝试时会发生什么? Did you get any error messages? 您收到任何错误消息了吗?

No, it is an issue of setting the correct permissions for the directory containing the file you want to write. 不,这是为包含要写入文件的目录设置正确权限的问题。

Find out under which user id/group id the Web server process is running (eg by looking at the process table with /bin/ps -AH -o user,group,cmd ), then refer to Controlling Access to Files in The Linux Cookbook . 找出Web服务器进程正在哪个用户ID /组ID下运行(例如,通过/bin/ps -AH -o user,group,cmd查看进程表),然后参考《 Linux Cookbook 中的“ 控制对文件的访问

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM