Hello,
I wrote the below code : - fwrite(STDOUT, "Enter the email address: ");
and got the following error : - Warning: fwrite(): supplied argument is not a valid stream resource in C:\apache
-
2triad\php\bin\cPass.php on line 7
How to solve this problem ?
6 1333
The 1st parameter of the fwrite() command ususally refers to a file system pointer resource that has been opened before with an fopen().
Is there any reason why you want this to write to STDOUT??
Ronald
The 1st parameter of the fwrite() command ususally refers to a file system pointer resource that has been opened before with an fopen().
Is there any reason why you want this to write to STDOUT??
Ronald
I want to run the php file from the command prompt.
So I want to take the input from the user.
What to do ?
Oh I see.
Are you sure that your Command Line Interface is available? Type
on the command line and it should indicate the presence in a form which looks something like - C:\wamp\bin\php\php5.2.5>php -v
-
PHP 5.2.5 (cli) (built: Nov 8 2007 23:18:51)
-
Copyright (c) 1997-2007 The PHP Group
-
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Do you have the CLI?
Ronald
Oh I see.
Are you sure that your Command Line Interface is available? Type
on the command line and it should indicate the presence in a form which looks something like - C:\wamp\bin\php\php5.2.5>php -v
-
PHP 5.2.5 (cli) (built: Nov 8 2007 23:18:51)
-
Copyright (c) 1997-2007 The PHP Group
-
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Do you have the CLI?
Ronald
Yes its available. - PHP 4.4.2 (cgi-fcgi) (built: Jan 13 2006 13:53:43)
-
Copyright (c) 1997-2006 The PHP Group
-
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
-
with Zend Optimizer v2.6.2, Copyright (c) 1998-2006, by Zend Technologies
What is a CLI ?
CLI is the Command Line Interface. There are some differences between the CLI and the CGI (the one you have installed). Depending on the version of PHP you are running, calling the PHP via the command line is different. An example from the documentation:
Starting with PHP 5, the CLI is distributed in the main folder, named php.exe. The CGI version is distributed as php-cgi.exe. The Windows packages between PHP 4.2.0 and PHP 4.2.3 distributed the CLI as php-cli.exe, living in the same folder as the CGI php.exe. Starting with PHP 4.3.0 the Windows package distributes the CLI as php.exe in a separate folder named cli, so cli/php.exe ....
For a detailed explanation you'd better have a look at the PHP manual's chapter Using PHP from the command line whete it is all explained.
Ronald
CLI is the Command Line Interface. There are some differences between the CLI and the CGI (the one you have installed). Depending on the version of PHP you are running, calling the PHP via the command line is different. An example from the documentation:
For a detailed explanation you'd better have a look at the PHP manual's chapter Using PHP from the command line whete it is all explained.
Ronald
CLI works here since I can execute php scripts from command line.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Antoine Bloncourt |
last post by:
Hello everybody
Sorry to bother you but I have a problem writing datas into a file ...
I want to make a backup of my MySQL database and put the result into a
..sql file.
To do this, I use...
|
by: Andrew Kibler |
last post by:
Two sections of code, in the first one fwrite works, in the second one
it doesn't (ms VC++) both are identical except in the working one fseek
is used twice to set the file pointer, once just...
|
by: Brady |
last post by:
Hi,
I'm having a problem reading and writing to a file. What I'm trying
to do is read a file, modify the portion of the file that I just read,
and then write the modified data back to the same...
|
by: FrancisC |
last post by:
how to use fwrite( ) instead of fprintf( ) in this case? I want to generate
binary file.
FILE *fnew;
int i, intName;
double array;
fprintf(fnew, "%d\n", intName);...
|
by: SW1 |
last post by:
I wrote a small program which does something like tftp - transfering
files and some chat, anyway i got a problem with fwrite, here is a
snippet of my code:
while(length > 0) {
putchar('.');...
| |
by: Suraj Kurapati |
last post by:
Hello,
I'm having a rather strange bug with this code: for certain values of 'buf',
a segmentation fault occurs when 'free(buf)' is followed by an 'fwrite()'.
In the program output, there is no...
|
by: Richard Hsu |
last post by:
// code
#include "stdio.h"
int status(FILE * f) {
printf("ftell:%d, feof:%s\n", ftell(f), feof(f) != 0 ? "true" :
"false");
}
int case1() {
FILE * f = fopen("c:\\blah", "wb+");
int i = 5;
|
by: David Mathog |
last post by:
In the beginning (Kernighan & Ritchie 1978) there was fprintf, and unix
write, but no fwrite. That is, no portable C method for writing binary
data, only system calls which were OS specific. At...
|
by: alexus |
last post by:
fwrite(fopen('temp.xml','w+'),
print_r(simplexml_load_string(curl_exec($test))),true);
i for some reason get "1" inside of my temp.xml
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |