[PHP] [about mail] I can't see main message either attached file what I sent.

2004-03-17 Thread Xu
I'm using Mail.php which is located in /usr/local/lib/php
I made a mail program by php.
Which is attaching a file.

But I guess there's problem in MIME syntax.
I don't know what is wrong...

What's the problem?


** Below this line is php codes. **
include "Mail.php";

// defines header
$headers['Subject'] = $subject;
$headers['From'] = $sender." <".$senderemail.">";
$headers['Content-Type'] = "multipart/related";
$headers['Return-Path'] = "<".$senderemail.">";
$headers['Errors-To'] = "<".$senderemail.">";

// message
$message .= "--=MIME_BOUNDRY_message_parts\n";
$message .= "Content-Type: $usehtml; \n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n$ment\n";
$message .= "--=MIME_BOUNDRY_message_parts--\n\n";

// Attachments

if ( $_FILES['attach']['error'] === 0 ) {
//Upload and Attach
$tmpName = $_FILES['attach']['tmp_name'];
$fileName = $_FILES['attach']['name'];
$filePath = "./attach/";
$fileSize = $_FILES['attach']['size'];

$AttmFile = $filePath.$fileName;

move_uploaded_file( $tmpName, $AttmFile ) or die( "upload failed" );

// now we add attachments
$message .= "\n\n--=MIME_BOUNDRY_main_message\n";
$message .= "Content-Type: ".$_FILES['attach']['type'].";
name=\"".$fileName."\";\n";
$message .= "Content-Disposition: attachment;
filename=\"".$fileName."\";\n\n";
$message .= "Content-Transfer-Encoding: base64;\n";
$message .= "\n";

//file goes here
$fd=fopen ($AttmFile, "r");
$FileContent=fread($fd,filesize($AttmFile));
fclose ($fd);
$FileContent=chunk_split(base64_encode($FileContent));
$message.=$FileContent;
$message .= "\n--=MIME_BOUNDRY_main_message\n";
}


// SMTP Connection
$params['host'] = $smtphost;
$params['auth'] = true;
$params["username"] = $smtpuser;
$params["password"] = $smtppwd;
$mailer = &Mail::factory('smtp', $params);

$email = "[EMAIL PROTECTED]"; # use my email address for test.


// send and check status
$status =$mailer->send($email, $headers, $message);
if (PEAR::isError($status)) {
echo "fail";
$fail++;
} else {
echo "success";
$success++;
}



** Below this line is what I sent. **

Return-Path: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Subject:  
From:  <[EMAIL PROTECTED]>
Content-Type: multipart/related
Errors-To: <[EMAIL PROTECTED]>

--=MIME_BOUNDRY_message_parts
Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable

5G4B1d0!..
EW=:6Q

EW=:F.6s4O1q...
:83;Av6u8;@L>_!!
--=MIME_BOUNDRY_message_parts--



--=MIME_BOUNDRY_main_message
Content-Type: application/octet-stream; name="README";
Content-Disposition: attachment; filename="README"

Content-Transfer-Encoding: base64

xu3B/cC6IEdMSUJDIDEuMDkgQmV0YSC59sD8IL+1ua7Gx8C7ILHiwdjAuLfOIMfPv7S9wLTPtNku
DQrC98DMwaHAuiDBtrHdu9PAzLHiILanua6/oSCwxcDHILCwtNmw7SC6uL3DuOkgtcu0z7TZLg0K
wM+53SDDpcDaIMWpseLAziBCNbfOIMbtwf3AzCC1x77uIMDWvu68rQ0Kt7nAzMD6IMfBuLDFzbfO
IMPit8LH2LytILmtwLi46SCx17Trt84gw6XAzCC1y7TPtNkuDQq/wMDaILz2waTAuiC0q7+hILbn
tMKwzSC47rCzuLggx9Egu/PFwrbzIMDawdYgurjAzMH2uLgNCrHXt7iw1CDFqyC5rsGmtMIgvvjA
u7DNILCwsO0NCsfUvPYgv+S+4CC6zrrQKMDMsMcgv7W5rsbHwMcgx9i057rOutDAuyDAzrzix9i8
rSC1obrZwMy9w7HmKSwNCsL8sO3AxyDCyrz2IMH2waSw+iDH1Lz2LCC6r7z2IElOREVYILXuwMwg
vvi9wLTPtNkuDQqx17DNtem4uCC52bfOIMDitMK02bjpIL/Puq7H2MH2sNrB9ri4DQqx17eyIL3D
sKPAzCC++LDtILbHILPKuasgwfbDxLytILj4x8+w2rG6v+QuDQqx17PJILq4vLy/5C4uLi4uLS07
DQrD4rfCx8+9xyC2qSBnbGliY3RpdC5od3AsIGdsaWJjaWR4Lmh3cCwgZ2xpYmMuaHdwuKYNCrz4
vK2067fOIMPit8LHz73DuOkgtcu0z7TZLg0Kvue46SDAzrziuKYgx8+w7SC9zcC4vcO46SAowM+5
3cD7wM4gsOa/7CkNCsOzwL2/oyDAzrzivcO/obytIMKmvPbCysC7ILjVwPogwM684sfPvcOw7Q0K
tNnAvb+hIMimvPbCysC7IMDOvOLHz73DuOkgwve3yrTrt84gs6q/zSDA1sC7sMy0z7TZLg0Ksde3
syC1tb/yILXHvMyx5iC52bb4tM+02S4NCg0KICAgICAgICAgICAgICAgICAgICBSQUdOQVJvS0Bo
aXRlbC5rb2wuY28ua3INCiAgICAgICAgICAgICAgICAgICAgwfe+vr+hvK0guvO11bTrtMIgvu62
ssDMDQo=

--=MIME_BOUNDRY_main_message

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [about mail] I can't see main message either attached file what I sent

2004-03-17 Thread Xu
I'm using Mail.php which is located in /usr/local/lib/php
I made a mail program by php.
Which is attaching a file.

But I guess there's problem in MIME syntax.
I don't know what is wrong...

What's the problem?


** Below this line is php codes. **
include "Mail.php";

// defines header
$headers['Subject'] = $subject;
$headers['From'] = $sender." <".$senderemail.">";
$headers['Content-Type'] = "multipart/related";
$headers['Return-Path'] = "<".$senderemail.">";
$headers['Errors-To'] = "<".$senderemail.">";

// message
$message .= "--=MIME_BOUNDRY_message_parts\n";
$message .= "Content-Type: $usehtml; \n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n$ment\n";
$message .= "--=MIME_BOUNDRY_message_parts--\n\n";

// Attachments

if ( $_FILES['attach']['error'] === 0 ) {
//Upload and Attach
$tmpName = $_FILES['attach']['tmp_name'];
$fileName = $_FILES['attach']['name'];
$filePath = "./attach/";
$fileSize = $_FILES['attach']['size'];

$AttmFile = $filePath.$fileName;

move_uploaded_file( $tmpName, $AttmFile ) or die( "upload failed" );

// now we add attachments
$message .= "\n\n--=MIME_BOUNDRY_main_message\n";
$message .= "Content-Type: ".$_FILES['attach']['type'].";
name=\"".$fileName."\";\n";
$message .= "Content-Disposition: attachment;
filename=\"".$fileName."\";\n\n";
$message .= "Content-Transfer-Encoding: base64;\n";
$message .= "\n";

//file goes here
$fd=fopen ($AttmFile, "r");
$FileContent=fread($fd,filesize($AttmFile));
fclose ($fd);
$FileContent=chunk_split(base64_encode($FileContent));
$message.=$FileContent;
$message .= "\n--=MIME_BOUNDRY_main_message\n";
}


// SMTP Connection
$params['host'] = $smtphost;
$params['auth'] = true;
$params["username"] = $smtpuser;
$params["password"] = $smtppwd;
$mailer = &Mail::factory('smtp', $params);

$email = "[EMAIL PROTECTED]"; # use my email address for test.


// send and check status
$status =$mailer->send($email, $headers, $message);
if (PEAR::isError($status)) {
echo "fail";
$fail++;
} else {
echo "success";
$success++;
}



** Below this line is what I sent. **

Return-Path: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Subject:  
From:  <[EMAIL PROTECTED]>
Content-Type: multipart/related
Errors-To: <[EMAIL PROTECTED]>

--=MIME_BOUNDRY_message_parts
Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable

5G4B1d0!..
EW=:6Q

EW=:F.6s4O1q...
:83;Av6u8;@L>_!!
--=MIME_BOUNDRY_message_parts--



--=MIME_BOUNDRY_main_message
Content-Type: application/octet-stream; name="README";
Content-Disposition: attachment; filename="README"

Content-Transfer-Encoding: base64

xu3B/cC6IEdMSUJDIDEuMDkgQmV0YSC59sD8IL+1ua7Gx8C7ILHiwdjAuLfOIMfPv7S9wLTPtNku
DQrC98DMwaHAuiDBtrHdu9PAzLHiILanua6/oSCwxcDHILCwtNmw7SC6uL3DuOkgtcu0z7TZLg0K
wM+53SDDpcDaIMWpseLAziBCNbfOIMbtwf3AzCC1x77uIMDWvu68rQ0Kt7nAzMD6IMfBuLDFzbfO
IMPit8LH2LytILmtwLi46SCx17Trt84gw6XAzCC1y7TPtNkuDQq/wMDaILz2waTAuiC0q7+hILbn
tMKwzSC47rCzuLggx9Egu/PFwrbzIMDawdYgurjAzMH2uLgNCrHXt7iw1CDFqyC5rsGmtMIgvvjA
u7DNILCwsO0NCsfUvPYgv+S+4CC6zrrQKMDMsMcgv7W5rsbHwMcgx9i057rOutDAuyDAzrzix9i8
rSC1obrZwMy9w7HmKSwNCsL8sO3AxyDCyrz2IMH2waSw+iDH1Lz2LCC6r7z2IElOREVYILXuwMwg
vvi9wLTPtNkuDQqx17DNtem4uCC52bfOIMDitMK02bjpIL/Puq7H2MH2sNrB9ri4DQqx17eyIL3D
sKPAzCC++LDtILbHILPKuasgwfbDxLytILj4x8+w2rG6v+QuDQqx17PJILq4vLy/5C4uLi4uLS07
DQrD4rfCx8+9xyC2qSBnbGliY3RpdC5od3AsIGdsaWJjaWR4Lmh3cCwgZ2xpYmMuaHdwuKYNCrz4
vK2067fOIMPit8LHz73DuOkgtcu0z7TZLg0Kvue46SDAzrziuKYgx8+w7SC9zcC4vcO46SAowM+5
3cD7wM4gsOa/7CkNCsOzwL2/oyDAzrzivcO/obytIMKmvPbCysC7ILjVwPogwM684sfPvcOw7Q0K
tNnAvb+hIMimvPbCysC7IMDOvOLHz73DuOkgwve3yrTrt84gs6q/zSDA1sC7sMy0z7TZLg0Ksde3
syC1tb/yILXHvMyx5iC52bb4tM+02S4NCg0KICAgICAgICAgICAgICAgICAgICBSQUdOQVJvS0Bo
aXRlbC5rb2wuY28ua3INCiAgICAgICAgICAgICAgICAgICAgwfe+vr+hvK0guvO11bTrtMIgvu62
ssDMDQo=

--=MIME_BOUNDRY_main_message

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [about mail] I can't see main message either attached file what I

2004-03-18 Thread Xu
I solved this problem.
by edit headers and body about boundary.
here's modified source.

*** below this line is php source 
$boundary42 = md5(rand());
// Headers
$headers = "";
$headers .= "From: $sender <$senderemail>\n";
$headers .= "Subject: $subject\n";
$headers .= "Return-Path: <$senderemail>\n";
$headers .= "Errors-To: <$senderemail>\n";
$headers .= "Content-Type: multipart/related;";
$headers .= " type=\"multipart/alternative\";";
$headers .= " boundary=\"$boundary42\";\n";
// Message
$message .= "--$boundary42\n";
$message .= "Content-Type: $usehtml; charset:EUC-KR;\n";
$message .= "Content-Transfer-Encoding: quoted-printable;\n";
$message .= "\n";
// text goes here
$message .= $ment;
$message .= "\n";
// this ends the message
$message .= "\n";
if ( $_FILES['attach']['error'] === 0 ) {
//??? ??
$tmpName = $_FILES['attach']['tmp_name'];
$fileName = $_FILES['attach']['name'];
$filePath = "./attach/";
$fileSize = $_FILES['attach']['size'];
$AttmFile = $filePath.$fileName;

move_uploaded_file( $tmpName, $AttmFile ) or die( "??? ??" );

// now we add attachments (images, etc)
$message .= "\n\n--$boundary42\n";
$message .= "Content-Type: ".$_FILES['attach']['type']."; 
name=\"".$fileName."\";\n";
$message .= "Content-Disposition: inline; 
filename=\"".$fileName."\";\n";
$message .= "Content-Transfer-Encoding: base64;\n";
$message .= "\n";

//file goes here
$fd=fopen ($AttmFile, "r");
$FileContent=fread($fd,filesize($AttmFile));
fclose ($fd);
$FileContent=chunk_split(base64_encode($FileContent));
$message.=$FileContent;
$message .= "\n--$boundary42--\n";
}
while ($co < $Total) {

// SMTP ??
$params['host'] = $smtphost;
$params['auth'] = true;
$params["username"] = $smtpuser;
$params["password"] = $smtppwd;
$mailer = &Mail::factory('smtp', $params);
$mname = mysql_result($rst, $co, 0);
$email = mysql_result($rst, $co, 1);
//  $status =$mailer->send($email, $headers, $message);
$status = mail( $email, $Subject, $message, $headers );
if (PEAR::isError($status)) {
$fail++;
$failAddress[] = $email;
$failError[] = $status;
} else {
$success++;
}
$co++;
//  echo $email."";
}
Xu ? ?:
I'm using Mail.php which is located in /usr/local/lib/php
I made a mail program by php.
Which is attaching a file.
But I guess there's problem in MIME syntax.
I don't know what is wrong...
What's the problem?

** Below this line is php codes. **
include "Mail.php";
// defines header
$headers['Subject'] = $subject;
$headers['From'] = $sender." <".$senderemail.">";
$headers['Content-Type'] = "multipart/related";
$headers['Return-Path'] = "<".$senderemail.">";
$headers['Errors-To'] = "<".$senderemail.">";
// message
$message .= "--=MIME_BOUNDRY_message_parts\n";
$message .= "Content-Type: $usehtml; \n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n$ment\n";
$message .= "--=MIME_BOUNDRY_message_parts--\n\n";
// Attachments

if ( $_FILES['attach']['error'] === 0 ) {
//Upload and Attach
$tmpName = $_FILES['attach']['tmp_name'];
$fileName = $_FILES['attach']['name'];
$filePath = "./attach/";
$fileSize = $_FILES['attach']['size'];
$AttmFile = $filePath.$fileName;

move_uploaded_file( $tmpName, $AttmFile ) or die( "upload failed" );

// now we add attachments
$message .= "\n\n--=MIME_BOUNDRY_main_message\n";
$message .= "Content-Type: ".$_FILES['attach']['type'].";
name=\"".$fileName."\";\n";
$message .= "Content-Disposition: attachment;
filename=\"".$fileName."\";\n\n";
$message .= "Content-Transfer-Encoding: base64;\n";
$message .= "\n";
//file goes here
$fd=fopen ($AttmFile, "r");
   

[PHP] Why I can not make the PHP acitve?

2001-04-28 Thread Xiaoshu Xu

I have install my apache_1.3.17 with php-4.0.4 as the following the steps
but I can not make the php active. 

First I have download apache_1.3.17.tar.gz and php-4.0.4.tar.gz to the same directory.
1  gunzip apache_1.3.17.tar.gz
2  tar xvf apache_1.3.17.tar
3  gunzip php-4.0.4.tar.gz
4  tar xvf php-4.0.4.tar
5  cd apache_1.3.17
6  ./configure --prefix=/www
7  cd ../php-4.0.4
8  ./configure --with-mysql --with-apache=../apache_1.3.17 --enable-track-vars
9  make
10 make install
11  cd ../apache_1.3.17
12  ./configure --prefix=/www --active-module=src/modules/php4/libphp4.a
13 make
14  make install
15  cd ../php-4.0.4
16  cp php.ini-dist /usr/local/lib/php3.ini
17  then i have added 
AddType application/x-httpd-php .php
to my httpd.conf
18  start my apache

the apache works but the php still unactive

pls, do me favor to tell me why 
thanks a lot


---


Xiaoshu Xu
FocusTech Shanghai Office
Phone:(86 21)50541368 Fax:(86 21)50541369
www.focuschina.com
www.Made-in-China.com
[EMAIL PROTECTED]




[PHP] hi, how can i join a php document translate team?

2009-09-09 Thread Hanjie Xu
thank you


Re: [PHP] all local sites stopped working ...

2009-10-17 Thread Hanjie Xu
Is your Web Server started?

2009/10/17 

> Hi All,
>
> All my local PHP sites (http://127.0.0.1/... and http://localhost/...)
> worked until today.
> Now all these local sites don't work anymore.
> The only difference since yesterday is running 16 Windows Updates.
>
> I checked C:\WINDOWS\system32\LogFiles\W3SVC1\... but no errors.
> Can I set a php.ini setting to track down the problem ?
> Or where else to look to solve this problem ?
>
> Configuration: Windows XP SP3, PHP 5.2.0, IIS 5.1, MySQL 5.0.15 NT
>
> Any help highly appreciated !!!
>
> TIA, Cor




-- 
许汉杰


Re: [PHP] =??Q?Esco=AE?= Frontier Acela High Performance Fume Hoods

2009-11-03 Thread Hanjie Xu
What's this?

2009/11/4 Esco Biotech Pvt. Ltd. 

> Esco® Frontier Acela High Performance Fume Hoods
>
>
>
> *ESCO's Industry Leading Frontier Acela Fume Hood gives you **
> Maximum Flexibility, Energy Savings and Quality all at an Affordable Price!
> *
>
> · Low Velocity (0.3 m/s) yet High Performance.
>
> · Annual energy savings up to US $ 8,000 (Evan Mills, Dale Sartor.
> Energy use and savings potential for Laboratory Fume Hoods. Energy 30 (2005)
> 1859-1864) to help reduce your carbon footprint.
>
> · CAV or VAV Modes.
>
> · Full range of worktop materials including Stainless Steel,
> Ceramic or Epoxy Resin.
>
> · 4, 5, 6, or 8 ft sizes to suit your needs.
>
> · Wide range of accessories to tailor your fume cupboard to meet
> your requirements.
>
> · Ergonomically angled sash window to enhance usability.
>
> · The tapered fibreglass exhaust collar reduces airflow
> turbulence, static pressure loss, noise level and increases face velocity
> uniformity.
>
> · Tri-wall construction and chain-and-sprocket sash system for
> maximum durability.
>
> · Certified to EN14175.
>
>
>
> * *
>
> * *
>
>
>
> Literature <http://escoglobal.com/products/download/EFA_brochure.pdf>
>
> Safe Use of Fume Hoods 
> Video<http://escoglobal.com/resources/video/video.php?id=Fumehoods>
>
> Fume Hood Testing According to ANSI/ASHRAE 110 
> Standard<http://escoglobal.com/resources/video/video.php?id=fumehood>
>
>
>
> Esco performs testing in accordance with more than 20 of the world's most
> recognized standards, of local, regional and international scopes
>
> Learn About International 
> Standards<http://escoglobal.com/resources/biological-safety-cabinets/learn-about-international-standards.php>
>
>
>
> Esco Clean Room Construction 
> Components<http://escoglobal.com/products/cleanroom-equipment/>
>
>
>
> Esco PowderMax Powder Weighing Balance Enclosures White 
> Paper<http://escoglobal.com/products/download/PW1_microbalance.pdf>
>
>
>
> Biological Safety Cabinets
>
> Order Free 
> CD<http://escoglobal.com/resources/biological-safety-cabinets/order-cd.php>
>
>  *Please Visit us at Hall No. "H", Booth No. 18, 19 at Pharma Expo 2009
> concurrent with 61st Indian Pharmaceutical Congress (IPC), Nirma
> University of Science & Technology, Ahmedabad to be held from 11 - 13
> December, 2009.***
>
> *ESCO BIOTECH PVT. LTD.*
>
> 101 – 102, Sita Niwas, Plot No. 94, Road No.1, Liberty Garden, Malad (W),
> Mumbai – 400 064
>
> Tel : + 91 22 4073 0202 / 2880 3636 / 3293 3535 Fax : + 91 22 2880 3738 /
> 2889 3636
>
> E mail :* *escobiot...@vsnl.net
>
> Website : www.escoindia.co.in
>
> I Biological Safety 
> Cabinets<http://escoglobal.com/products/biological-safety-cabinets/>I Laminar
> Flow Cabinets <http://escoglobal.com/products/laminar-flow-cabinets/> I 
> Laboratory
> Fume Hoods <http://escoglobal.com/products/laboratory-fume-hoods/> I Ductless
> Fume Hoods <http://escoglobal.com/products/ductless-fume-hoods/> I Cleanroom
> Equipments <http://escoglobal.com/products/cleanroom-equipment/> I Air
> Showers<http://escoglobal.com/products/cleanroom-equipment/detail.php?id=EAS>I
>  Sampling
> & Dispensing Booth <http://escoglobal.com/products/containment-pharma/> I 
> Hospital
> Pharmacy 
> Products<http://escoglobal.com/products/hospital-pharmacy-products/>I 
> Cytoculture™
> Cytotoxic Safety 
> Cabinets<http://escoglobal.com/products/hospital-pharmacy-products/detail.php?id=CYT-A>I
>  Isoclean
> Hospital Pharmacy 
> Isolators<http://escoglobal.com/products/hospital-pharmacy-products/detail.php?id=HPI-N>I
>  IVF
> Workstations <http://escoglobal.com/products/ivf-workstations/> I Lab
> Animal Research 
> Products<http://escoglobal.com/products/lab-animal-research-products/>I 
> Laboratory
> Incubators <http://escoglobal.com/products/laboratory-incubators/> I 
> Laboratory
> Ovens <http://escoglobal.com/products/laboratory-ovens/> I PCR 
> Cabinets<http://escoglobal.com/products/pcr-cabinets/>I PCR
> Thermal 
> Cyclers<http://escoglobal.com/products/pcr-thermal-cyclers/detail.php?id=SWT-MX>I
>  Real
> Time Thermal 
> Cyclers<http://escoglobal.com/products/pcr-thermal-cyclers/detail.php?id=SPT-RT>I
>  Ultralow
> Freezers <http://escoglobal.com/products/ultralow-freezers/> I Esco on
> Twitter <http://twitter.com/escoglobal> I Esco on You 
> Tube<http://youtube.com/escoglobal>
> I Esco Bio Safety Cabinet Micro-Site <http://biologicalsafetycabinet.com/>
> I
>
>


-- 
Xu Han-Jie


[PHP] mb_encode_mimeheader function can't deal with long non-English strings?

2012-04-29 Thread Coiby Xu
Hi all,

I wonder why mb_encode_mimeheader function can't deal with long non-english
strings. Here are the codes:

> function util_encode_mimeheader($headername,$str,$charset) {
> if (function_exists('mb_internal_encoding') &&
> function_exists('mb_encode_mimeheader')) {
>  $x = mb_internal_encoding();
> mb_internal_encoding("UTF-8");
> $y = mb_encode_mimeheader($headername . ": " . $str,
> $charset, "Q");
>  mb_internal_encoding($x);
> return $y;
> }
> }


According to my tests, if the subject have too many characters, there will
be more than one "?UTF-8?Q??" generated which make the MIME header
invaild. If there are more than one "?UTF-8?Q??" , the remaing "?UTF-8?Q?"s
will appear in the body of email, i.e. the beginning of the email will be:

> " =?UTF-8?Q?=E6=9C=89=E9=97=AE=E9=A2=98?=
> Content-type: text/plain; charset=UTF-8 ".


Can anyone explain this?

Thanks!


[PHP] fopen failed to open pipe file in Linux+Apache environment

2006-12-07 Thread mike xu

Hi, I have problem of open named pipe file in linux.

Here is my sample code:

 $fifo_file = "/dev/pmsg";
 @ $fp = fopen($fifo_file, 'w+b');
 if(!$fp) {
   echo "open ".$fifo_file." failed";
 }
 else {
   $msg_cmd = "ttt";
   fwrite($fp, $msg_cmd, strlen($msg_cmd));
   fclose($fp);
 }

There is an other program which is waiting for messages from /dev/pmsg
forever. You could also test it by running `cat /dev/pmsg` in shell console.
Every one have permissions of read and write for /dev/pmsg
prw-rw-rw- 1 root root 0 12-08 10:13 /dev/pmsg

Environment info: php-5.1.2-5, httpd-2.2.0-5.1.2, OS: Redhat FC5

Thanks in advance,
Mike


Re: [PHP] fopen failed to open pipe file in Linux+Apache environment

2006-12-07 Thread mike xu

Thanks a lot forr your reply.

Here is the error msg:
*Warning*: fopen(/dev/pmsg)
[function.fopen<http://localhost/Source/test/function.fopen>]:
failed to open stream: Permission denied in *
/var/www/html/Source/test/register_user.php* on line *31

It still doesn't work even if I move pmsg to /tmp/ directory and change its
own to appache...
*
On 12/8/06, Ryan Creaser <[EMAIL PROTECTED]> wrote:



mike xu wrote:
> Hi, I have problem of open named pipe file in linux.
>
> Here is my sample code:
>
>  $fifo_file = "/dev/pmsg";
>  @ $fp = fopen($fifo_file, 'w+b');
>  if(!$fp) {
>echo "open ".$fifo_file." failed";
>  }
>  else {
>$msg_cmd = "ttt";
>fwrite($fp, $msg_cmd, strlen($msg_cmd));
>fclose($fp);
>  }
>
> There is an other program which is waiting for messages from /dev/pmsg
> forever. You could also test it by running `cat /dev/pmsg` in shell
> console.
> Every one have permissions of read and write for /dev/pmsg
> prw-rw-rw- 1 root root 0 12-08 10:13 /dev/pmsg
>
> Environment info: php-5.1.2-5, httpd-2.2.0-5.1.2, OS: Redhat FC5
>
> Thanks in advance,
> Mike

Are you getting any errors? What if you remove the @ from the start of
line 2, any errors now?

- rjc



Re: [PHP] fopen failed to open pipe file in Linux+Apache environment

2006-12-08 Thread mike xu

Hi Ryan,

I just did another test, if I start the httpd by root user manually (the
httpd daemon program still owns apache user by the result of `ps -aux`), the
php script works fine. So, it seems the httpd start script
(/etc/rc.d/init.d/httpd) did something specially which cause the permission
problem...
I'll continue checking it ...

Thanks,
Mike

On 12/8/06, Ryan Creaser <[EMAIL PROTECTED]> wrote:


mike xu wrote:
> Thanks a lot forr your reply.
>
> Here is the error msg:
> *Warning*: fopen(/dev/pmsg)
> [function.fopen<http://localhost/Source/test/function.fopen>]:
> failed to open stream: Permission denied in *
> /var/www/html/Source/test/register_user.php* on line *31
>
> It still doesn't work even if I move pmsg to /tmp/ directory and
> change its
> own to appache...
>

I don't really know Fedora or SELinux, but since your permissions seem
ok could it be the SELinux policy for httpd causing you grief?

- rjc



Re: [PHP] fopen failed to open pipe file in Linux+Apache environment

2006-12-08 Thread mike xu

Its so strange, when I runing /etc/rc.d/rc3.d/S85httpd restart, the php
script couldn't fopen pipe file.
But if I copy /etc/rc.d/rc3.d/S85httpd to some other place (for example
/root), and execute `/root/S85httpd restart`, the php script could fopen
file successfully!

Its so confusing ...

On 12/8/06, mike xu <[EMAIL PROTECTED]> wrote:


Hi Ryan,

I just did another test, if I start the httpd by root user manually (the
httpd daemon program still owns apache user by the result of `ps -aux`), the
php script works fine. So, it seems the httpd start script
(/etc/rc.d/init.d/httpd) did something specially which cause the permission
problem...
I'll continue checking it ...

Thanks,
Mike

On 12/8/06, Ryan Creaser <[EMAIL PROTECTED]> wrote:
>
> mike xu wrote:
> > Thanks a lot forr your reply.
> >
> > Here is the error msg:
> > *Warning*: fopen(/dev/pmsg)
> > [function.fopen<http://localhost/Source/test/function.fopen >]:
> > failed to open stream: Permission denied in *
> > /var/www/html/Source/test/register_user.php* on line *31
> >
> > It still doesn't work even if I move pmsg to /tmp/ directory and
> > change its
> > own to appache...
> >
>
> I don't really know Fedora or SELinux, but since your permissions seem
> ok could it be the SELinux policy for httpd causing you grief?
>
> - rjc
>