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.





Exec() And Open A Bat File


I'm trying to make a script that would run on localhost and open a bat file at certain point. I've already read a lot about exec(), system(), shell_exec(). But none of them works. Usualy browser tries to open something for 5 minutes but then stops.




View Complete Forum Thread with Replies

Related Forum Messages:
File Download Problem - Change A Binary File Into A Text And Open It In A Browser
I have uploaded files to mysql (doc and xls) using the tutorial. The problem comes when I try to download. Again I followed instructions in the tutorial. When I click on the link to download the file, it formats it as text and sends it to the browser instead of seeing it as binary and offering me a download box. PHP Code:

<?
if(isset($_GET['id']))
{
    include 'includes/configdb.php'
    include 'includes/opendb.php'

    $id      = $_GET['id'];
    $query   = "SELECT name, type, size, content FROM upload WHERE id = '$id'";
    $result  = mysql_query($query) or die('Error, query failed');
    list($name, $type, $size, $content) = mysql_fetch_array($result);

    header("Content-Disposition: attachment; filename=$name");
    header("Content-length: $size"); ....

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 !
Open File, Put First 5 Lines Into A Variable, Close File...
1) I want to open a file on my server.
2) I want to read only the first 5 lines.
3) Put the first five lines into a variable.
4) Close the file.
5) Display the contents of the variable.

I know how to use the fopen() but I have big problems just trying to read the first 5 lines only? I tried many things. I downloaded some search scripts which displayed the <meta> tag only from html pages...

What is this guy doing?

Well I have a big site and content is added and changed everyday. I have a dynamic page that reads a directory for files and then puts a link (well it includes the file for reading on my php page). That works great! MY PROBLEM is that I want not only a link but a small description below it (basically the first five lines on the file)...

See so far:
Quote: if (isset ($content)) {
include ("files/$content.html");
echo "<p><A HREF="read.php"><b>Back to index</b></A>";
} else {
echo "<b>Opening directory, reading files, and listing them as a link</b><p>";
$handle = opendir('./files');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo eregi_replace (".html", "", "<A HREF="read.php?content=$file">$file</a><p>");
}
}
closedir($handle);
}

View Replies !
Open .php File With PHP Designer 2007 By Clicking The File In XP
In windows XP, I want to be able to click on a .php file and have it
opened in PHP Designer 2007,
Or right-click on it and have an "edit" menu option presented to me.
I know how to tweak the registry to do this in general, but what would
the command line look like in this specific case ?
PHP Designer does not do this automatically. It is as if the program
does not allow commandline options.
It only opens with the last file used or a menu of recently opened
files.

View Replies !
PHP File Handling Open A Simple Text File
I am trying to open a simple text file using php, read the content in , close the file and display the content to a page. I can't seem to get this code to work. When i run the page i get no errors but and the "this doesn't work" string at the bottom prints out ok. I have tried putting the 'PHPdata.txt' section in as a url ie 'http://localhost/phpdata.txt' but this doesn't seem to work either.

I am using windows xp and apache. I am trying to firstly get this code to work with the aim of opening and pulling back the html content from a remote page to mess around with on my server. Code:

View Replies !
Unable To Fork Exec()'d File In IIS 5.1
I am repeatedly trying to execute a file on my server using exec() or passthru() and I keep getting an Unable to Fork error. Has anybody else had a problem with this in IIS?? The path to the perl script is correct and the script works fine in the C: prompt.

View Replies !
Php Exec To C Program That Writes File
I'm trying to use the exec() call in php to run a program that I've
written and compiled from C. This program attempts to create a new
file and write data into it.

If I simply run the program from the shell, it writes the file no
problem. If i run the program through an exec call in a php script,
however, the program executes but it seems to not have the correct
permissions to be able to write the file.


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 !
Exec, Passthru Disabled So How To Call C++ .exe File?
I am at my wit's end trying to get information out of Streamline.net's
support dept about my problem. They reply quickly enough, but seem to try
and give out the least possible amount of info each time. The transcript so
far is reproduced for your amusement below.

To summarise:

I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in
a php script to solve a puzzle and output the solution. It works fine with
Apache/php on my own machine, but it seems Streamline.net disable exec,
passthru etc. They eventually say, cryptically: ' CGI executables are
supported, however this is very different from executing a program from
within a PHP script'. So how would I call my Sudoko.exe file?

The 'dialog':

My last question seems to have been 'fixed' before being answered, so I'll
have another go.
I'm trying to call an .exe file on the server but get an 'unable to fork'
error message. I have Apache/php installed locally and it works fine. Do you
have to turn on 'cmd.exe' permissions or something? Try it yourself at:

Warning: passthru(): Unable to fork [Sudoku.exe (argument...)] in (.php
file...)
It's the same with exec() as well.

We do not support passthru or exec functions.

So how would I call my Sudoku.exe program from a php script?

I do not want 'scripting help', I just want to use some of the functions
that you offer as a host and which I have paid for.
As I have said what I am trying to do works perfectly on my machine, so it
must be a question of something you have to enable your end. What do you
mean you don't support passthru or exec? They are both standard php
commands.
.

You asked "how would I call my Sudoku.exe program from a php script?"
clearly this is asking us how you can use scripting?

Certain functions are disabled in PHP for security reasons.

Which functions are 'disabled in PHP for security reasons' ?

You can find this out with the inbuilt php function phpinfo()

Could you tell me where on the page that phpinfo() produces these functions
are listed? For example, passthru() does not appear to be on the page.
.

search for "disable_functions" on that page.

disable_functions lists 'no value'. So again, could you tell me where I can
find the list of standard php functions which you have disabled?
Please can you provide a link to your phpinfo file so we can investigate
this further.
We had previously checked this on a linux server, which showed the functions
that have been disabled. We've passed this on to an engineer to investigate
further.

For your information the following are disabled:

shell_exec,exec,system,passthru,popen

Your knowledge base says:
Q. Are CGI (Common Gateway Interface) executables supported?

A. Yes these are supported on either the Windows and Linux servers

But you are telling me that the only php functions which can call my
executable are disabled. Will you clarify once and for all if I can call my
exe file or not. I AM NOT ASKING FOR SCRIPTING HELP, I have books about
that. I just want to know if I can do ON YOUR SERVER what you say I can do,
and if not why not.

View Replies !
PHP Exec() And Zipping Upload File In Windows
I have the following code. What I need is to zip the file
(c:webuploadsomeFile) to d:websomeFile.zip.

$cmd = 'c:zipzip.exe '. $movedFile. ' '. $finalFile;
exec( $cmd, $cmd_output );

File is being uploaded by the apache server, but it's not being zipped.
My guess "", escaping, is causing problem in windows path. Do I also
have to escape the $movedFile content? Forexample $movedFile=
"c:webuploadsomeFile".

View Replies !
PHP Exec Calls A C Program That Creates A File
I'm using exec to call a compiled C program that creates/writes to a
file...However this doesn't seem to be working....
I tried setting all the permissions to 777 but still nothing...?

View Replies !
Reading A File - Open A File Just Copied
For some reason I can open a file, but I can't read it (I checked with is_readable() and is_writeable() and both returned true). I'm trying to open a file just copied, so maybe that's the reason why I can't read it, and I would have to reload the page. PHP Code:

View Replies !
File Upload Cannot Open The File It May Be Corrupted
I'm really stuck with the file upload. I submitted similar code a while ago in MSSQL section , but didnt get any reply at all so i've change the code but am still having problems. Some one please help.

I'm running PHP 4.4, IIS 5.1 and mssql

Ok, i'm uploading a PDF file to a directory, the upload works fine but when I download the file I get an eror "cannot open the file it may be corrupted". It really bugging me, I cannot figure out why its not working. the PDF files that I upload are fine but when I upload it I cant open them again. Code:

View Replies !
Exec And Shell_exec Not Executing Batch File Properly
I am running Apache and PHP on windows XP. Latest versions of them all. I am trying to execute a simple .bat batch file that simply copies 4 files from one location to the batch files location.

The php exec command runs like this:
V:Corehtdocswp ransfer.bat Y:folder

here the batch file is executed and the command following is thrown into the batch file to specify where the files that need to be copied are.

The Y: directory is in windows considered to be a network drive, although it is really just a folder on the same machine, i did this because there are spaces in the folder names on its way to where I need the information copied from i.e. "Program Files"

When I run this in the command prompt by entering this in manually it runs perfectly. However when running exec in the PHP script nothing happens; when I run shell_exec it gives me the output and it shows that every line in the batch file is executed however it does not actually copy anything.

Looking into my apache error log I see that this is related:

"The system cannot find the drive specified."

Now what I am wondering is, how is it that I can run this script manually but apache tells me I cannot. My permissions are set to allow all and deny nothing since it is a machine well tucked into a safe place.

Apache resides on the machine in C:

eactorcore and it also setup a virtual drive as v:core. Trying both does not work.

View Replies !
Running An .exe File Using Exec() Or System(), Unable To Fork Error
I have a problem with running an .exe file using exec() or system() I have downloaded a file called ffmpeg.exe for converting movie clips. I can use the program thourg the command line in windows (cmd), but I'm not able to have PHP run the file. First PHP gave be an "unable to fork" error. But then I gave users access to the cmd.exe file and solved that problem. So now is no problem running for example exec("dir");

View Replies !
File > Open
I need to open a file called news.txt, copy all of it's contents into a $string then write $string2 to news.txt then add $string to the file, example:

contents of news.txt:
Hello today
How are you
Top of the morning.

I want to add the line 'Goodbye' before Hello today in the news .txt file.

View Replies !
How To Open A File
I want to open a file which are situated on server see in c or d
and I know the file how can i use php to open particular file and copy
paste in my computer or user's computer.

View Replies !
How Can I Open A Pdf File?
I need to write a simple PHP code that has a text link. When a user clicks the text link, a pdf file should open inside the browser. One of the requirments is that a url should not change.

So, for example, you start with index.php. When you click the text link and open a pdf file, a url should remains the same, which is index.php. I have an idea of using a POST parameter, but I do not know exactly how I can achieve this.

View Replies !
Open A Php File
I want to open a php file and find myself redirected on
another.

a simple example of what I'd like to do.

file1.php_______________________

<?php

header(Location: http://127.0.0.1/file2.php);

?>

file2.php_________________

<?php

echo "you are in file 2";

?>

it doesn't work! maybe I am not using the proper function...

what can I do?

View Replies !
Cannot Open File
Not sure where area I have messed up the php codes? I have put the newvideonettable.htm in the Macintosh HD://Applications/MAMP/htdocs/lessons/, when I called it that shows me Can not open this file! Code:

View Replies !
To Open A Zip File!!!
How to open a zip file and read its contents?

View Replies !
Open A New File
I am trying to open a new file, but it give me the following massage, Warning: fopen(testFile.php) [function.fopen]: failed to open stream: Permission denied in index.php on line 3.

<?php
$ourFileName = "testFile.php";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);
?>

View Replies !
I Need To Open A File
I need to execute the local c drive files using php. I mean to say if we are having one exe file in local drive but i need to execute it using PHP which is running in IIS of other mechine..

View Replies !
Open A File That's Saved As A .php File
I don't get it, I just simply open a file that's saved as a .php file

http://vcob.org/blank.php

with the following code in it: Code:

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">

</BODY>
</HTML>

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 !
How To Open A File That Uses Unicode
Does anyone know how to handle files that use unicode as encoding.

If i want to open a file a get something like this ...

-original-
"This is an example"
-output-
" T h i s i s a n e x a m p l e "

So it puts extra spaces between every character ...

this is the syntax i use:

View Replies !
How To Open A File For Reading ?
i want to open a text file for reading. i tried this but nothing comes out ?

$fp = fopen("/u/htdocs/privat3/ttt/test.txt", "r");
fputs($fp, "GET ".$url." HTTP/1.0 r ");

View Replies !
IE Ask To Open The (php) Page As File
I just uploaded a new website onto a new server. On this server however, when you click on the only 2 php pages. IE will ask to open the page as file. Is there a simple way to fix this, or is it simply the new server that can't support php? The two pages are just a simple email form.

View Replies !
Open External File
Is it possible (how?) to open a file that is located on another server? I need to open the file so that I get the HTML code (so that I can parse information form it).

View Replies !
File Download NOT Open
I have a php page that reads files links from a Database.
This works well, but when we click on the link the file starts to open.

Is there anyway to force the file to SAVE not open ?


View Replies !
Can I Open The First 1kb Of A File Then Stop?
I need to validate over 100 sites with a simple script. Making sure that a file exsists is not enough-- I have to get the header information. The code below only works if I am validating a few pages (less than 15) Any more and it times out. PHP Code:

View Replies !
Open And Add New File To Zip Archive
I want to open an existing zip archive and add mor efiles to it on the fly
using php.
Can someone point to some resource to do that ?
I have looked at the Zend article about creating zip files on the fly but
that does not allow me to add files to an existing zip file.

View Replies !
Open A File With A Proxy
can you tell me if it is possible to open a file behind a proxy ?

View Replies !
Open File And Get Contents
I need to open a file and then echo the contents into a text area. I tried file_get_contents(), but it doesn't work, it isn't recognised as a function..

Any other way of doing this?

View Replies !
Open Excel File In PHP
How to open Excel worksheet in browser.

View Replies !
How To Open An Excel File Through PHP
I am writing a script to automate a reporting process. One of my steps (the last step i need to figure out) is openening an Excel document through the script. When i manually open it and i see it on the screen, it works fine - that is... it does the data connects and runs the macro's. Code:

View Replies !
Cant Open Url File Using Fopen()
i cant open url file using fopen() eventhough i set allow_url_open to on.

View Replies !
How To Open And Count A PDF File
I want to open different PDF Files while counting the opening process.

I would like send an email, once a specific PDF opens. (Simple.) I do have the problem though that I don't seem to get it opened:

The help-file might be opened with an URL like redirect.php?id=123456

<?php .........

View Replies !
I Open A .sql File In Access
i have seen many converters on the internet to convert mysql databases to work in access, but you have to connect to the server. i don't have a server to connect to anymore, and therefore no database to connect to. Is there a program that i can use to convert my .sql file which i have on my computer so that i can open it in access.

View Replies !
Open A File In The Cgi-bin Folder
I have Apache/MySQL/PHP on Windows XP. If I try to open a file in the cgi-bin folder, I will get a 404 error. If I try to open the same file not in the cgi-bin folder, I will not get a 404 error.

View Replies !
Open A Php File Without Header()
i need to show a page from 'parent.php' , the page may be 'sub1.php' or sub2.php',... etc depending on the condion. PHP Code:

switch ($condition);{
case 1 :
// open sub1.php
break;
case 2:
// open sub1.php
.......

i am not able to use header() since the page have some echo statements and stuffs at the start. also want to not to depend on Javascript which i am currently using document.open('sub1.php'); any other methods ?

View Replies !
File Can't Open In FIREFOX
i can open it with IE but not in firefox. Using macromedia I save the index.php to index2.htm and it open in firefox. I want to use the PHP (newbies) but how?

View Replies !
Open File For Writing
we have an online store which writes an html file to a folder and mails this html file to the buyer. it works 99% of the time, but sometimes it barfs on fopen() and returns an error. here is the function i am using:

function write_file($file, $data) {
$fp = fopen("$file", 'w');
if (!$fp) {
exit('Could not open desired file for writing');
return false;
}
fwrite($fp, $data);
fclose($fp);
return true;
}

the odd thing is, it works 99% of the time, so i know it is not a directory ermissions / safe_mode issue.

View Replies !
Open And Write To A New File
i want to create a new file and attach it to an email. so far, im stuck with opening a new file and writing to it. heres my script. I always get the "Cannot open file error. what am i doing wrong?

<?
$today = date("mdY");
$file_to_send =$today."order.xls";

$output = "something";

if(!$handle2 = fopen($file_to_send, 'w+')){
echo "Cannot open file<br>
";
}
if(fwrite($handle2, $output)==false){
echo "Cannot write to file<br>";
}

fclose($handle2);

?>

View Replies !
How Can I Download (open) .txt File?
how can i open (download) .txt file , i.e located in my local system by using php coding.when i click some link,it automatically open the .txt file(located on C:/folder/test.txt). please anybody help me.how can i do that.

View Replies !
Open A Text File And Put Into Array
I want to open the text file and put it into an array so i can search the contents of the text file.I've figured out how to search an array but cant seem to open a file into an array and then search it. I want to take blah.txt open it insert it into $some array
and then use the array_search function to search for the word the user puts into a form.If you can point me to a tutorial, that would be helpfull.This whole search thing is driving me nuts.Opening and writing to files is easy...now searching the files im writing to ??I'm lost.

View Replies !
How Do I Open A Dir And Print The Contents Of Each File?
i can do it in perl with this

$dirtoopen = "./database/";
opendir(DIR, "$filetoopen") or die "cannot open";
@files = readdir(DIR);
closedir(DIR);

foreach $file(@files){
$filetoopen = "./database/$file";
open(FILE, "$filetoopen") or die "cannot open";
$contents = <FILE>;
close(FILE);
($addonname, $description, $submitter) = split(//, $contents);
print "$addonname | $description";
}

but how would i with php?

View Replies !
Libmysqlclient.so.6: Cannot Open Shared Obj. File
i have installed mysql, apache and php4 on my system.
Mysql 3.22.32-1
Apache 1.3.12
PHP 4.0.1 pl2

MySQL instalation has been fine and working. The problem is with Apache and PHP4.
I installed Apache first and then PHP (without starting Apache). Only after i succesfully installed php, i tried giving the following command:
[root@localhost bin]# ./apachectl start

But it gave me the following error........
Syntax error on line 211 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server: libmysqlclient.so.6: cannot open shared object file: No such file or directory
./apachectl start: httpd could not be started.

View Replies !
Problem To Open A Distant XML File In PHP
I try to open a distant (not local) XML file in PHP to read an RSS feed.

I can open an HTML page and read it with the file() function.

But as soon as I try with a RSS feed instead of HTML and I try to read
or open with file() or fopen(), it doesn't work, I have the following
errors :

Warning: fopen() [function.fopen]: php_hostconnect: connect failed in
D:est.php on line 10

Warning: fopen(http://www.clubic.com/xml/news.xml) [function.fopen]:
failed to create stream: Bad file descriptor in D:est.php on line 10

In my phpinfo, the parameters are like this :
PHP Version 4.3.1
Registered PHP Streams php, http, ftp, compress.zlib
allow_url_fopen On On
XML Support active
XML Namespace Support active
EXPAT Version 1.95.2

My source file is :
<?php
$fichier_xml = "http://www.clubic.com/xml/news.xml";
$file = fopen($fichier_xml,"r");
?>

View Replies !
Open A File And Parse It To A Database.
I would like to have a php script open a text file, that is tab delimited, and put it into an array, then have the contents of the array put into fields of a mysql database. Here is what I have so far. It uses && as the delimiter, but seems to have some problems. I would rather use a tab as the delimiter, and still need to be able to have it loaded into a database. Code:

View Replies !
How I Can Open The Linked Doc File In The Same Window
i'm using php/mysql and want to open the attached doc file in the same
window. any one can help how can i code it?

View Replies !
How To Open A Text File Using A Php Script
i tried the exec() to open a txt file. but iam not sure how to use it.

<?php exec(" C:wampwwwwebhello.txt");?>

the notepad.exe seem to run in the task manager when i run the script. but the file doesnt open.

View Replies !

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