Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Can Not Execute Exec Function In Php


I am facing a strange problem , in linux server system commands like exec, system are enabled but one particular command is not working properly , either its returning null or 127. Command is exec(whois -h whois.crsnic.net "bnbnmnmbnmn.com") But this command is working properly in another linux server.

Any suggestion is well come excepting reinstall or re-configuration as its not possible . Commands like exec('whoami') are working . Server:linhost161.prod.mesa1.secureserver.net 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686




View Complete Forum Thread with Replies

Related Forum Messages:
Exec() - Execute C Programms
using exec() function in PHP i can execute linux programms like ls,who
and other, however i can not execute C programms and i really don't know
why.

View Replies !
Why I Can Use Exec() And Passthru() To Execute Lynx
i have try using exec("/bin/lynx -source http://URL") or passthru("/bin/lynx -source http://URL") but also not success and i have put the lynx inside the bin folder already but also cannot, why?

View Replies !
Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
This is kind of a part II to a question a posted earlier about exec and shell_exec not working.

I'm trying to use ftp_exec to execute some simple command:

$conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host");
ftp_login($conn_id, "$username", "$userpass") or die("Cannot login");
$command = 'cd..'
if (ftp_exec($conn_id, $command)) {
   echo "$command executed successfully";
} else {
   echo "could not execute $command";
}
ftp_close($conn_id);


I'm getting the following error:

Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21
could not execute cd..

Have tried other commands as well, get the same. Could this be a security issue or something to do with p Safe Mode? I don't know much about commands, shell, etc..

View Replies !
Folder Zip - Execute Unix Zip Command Exec()
1.Any one knows How to Zip the folder using php.

2.How execute unix zip Command exec() function.

View Replies !
Create Db Firebird With Php, Exec Does Not Want To Execute A File .bat
I am trying to create db firebird with php, script php generates and executes a file .bat . the file .bat creates db using isql in c:firebirdin, but .bat does not create db when is called by php script, but the file .bat if it works when it is executed from MSDOS, creates db correctly,

the question is ¿why the file .bat creates the data base when it is executed by MSDOS but it does not work when is executed by exec in php script? as php script can execute .bat to create db? PHP Code:

View Replies !
Warning: Exec() [function.exec]:
I'm using PHP Version 5.0.4 in IIS5, Window 2003. When I execute my script, it prompt me the following error :

Warning: exec() [function.exec]: Unable to fork [ping 10.8.1.70] in c:Inetpubwwwrootswitch.php on line 62
Below is my script :

<?php
$line1 = exec("ping 10.8.1.70", $output);
exit;
?>

View Replies !
PHP(curl) Execute AJAX Function?
I'm experimenting with CURL. I'm trying to post data with CURL. Everything went fine until I found a form where the site submits data using AJAX technology.

The data is still in <input> tag, so I can "type" it there using CURL. However, I can't submit the data as it is executed via <a> tag with Javascript (AJAX). Could you guys help me with this? Is it possible for PHP to execute AJAX function(with parameters sending)? Is there any similar example somewhere?

View Replies !
Execute A Remote Function For Inserts In DB
Well I need to have a system do a remote insert on a database, every X action the system would do this insert. Since the implementation could change we decided to host the actual function that does the insert in a remote server, and the client system would fetch this function and use it.

My approach was to fetch the code into a variable, create the function there with create_function and then just use it, it does work except for the parameters passed to the new function are not being taken into account by the code in the function. So, there are inserts in the database, but with empty values. Code:

View Replies !
Execute The Query By PHP (mysql_query() Function)
I try to ejecute the query by PHP (mysql_query() function) it seems to be wrong and gets me the 1064 error. This is the Query : Code:

SET @village = 1;
SET @segundos = (SELECT (( TO_DAYS( NOW() ) - 73000 ) * 86400 + TIME_TO_SEC( NOW() )) - (( TO_DAYS( `lastcheck` ) - 73000 ) * 86400 + TIME_TO_SEC( `lastcheck` )) FROM village WHERE `id` = @village);
SET @addwood = (SELECT (`addwood` * @segundos) FROM village WHERE `id` = @village);
SET @addstone= (SELECT (`addstone` * @segundos) FROM village WHERE `id` = @village);
SET @addiron = (SELECT (`addiron` * @segundos) FROM village WHERE `id` = @village);
SET @addgold= (SELECT (`addgold` * @segundos) FROM village WHERE `id` = @village);
UPDATE `village` SET wood = wood+@addwood,stone = stone+@addstone,iron = iron+@addiron,gold= gold+@addgold,lastcheck = NOW() WHERE `id` = @village;
SELECT @addwood as addwood, @addstone as addstone,@addiron as addiron,@addgold as addgold

View Replies !
Exec Function
Iv tried using this exec function and iv never used it before today.. im not completely sure what it does.

<?php

$command = "/movie/Without a Paddle.avi";

echo exec($command); ?>

I hoped that this script would open up a movie, but it doesnt.
I am using this function completely wrong or is there a problem with my code?

View Replies !
Exec() Function
I'm having trouble getting the exec() function to work in my script. I have never worked with this function and before I contact my server admin I want to verify my code is correct. script_name.php is in the same directory as this script that is running exec(). Is this correct?

exec("./script_name.php &");

View Replies !
Function Exec
I'm trying to execute a command with "exec" but it doesn't work. Here is my code : PHP Code:

exec("../../blast/blastall -p blastn -d est.txt -i testseq.txt -o test.txt");

I'm sure that my scrypt reads this line but nothing happen. Does someone know how to use this function ?

View Replies !
Create A Function To Execute Multiple Backups
I'm trying to create a function to execute multiple backups at once, using the following code:

View Replies !
My Function Returns True But My Code Does Not Execute
I cannot get this function to run the update query on Line 6, although the call to run the query evaluates true, and both update_cat_total functions execute, while the function itself returns true. Code:

View Replies !
Function Execute When User Exits Site
I have a site that shows a single pop-under when the user enters the site. As long as they are on the site (or 1 hour whichever comes first), they do not see another pop-under. PHP Code:

if(isset($_COOKIE['x'])){
    $showpop = $_COOKIE['x'];
    $cname = "tfnpop";
    $cvalue = "1";
    $cexpire = time()+60*60;
    setcookie($cname, $cvalue, $cexpire);
}else{
    $cname = "x";
    $cvalue = "1";
    $cexpire = time()+60*60;
    setcookie($cname, $cvalue, $cexpire);
    $showpop = 0;
} .................

View Replies !
PHP Exec Function No Output
I am running PHP 5.1.6 (cli) on Linux. When i use the exec($cmd,
$output, $return) command the $output array is always blank if the
command had an error in it. There are only values if the command was
successful. How do I capture the error text returned?...

View Replies !
Php Exec() Function Is Not Working
I am trying to execute linux command with php. I am try to log on as super user, so I have used the following code:

exec("su root");
exec("<password>");

But I dont think its working, becuase if I want to change my directory and view the list, I find myself in the same directory.
I have used the following code:

exec("cd /");
Passthru("ls -l");

View Replies !
Ssh2 Mod And Exec Function
Something very strangne happens with the function ssh2_exec, i can't
read the stream answer after execution in the remote computer. I work
with apache 1.3.30 and php 4.3.10 , libssh 2.0.5 . the ssh2 module
looks to work correctly but sftp functions cause a big delay causing
server timeout and ssh2_exec can't read the output. Tryed many things
recommeded in php website and forums but always the first ssh2_exec
reading success and the following ones fail.

$stream=ssh2_exec($conn_id,'/usr/bin/ls ./public_html');

I tryed to read the output with:

stream_set_blocking( $stream, true );
$cmd=fread( $stream, 4096 );

after

while($line = fgets($stream)) {
$cmd .= $line;
}

and

while( !feof($stream) ) {
$cmd .= fgets($stream)
}

Nothing success to catch the output for the second execute order. In
the same process only the first exec could be read.
Anybody know

View Replies !
Disable The 'exec' Function
How do I disable the 'exec' function in my linux php server? It's important in order to prevent users from planting PHP browsers on their shell account.

View Replies !
Using Exec() Function In PHP5
I have problem by using exec() function in PHP5, Apache and Windows XP to run an external program from my PHP page reside on server. When I call my program using exec() the page just stops (waiting for www.mysite.com...). I have used by absolute path and result was same.

Also, I have tested my PHP page by running by using PHP (or PHP-cgi) interpreter in command line and it just works fine without any problem. I don't know why it doesn't work when I call it from my page. Can anybody help ? I think it is something wrong with Apache or PHP settings. Am I right ?

View Replies !
Mail Function :: Execute Script In Body Of Email
I want to execute php script in the body of an email.. Is there any specific content type to be include in header ?

like..

include "www.xyz.com";  >> i want this line to be executed inside email
$headers  = 'MIME-Version: 1.0' . "";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "";

mail("asd@asd.com",$subject,$body,$headers);

-----------------------------------------------------------------------------
I tried ..
$body = "include "www.xyz.com";" ;
But it displays........ include "www.xyz.com" ; .......inside the mail

View Replies !
Exec() Function And Shell Scripts
I have a shell script written that basically grabs a selected .jpg or .png image file and wraps it as an .swf file for use in a dynamic Flash site. My question is this: What are the limitations of the exec() or system() commands? I can get them to work just fine with common linux commands(ie. ls -l, pwd, etc.), but it won't run these sort of commands:
./thisisascirptname
or
sh wrapper.sh

I get no results with these and yet when I perform the same operation on the command line by hand, it works just fine. This is the script I'm using to test it, by the way.

$lastline = exec("sh wrapper.sh", $all_output, $return_value);

print("<b>Last Line:</b><br>$lastline <p>
");

print("<b>All Output:</b><br>
");
for($index = 0; $index < count($all_output); $index++)
{
print("$all_output[$index] <br>
");
}

print("<br><br>
");

print("Return Value: $return_value<br>
");

The "ls" and other similar functions all return properly. I can't figure this out and it's driving me nuts. Any help?

View Replies !
Problem Using System/exec Function.
I am faced with strange problem. Basically I want to make a script which would take mysql back up for me. I have come up with following. [ basically code is borrowed from some other place ]
PHP Code:

View Replies !
Exec() Function Under Windows 2000 With IIS?
Are there any tricks to getting the exec() function to work under
Windows 2000 with IIS? PHP v4.0.2 is installed on the server.

View Replies !
PDOStatement Error : Call To A Member Function Execute() On A Non-object
I'm encountering a strange error with PDO. The server is FreeBSD 4.4,
PHP 5.1.2, mySQL 4.0.20 with 4.1.18 client libs.

I have the following code (usernames and passwords changed to protected
the innocent ^_^)

<?
$db_dsn = "mysql:host=dbHost;dbname=dbName";
$db_username = "username";
$db_password = "password";
$db = new PDO($db_dsn, $db_username, $db_password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$statement = $db->prepare("SELECT * FROM myTable");
$statement->execute();
?>

I get an error on the last line "Fatal error: Call to a member function
execute() on a non-object"

What's strange is this code works fine on my development servers, and
used to work fine on this server up until a few days ago. I've
restarted the server several times, recompiled php with the following
configure script

../configure --with-pdo-mysql=/usr/local/mysql --with-curl=/usr/local
--enable-versioning --enable-memory-limit --with-layout=GNU
--enable-ctype --enable-overload --enable-posix --enable-session
--enable-tokenizer --with-expat-dir=/usr/local --with-imap=/usr/local
--with-jpeg-dir=/usr/local --with-mysql=/usr/local/mysql
--with-pcre-regex=yes --with-png-dir=/usr/local --with-zlib-dir=/usr
--with-zlib=yes --with-regex=php --enable-cli
--with-apxs2=/usr/local/www/bin/apxs --prefix=/usr/local
i386--freebsd4.4 --enable-spl --with-pdo --enable-pdo
--with-gd=/usr/local --disable-all

This is the only script that gets run so there's definitely no problems
with open cursors (I've read the posts about
PDOStatement::closeCursor()).

The only thing I can think of is that the 4.1.18 mySQL client libs wont
work with PDO and mySQL 4.0.20. I've tested with old-school mysql
functions (mysql_connect) and it works fine, its only PDO that breaks.

View Replies !
Using Exec Function To Get A .exe Return Status Gives CGI Error
I'm trying to make a web page to work. It worked before so it has to
be something related with the configuration.
My problem is a call to a compiled executable (made for me) that
returns 1 or 0. It does not print any text to the standard ouput so
the error is strange:
CGI Error: The script can .. because of the HTTP headers (I have it in
spanish so the message is not the exact one).

As supposed, the HTTP headers are needed only if the executable prints
out a text to the browser but it's not the case. And (I repeat) It
worked as it before. The machine had to be formatted and the guy in
charge of that is not with me anymore.

View Replies !
Exec() Function Warning: Unable To Fork (Access Violation At 77F81B4D)
I am trying to execute a DOS command with the exec() function. All I get is fork errors or access errors, regardless of what file I try to execute. Example:

<?php
exec("sync.bat");
`sync.bat`;?>

Warning: Unable to fork [sync.bat] in C:testexec.php on line 3
Warning: Unable to execute 'sync.bat' in C:testexec.php on line 4
PHP has encountered an Access Violation at 77F81B4D


Id doesn't seem to matter what kind of file I try to execute, .exe, .bat or .com. Any ideas? Has ANYONE executed an external program under php/Windows?

View Replies !
Give Time To Execute Something, If It Doesn't Execute, Do Something Else
How can I give time to execute something, if it doesn't execute, do something else?

For example, the code tries to connect to a server, if it doesn't connect it stops the code.

How can I make it so that it tries to connect for 10 seconds, if it doesn't connect it goes on to do something else?

I saw a code doing this somewhere some time ago, but now I can't seem to find it

View Replies !
Cant Execute Commands With Execute()
I am trying to do the following:

exec("cat filename.txt | /usr/sbin/sendmail -v chandakme@yahoo.com");

It is supposed to mail the contents of the filename.txt to the email adress. If i run this command from the shell , contents of the file are emailed. but if run it from php using exec, i get an email but without any contents . i have already done chmod 777 filename.txt

For some weird reasons, i cant use mail() function of php...so i have to run this command somehow.

View Replies !
Execute Exe In Php
Im trying to execute a visual basic program that i have compiled and i want to execute it in php. (The vb program takes data out of a mysql database and writes it into an excel spreadsheet).

View Replies !
How To Execute PHP
I know how I can get a PHP script to execute by having a
form with a post method in my regular HTML file. So far so good.

Now I just want to run a PHP scrip from an HTML file to insert a text
file, but how do I execute the PHP without the form + post?

(The text file is a club member list and I want the web page to always
display the updated list)

View Replies !
How To Execute
We installed a third party "ghostscripts" in server (linux). This is to make html to pdf. The question is how can the PHP execute the file

and the application installed in this path
usr/local/share/ghostscript

and my php script installed in this
www.mydomain.com/files/execute.php

View Replies !
Execute Php
i have a base page, which acts as a template, called index.php. when called with parameters (GET) the php code inside this page load an external HTML file and writes its contents into a specific location within the index.php page.

View Replies !
Execute Gpg From Php
The following code works for executing 'ls', but not gpg.

$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read
from
1 => array("pipe", "w"), // stdout is a pipe that the child will write
to
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to
write to
);

//LINE BELOW DOESN'T WORK
//$process = proc_open(gpg --output encmail.txt --recipient
someone@domain.com --always-trust --armor --yes --encrypt mail.txt",
$descriptorspec, $pipes);.

View Replies !
System Execute In Php
The same set of command in linux prompts and if call by php program, it does not work. I do not know why. The set of command is already chmod +x and ./what what ,it works.

View Replies !
Execute Php File
I'm working on a search engine. The idea is simple user types a keyword in the text box and then I my program searches for all files (.html, .htm, .txt, php) that have a match.

But I nedd to search the output of php file not the code.

View Replies !
Execute Ph Script
I need to execute a php script in my shell so :

touch test.php
chmod +x test.php
edited the file, inserted the following lines :

#! /usr/bin/php -q
$a = 0;
echo $a;

../test.php

Gives me the following output :

$a = 0;
echo $a;

View Replies !
PHP Slow To Execute
I have some PHP pages at.. which is exhibiting
some strange slowness. It is hosted by secureserver.net (bad?).

When I time how long it takes to load the main web page from the
server
it averages 7 seconds, but often goes to 15.

When I store the main page on my hard drive, the load time is 1
second.

I've tried removing PHP code that might slow things down
but that only brings the load time down to 5.5 seconds best case.

I have other PHP pages on the same server that seem to execute
faster. The key difference between the slow main page and the faster
pages is the faster pages do not use "include" to execute code in
other
PHP files.

However with out "include" and the modularity it affords, my PHP code
would be harder to maintain. What to do?

View Replies !
Execute PHP In A CSS File?
On Apache with PHP is there any way to execute PHP code inside of a CSS file? This is assuming AddType application/x-httpd-php does not list CSS as an extension. I would like to serve my stylesheets as CSS but also dynamically construct the CSS for various browsers (and ultimately hope to keep the number of served stylesheets to one).

View Replies !
Could Not Execute Query
I have a db that I am trying to poulate using an online form but every time I press the submit button it givesm me this error:

Could not execute query : INSERT INTO register (id, name, phone, email, interest, other, type, comments, update) VALUES ('', 'Tom', '0000000', 'abc@abc.com.au', 'Music Performer', 'other things', 'painting', 'none really', 'Y').You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update) VALUES ('', 'Tom', '0000000', 'abc@abc.com.au', 'Music

I am not sure what the problem is.  Can someone have a look and tell me what I need to fix to make this work. Code:

View Replies !
Execute String
I would like to load a string with PHP code and execute it. Is there a command that will let me do that? Maybe something like
php_exec(). I suppose I could always use some sort of shell_exec("php.exe...") trickery but would prefer something more graceful.

View Replies !
Execute Ssh Command Via Php?
I'm trying to make a web interface for my music server. Basically what it's going to do is list all the music files in a directory. Then when a song is clicked PHP executes a shell command, for example "sudo play /var/www/music/System Of A Down - BYOB.mp3" and my server plays the song. So far I've been trying system() and exec() but it do doesn’t seem to work.

View Replies !
How To Execute A Link In PHP ?
I have the following piece of code:

If TRUE {do this;} else {go to this page;}

In the else clause, is there a function in PHP that I can pass in an URL and make it automatically go to that particular page ? The only PHP function I know for this purpose is the "header" function but it does not always work.

View Replies !
Execute As Root
Is there a way to execute commands as root using sudo? If yes, how to use it, if no, how can I get around.

View Replies !
Execute Another Php File
Is their a way to execute another PHP file from a PHP file? for example, say I want to check if a User's Authority level is equal to 3, by using a If statement, and if the User's Authority level is equal to 3, execute another PHP file which executes a function within the file.

How can I do this? if it is at all possible? (your probably wondering why I want to know how to do this, lets just say PayPal isnt very flexible)

View Replies !
Execute A Command
I need to execute a command if either one of the variables is set.

if (!isset($k1) || !isset($k1n)) {...

What is wrong with this statement? It works if I put just one, but cann't seem to get through when I write the statement above. what am I doing wrong?

View Replies !
Execute It OnClick
I spent half the day figuring out the following query: PHP Code:

$sql = 'UPDATE contacts, campaign_log'
        . ' SET contacts.invalid_email=1'
        . ' WHERE contacts.id=campaign_log.target_id'
        . ' AND campaign_log.activity_type="invalid email"'

... but, (here comes the stupid newb part) I have NO IDEA how to execute it onClick from a link/button etc. in an html file. Does the query need to reside in a seperate.php file (I don't think I dare change the file extension of the html file in question)? What would that look like?

View Replies !
Cannot Execute Query
I have added a vat checker to a form script that worked fine befor. Can anyone see why I now get a Cannot execute query 104? Code:

View Replies !
Execute .exe File
how can we execute the exe files in local system(c using php..? I need to execute the other systems exe files using php.

View Replies !
Execute Crontab
How do I execute a crontab command using php (not CLI) as user Joe? I don't have any problem getting output from commands such as 'ls' using passthru and exec but I am stumped with crontab.

View Replies !
Set Up PHP To Execute Php Scripts
i wanna set up PHP to execute my php scripts, but only on my machine, I dont want people able to access stuff like that, I simply wanna be able to develop stuff that I can use everyday on my PC. I know you can instal it for this purpose.

View Replies !
Javascript Won't Execute
I have a php script that returns a display from a DB search. I have added a php/form/script to the display page that has a dropdown menu (static html)everythign works fine when a selection is made and the 'Submit' button is clicked.

the problem is I would like the embedded script to execute "onChange" whenever a selection is made but regardless of the syntax it will not execute the second query. (unless the button is clicked). the same script works fine when it's not embedded inside of another script.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved