Problem With Executing A Command From Within My Script
I'm working on a web-based mail quarantine management system, and am
running into some problems getting it to run the command to release a
message.
The main exertp of the script is below:
<?php
echo "Releasing /var/amavis/quarantine/" . $_POST['release'] . " to
user " . $_POST['user'] . "<br><br>";
$command = "/usr/sbin/amavisd-release " . $_POST['release'] . " " .
$_POST['secretid'];
echo $command . "<br>";
passthru($command, $return_val);
echo "<br>" . $return_val;
?>
End script
This command works fine from the command line, but won't run using this
code. It comes back with a return code of 13 each time. I've also
tried the exec and popen functions in place of passthru() with no luck.
If it matters any, amavisd-release is an executable Perl script.
View Complete Forum Thread with Replies
Related Forum Messages:
Executing A Shell Command
I try to use the backtick "`" to exacute a shell command from a PHP script. However, `touch file`; doesn't make the file. Neather does exec(), system(), etc. They all work when is used a different command, such as pwd, or ls. So what's a brotha gotta do to creat a file?
View Replies !
Executing Command Lines...
I'm trying to execute a command line through ffmpeg.exe in php. Can anyone tell me how this is done. Also where should I have such an application installed relative to the root of the site?
View Replies !
Including External Php File And Executing A Command
I have two different servers, and i need to call a php of server B from server A, so i did this: SERVER A: index.php has: include('http://server-b/file.php'); The content of file.php is: phpinfo(); ... but phpinfo() throws info about server B instead of its parent file SERVER A.
View Replies !
Exec Command Executing The Program In The Background
i am running xampp on my computer from apachefriends.org, it's a apache server this is the php script <html> <head> <?php exec ('notepad'); ?> </head> </html> but when i execute the php script on my computer , notepad doesnt not run i used a process viewer and discovered that notepad is running in the background and i cannot see it does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)
View Replies !
Permission Denied Executing Shell Command
I am getting following error when executing shell command from PHP, where PHP/Apache is running as "nobody". du: '/home/example/mail': Permission denied du: cannot access '/home/example/mail/example.com/demo/': Permission denied.
View Replies !
Problem Executing Command Line Scripts On Win2003 IIS6 PHP4 Box
we're running an Win2003server with IIS6 and PHP4 in fastCGI config. When i try to use system() command to execute ffmpeg.exe it works ok when i run the PHP script from the commandline on the server, but when i run it from the webbrowser i get a return value: 128 and nothing happens. I checked for all the security settings, and everything seems fine. Does anybody have a clue where i should be looking?
View Replies !
Tracert :: Passing Command To Command Prompt Via Exec
I want to execute a "tracert" command in the command prompt via php (using windows) I've managed to use passthru() to open the command prompt (but it doesn't allow me to use it) and when I close it, it outputs the command prompt output in the browser. I don't mind whether the result is passed back to the browser to stays in the command prompt window (but that would use exec() I would think). So how can I tell the command prompt that launches to execute the line tracert 192.190.201.273 So far my experimental code is: <?php passthru("c:windowssystem32cmd.exe"); ?> EDIT: my backslashes have been stripped from the path, but you know what I mean!
View Replies !
PHP Not Executing, IIS 6
I'm attempting to run PHP on Microsoft IIS 6.0, and the PHP will not execute. For Example: test.php: <? phpinfo(); ?> When I request http://localhost/test.php I get a blank page. When I view the source, I get: <? phpinfo(); ?> Any ideas what I am doing wrong? Any resources that could guide me through the install process? The .php extensions are setup correctly (I believe) in IIS.
View Replies !
PHP Executing Twice
I am facing very strange problem When I submit any form using 'POST' method. my script executes twice. Is this a PHP bug or some thing else. I am using PHP4.3.1, MySQL 4.0.1, Apache2.x.x in Windows 2000 professional.
View Replies !
Executing JSP In PHP
I have a form processing script in php which submits data to email and a database, that works fine. However before it does that i need to create a secure hash from a jsp file. Im at a loss as to how to do this. Would the best bet be to use SOAP or similar, and if so would anyone be able to give me any pointers, i haven't indulged in web services as yet.
View Replies !
Executing Js From Php
I'm using CURL to navigate to pages on another website. There are links on the website which I need to navigate to that are created by submitting javascript, ie: <a href="javascript:blah">. Is it possible to use curl to execute these links and return the resulting page?
View Replies !
Not Executing (sometimes)
I run a message board site that has been having technical problems lately. Today I upgraded my version of php via an apache build in cpanel (now on php 5.0.x - but that doesn't seem to matter). When I access .php files that don't rely on a database, they run. However, all the .php files that use my MySQL database don't execute and prompt my browser to download. I should mention that I tried to upgrade MySQL today too. I was using 4.0 and upgraded to 4.1.
View Replies !
Executing An SSI Within A Php File.
I have the following line in an old shtml file: <img src="http://www.domain.com/cgi-bin/logtrack/log.pl?ref=<!--#echo var="HTTP_REFERER"-->" width=1 height=1 border=0> What this does is execute log.pl with the refererer to increment a logtracking program and find out what their referer is. How would I go about porting this to php?
View Replies !
Executing Scripts...
How do I execute one .php3 script from another. Passing one or two arguments, and then receiving the output? I have tried using the exec and passthru function, with no luck.
View Replies !
Executing Chunk Of SQL
I'm attempting to write an install script, I'm using the ADODB abstraction layer with my script, with that said here is my problem. I've got a large chunk of SQL that I need to execute through PHP, so I put it in a variable like so: $db_sql = " DROP TABLE IF EXISTS im_categories; CREATE TABLE im_categories ( id tinyint(11) NOT NULL auto_increment, name varchar(100) NOT NULL, type varchar(100) NOT NULL, template varchar(200) NOT NULL default 'default', PRIMARY KEY (id) ) TYPE=MyISAM;"; Then I try to execute it using: $result = $db->Execute($db_sql) or die(vpError() . $db->ErrorMsg()); I get the following error every single time and I have no idea what is causing it, the SQL data is from a phpMyAdmin export by the way. PHP Code:
View Replies !
Ajax Not Executing Php
When a user clicks a link I have it open up a file in a div using ajax. my code is <a href="#Find" onclick="javascript:jah('Find.html','content');">Find</a><br /> Where Find.html is an html file on the server. Now when I do this everything works fine except php code is not being executed. The jah code is function jah(url,target) { // native XMLHttpRequest object document.getElementById(target).innerHTML = 'sending...' if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(null); // IE/Windows ActiveX version } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(); } } } function jahDone(target) { // only if req is "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { results = req.responseText; document.getElementById(target).innerHTML = results; } else { document.getElementById(target).innerHTML="jah error: " + req.statusText; } } }
View Replies !
Executing Applicaitons
is there any way to execute desktop applications under a web interface using php? I need to get a non-finite amount of users to be able to execute a learning course program and use it remotely using a web interface.
View Replies !
Executing A .bat File With PHP
I have a .bat file that copies certain files across a network and I needed a way to run this file using PHP. I was looking at exec() but I was not sure exactly how to use it. I was also using pstools but could not get them to work with PHP. Can someone give me an example of how to do this or send me somewhere where I can read up on this?
View Replies !
Executing A Variable?
If a variable stores a function, could I execute the function by typing the variable alone? Or maybe by echoing it? <?php /* Set variable */ $math = round(23.89); /* Execute variable? */ $math; /* Echo variable? */ echo $math; ?>
View Replies !
Executing A Program
I am trying to run a console application which needs to keep running even after the php script has finished executing. I also need the PID or some sort of handle I can use to kill the program at a later stage.
View Replies !
Executing Php As An Application
Does anyone know of a program out there that has php bundled into it? I have ran into a few php editors that actually execute php right there on the system with only a php.ini file. So, I know there are ways to do it..I just need a direction to look in.. Any ideas?
View Replies !
Executing A PHP Function
I have a function, function output($output) { echo $output; } I have a variable, $myvar = 'This is my variable. The output is X' How do I combine the two? I've tried: $myvar = 'This is my variable. The output is' . output("this thing"); But no such luck.
View Replies !
Executing PHP In A Variable?
I'm doing a file include as: <?php $content = file_get_contents(TEMPLATEPATH . '/somefile.php'); echo $content; ?> In somefile.php, there is PHP code. How can I execute the code once $content is displayed as above?
View Replies !
Executing A Query
let's say I have this query PHP Code: SELECT data.*, art.* FROM `comic_pages` data, `artwork_picture` art WHERE data.art_id = art.uid however both comic_pages and artwork_picture contains an 'uid' field, and I need both uids. I've made up this function, but I think it's kinda hacky (and slow, taking over 6x the speed of a normal mysqli_fetch_assoc in this case) PHP Code: function db_multi_fetch_assoc ($result){ Â Â Â Â if (!is_object ($result))return false; Â Â Â Â for ($x = 0;@mysqli_field_seek($result,$x);$x++){ Â Â Â Â Â Â Â Â $field = mysqli_fetch_field ($result); Â Â Â Â Â Â Â Â $arr[$x] = $field->table.'.'.$field->name; Â Â Â Â } Â Â Â Â $data = mysqli_fetch_row ($result); Â Â Â Â Â Â Â Â for ($y=0;$y<$x;$y++)$out[$arr[$y]] = $data[$y]; Â Â Â Â return $out;
View Replies !
Executing A Php File
I'm trying to execute a php script on my linux server whenever I view a different page. So far this is what put on that page: PHP Code: <?php exec('php  /var/www/html/execute.php'); ?> I am trying to be logical with how linux executes php and the path to the file I wish to execute. But this was a best guess. So far it isn't doing anything, but I'm also getting no errors in the logs.
View Replies !
Executing Javascript From Php
I'm running a popular PHP forum on my server and wish to add a little holiday cheer to it, via javascript encoded bats that fly around your mouse pointer. Silly, yes I know, but I figured it would help me become a better programmer if I could only figure out how to execute the JS from my index.php. Can I simply cut and paste the javascript into the php somewhere and hope for the best, or is this going to be a difficult task? And, I'm using the PHPBB to run my forum. Any help would be greatly appreciated. (warning, I am sorta new at programming php).
View Replies !
Don't Stop Executing Php
There is an php function, i saw it but i can't remember it's name. When you close the page, or stop loading page, php continue generating the page. What is the name of function :/? Do you know?
View Replies !
Executing PHP In Wikimedia
Does any one have idea regarding the equivallent code for Php script in wikimedia. Presently I have developed a small application in PHP. I shud place my application in wiki. I 'googled' and 'wikied' hard to know the procedure to place my PHP script in wiki But Unable to understand nothing.
View Replies !
Get Executing File
Is it possible for php to tell the path to the file (php path, not html) that is currently executing? What I mean is, if I include() a file and in that included() file I call $_SERVER["PATH_TRANSLATED"] I get the path to the file that the include() is called in, not the path of the included() file that calls $_SERVER["PATH_TRANSLATED"].
View Replies !
Executing PHP Code With PHP
I'm making a script that will allow me to have multiple layouts and have a layout selector for the end-user. I'm attempting this with SQL and the script works with plain html, however I want to have php in the layout code from mysql and have it work but it wont work. Is it possible to do what I want to do with MySQL? Here is my code: <?php if(@include("config.php")) { $sqlconnect = mysql_connect($mysqlhost, $mysqluser, $mysqlpass); mysql_select_db($mysqldb, $sqlconnect); $grabinfo = mysql_query("SELECT * FROM xaler_info"); $info = mysql_fetch_array($grabinfo); extract($info); if($_COOKIE[layout] == "") { $code = mysql_query("SELECT * FROM xaler_layouts WHERE name='$defaultloc'"); while($source = mysql_fetch_array($code)) ..........................
View Replies !
Executing Php Statements
on my website(It is secure and only accessible to me) I have a form with a text area. I enter php statements there, such as last_modified() so I can see the result, than I click Execute. Here is where I am stuck. I need to take the post data from the textarea and execute it as php. Any idea how I can do this?
View Replies !
Executing From A Database
Store content (html and php) in a database, so far this hasn't been an issue. When I called the content from the database its displayed properly with the exception of php commands (specifically include() ). Rather then executing the include statement its printed as HTML in the source code of the document. I found one post on a PHP User Group board but the solutions provided don't seem to really work. I'm almost guessing that this is a security feature and although I'd prefer not to circumvent it, it would greatly help in what I'm trying to accomplish.
View Replies !
Som Crontabs Not Executing
i defined 5 entries to be triggered. 3 entries get triggered by crontab but two does not. no matter what i do they wont run. scripts are fine the problem is that crontab system doesnt even try to run it - thats what admin determined from the log. the two that doesnt run are:
View Replies !
Second SSI Include Not Executing
I have two websites. The production website is on a virtual hosting environment. The development website is on a PC clone running Red Hat Linux 8.0. The development site has been up and running great for about 3 years. I posted on the Apache Web Server forum and got not answers. The site uses .shtml SSI pages with cgi scripts and php code as includes. Muliple includes on the same .shtml page using exec cgi-bin work just fine. Code:
View Replies !
Updating Before Executing?
I'm setting up a database that right now has an id and then two fields, one of the fields I want to be constant. The second I'm trying to alter by using a drop down menu. When I make a choice in the drop down and hit submit it changes the attribute later in the document, but it seems like it regenerates the first part of the document as if it was using the old attribute. Code:
View Replies !
Not Executing Code
Hey im currenty running a home server with the following Microsoft XP Professional Using IIS5.1 and PHP 4.4.4 Ive created a page called info.php with the code <?php phpinfo(); ?> When i navgate to the page using http://localhost/info.php all i get is a blank white screen. When i right click and click on eiw source im still seeing <?php phpinfo(); ?> Does any1 have any suggestions on how i can sort out this problem.
View Replies !
Auto Executing PHP Code
Right now i am on a matrimonial site. i wanna do an auto match finder. ie; there may be many registrations in the site. i wanna findout all those matched profiles on a daily basis, say by 12 midnight each day. i wanna get that list as a mail even if i didn't checked the admin screens. ie; the script should execute on 12 midnight each day automatically. is there any way. can i do it using PHP.
View Replies !
Executing Function At A Later Time
I'm making a game sort of thing in PHP and I was wondering if there was a way in PHP that I can pause the execution of a function after x seconds. I don't want the whole script to stop working though, so for example // function 1 (pauses for 10 seconds) { // function 2 } // function 3 i want the script to execute like normal, but pause for 10 seconds before executing function 2, so it would execute function 1 and function 3 then 10 seconds later, execute function 2 this is exactly like the fork() statement found in MOO programming go here to get a clearer definition. ftp://ftp.research.att.com/dist/eostrom/MOO/html/ProgrammersManual_37.html#SEC37 is there a way to do this in PHP?
View Replies !
Executing Php From With A Perl Script
I know perl and can write the script. What I want to do is to be able to grab a page, pass it to php if it has the php extension, get the results(html) and then send it to the browser. Is it possible? I saw this bit of code on a server that seems to execute php. Don't know what it means, but it gave me the idea.
View Replies !
Executing Programs On A Server
i've written a c++ program that converts one file type to another via two arguments (the input and output filenames). i want to execute this on my server, using something like exec("myprogram.exe $arg1 $arg2"); but then I realized my server is linux, and my program was compiled for windows. so I uploaded the .cpp instead, and now i'm trying to compile it doing something like exec("gccp hello.cpp"); which returns an exit code 127... not really sure what that means. I'm guessing I probably don't have permission to be creating files on my server...is there anyway I can change this permissions or anything?
View Replies !
Executing Code Within A Hyperlink
I am writing a photo gallery and suppose 8 photos are displayed. When the user clicks on a button under the picture, I want it to add that picture name to a "favorites" list within the session data, but NOT leave the page the user is on. How could I do this?
View Replies !
How Can I Do Cron Job For Executing My PHP File
How can i do cron job for executing my PHP script once in every day. i want to remind the people about their birthday in reminder.php. that would be one week before thier birthday and one day before their birthday. can i perform this action with cron job?
View Replies !
Executing External Programs
I know all the different functions that allow me to execute an external progam, however I have come across and interesting problem that I need to fix if it is at all possible. Is there a way that I can use the php functions and execute an external program by some other user other then who ever owns the apache process?
View Replies !
Executing Php Blocks In A String
From the examples I've seen, I don't think eval() works for this, or if it does, I'm not sure how. Here's the setup. I'm storing web page content in a database. 95% of the time, all the php takes outside of the content area, setting up menus and footers, that sort of thing. But some web pages have php code in the middle. So I'll have a variable, $content, that looks like this: $content = "<p>I'm content</p> <?php print "hello world "; ?> <p>More content</p>"; How can I get php to execute the code inside the code blocks in the variable?
View Replies !
Executing A PHP Page Without Using The Webserver
We have a job in a PHP page on a Unix server which we have to start in two ways: Via Apache, that's easy and periodically in an automagic way. To execute the page periodically I need a cronjob for it. Has anyone any experience with executing a PHP script using cron?
View Replies !
|