[PHP] weird fopen problem
Hi Jon, Can you tell me how you solve this at last,I met the same problem in my php script.,I am really new to Linux and Apache.Where and how to set the permission to ensure that all common users can write this file? Regards Leon -原始邮件- 发件人: Jon Farmer [mailto:[EMAIL PROTECTED]] 发送时间: 10, January, 2002 17:08 收件人: PHP General Mailing List 主题: [PHP] weird fopen problem I am getting a the follwing error: Warning: fopen(/home/jon/pgpfiles/sgsdgsdg,w) - Permission denied in /home/ethiorg/public_html/test.php on line 2 Warning: Supplied argument is not a valid File-Handle resource in /home/ethiorg/public_html/test.php on line 3 Warning: Supplied argument is not a valid File-Handle resource in /home/ethiorg/public_html/test.php on line 4 from the following script: ? $file = fopen(/home/jon/pgpfiles/sgsdgsdg,w); fputs($file, this is a test\n); fclose($file); ? the directory /home/jon/pgpfiles has mode 777 and is owned by nobody and group is nobody. Apache runs under user nobody. Any ideas? -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] How to add a carriage return in the end when using implode?
Yes,I have just worked out ,thank you Jason. -原始邮件- 发件人: Jason Wong [mailto:[EMAIL PROTECTED]] 发送时间: 08 January, 2002 16:46 收件人: [EMAIL PROTECTED] 主题: Re: [PHP] How to add a carriage return in the end when using implode? On Tuesday 08 January 2002 14:18, Zhang, Leon (STHK/Zh) wrote: $subdata has been changed before then $data[$index]=implode(,, $subdata); --what should I change here ? rewrite the file like this : $data[$index]=$data[$index]; $fp=fopen($datafile,w+); $a=0; do{ fputs($fp,$data[$a]);--or here?. $a++; }while($acount($data)); fclose($fp); however if one line of the $datab has been implode with $subdata ,there will not be a 'return' in the final text file , this line just is joined with the next line ,what should I do here to add the $data as a single line? Not sure if I understand you correctly. If you just want to add a newline character then you can try this: $data[$index]=implode(,, $subdata) . \n; hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* BASIC is the Computer Science equivalent of `Scientific Creationism'. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] IP address from which country
Hi, In php ,we can easily get the ip address of a connected computer ,but I always see on the web that there are some pages can tell you where you are from,so there must be a complete table show the relation of the ip address and country or region ,where can I find this . Thanks . Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] IP address from which country
Thank you Andrew,but in China mainland ,I saw many websites can even tells the province information which the user come from and I think in USA the State information can also be gotten from the visitor's ip address.BTW,in PHP what we can get is just the ip address of the user how can we get the host name ?Anything missed here? Regards Leon -ÔʼÓʼþ- ·¢¼þÈË: Andrew Brampton [mailto:[EMAIL PROTECTED]] ·¢ËÍʱ¼ä: 09 January, 2002 9:46 ÊÕ¼þÈË: Zhang, Leon (STHK/Zh) ³ËÍ: [EMAIL PROTECTED] Ö÷Ìâ: Re: [PHP] IP address from which country No such table, the best you can do is look at their hostname and parse the last part ie .co.uk or .com... And then u can try and figure where they are from that Andrew - Original Message - From: Zhang, Leon (STHK/Zh) To: [EMAIL PROTECTED] Sent: Wednesday, January 09, 2002 1:03 AM Subject: [PHP] IP address from which country Hi, In php ,we can easily get the ip address of a connected computer ,but I always see on the web that there are some pages can tell you where you are from,so there must be a complete table show the relation of the ip address and country or region ,where can I find this . Thanks . Leon -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] IP address from which country
Thank you Jason ,I will check the Digital Envoy to get more information ,have you got the website address of it? -ÔʼÓʼþ- ·¢¼þÈË: Jason Murray [mailto:[EMAIL PROTECTED]] ·¢ËÍʱ¼ä: 09 January, 2002 10:06 ÊÕ¼þÈË: 'Zhang, Leon (STHK/Zh)'; [EMAIL PROTECTED] ³ËÍ: [EMAIL PROTECTED] Ö÷Ìâ: RE: [PHP] IP address from which country Thank you Andrew,but in China mainland ,I saw many websites can even tells the province information which the user come from and I think in USA the State information can also be gotten from the visitor's ip address.BTW,in PHP what we can get is just the ip address of the user how can we get the host name ?Anything missed here? A database may exist for IPs in China (I don't know), but outside of China it's impossible to tell with much accuracy which country an IP is in. You could look at Digital Envoy, which was an attempt a couple of years ago to 'map the internet' and obtain exactly the data you're referring to. The problem is that as soon as that data is published it's out of date due to routing changes and network configuration changes. You can do a reverse lookup on the IP address to get the hostname, but you can rely on that even less - for example, a hostname ending in aol.com could be in the USA, Europe, Asia, or Australia these days. Jason -- Jason Murray [EMAIL PROTECTED] Web Developer, Melbourne IT Work now, freak later! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] php4 startup error
hi, I have installed php-4.0.0-Win32(into c:\php) and apache_1_3_9_win32(into C:\Program Files\Apache Group\Apache\ ) on my window98,the apache alone can be run normally,however when I run a test.php,windows told me the general protection error on PHP4TS.DLL and let me see the error log ,this is what I found in it: [Tue Jan 08 09:45:55 2002] [error] [client 127.0.0.1] Premature end of script headers: c:/php/php.exe following are some configurtation in php.ini: include_path= ; UNIX: "/path1:/path2" Windows: "\path1;\path2"doc_root= C:\Program Files\Apache Group\Apache\htdocs; the root of the php pages, used only if nonemptyuser_dir=; the directory under which php opens the script using /~username, used only if nonempty;upload_tmp_dir= ; temporary directory for HTTP uploaded files (will use system default if not specified)upload_max_filesize = 2097152 ; 2 Meg default limit on file uploadsextension_dir=c:\php; directory in which the loadable extensions (modules) reside following are some configurtation in httpd.conf: ScriptAlias /php "c:\php\php.exe" Action application/x-httpd-php "/php" AddType application/x-httpd-php .php .php3 Can anyone give me a hand on this ? Thank you in advance. Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to add a carriage return in the end when using implode?
$subdata has been changed before then $data[$index]=implode(",", $subdata);--what shouldI change here? rewrite the file like this : $data[$index]=$data[$index];$fp=fopen($datafile,"w+"); $a=0; do{ fputs($fp,$data[$a]);--or here?. $a++; }while($acount($data));fclose($fp); however if one line of the $datab has been implode with $subdata ,there will not be a 'return' in the final text file , this line just is joined with the next line ,what should I do here to add the $data as a single line? Thanks Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to read/write form/into certain place in a text file
hi, A text file has been formatted ,how to read/write form/into certain place in a text file. For example,read form letter 5 to 10 in line 4 ,and after some procedure ,write into the same place. Another question is that if a user has opened the file to read and write ,what will happen if another one will open and write the same file? Thank you in advance. Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] How to read/write form/into certain place in a text file
Does anybody know this? Please give me some advice,any help will be appreciated. -ÔʼÓʼþ-·¢¼þÈË: Zhang, Leon (STHK/Zh) [mailto:[EMAIL PROTECTED]]·¢ËÍʱ¼ä: 07 January, 2002 9:56ÊÕ¼þÈË: [EMAIL PROTECTED]Ö÷Ìâ: [PHP] How to read/write form/into certain place in a text file hi, A text file has been formatted ,how to read/write form/into certain place in a text file. For example,read form letter 5 to 10 in line 4 ,and after some procedure ,write into the same place. Another question is that if a user has opened the file to read and write ,what will happen if another one will open and write the same file? Thank you in advance. Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
re: [PHP] How to read/write form/into certain place in a text file
Thank you ,Jimmy . -ÔʼÓʼþ- ·¢¼þÈË: Jimmy [mailto:[EMAIL PROTECTED]] ·¢ËÍʱ¼ä: 07 January, 2002 12:13 ÊÕ¼þÈË: [EMAIL PROTECTED] Ö÷Ìâ: Re: [PHP] How to read/write form/into certain place in a text file Hi Leon, For example,read form letter 5 to 10 in line 4 ,and after some procedure ,write into the same place. if the file is not too big, you can use file() function which will return an array containing the content of the file per line. combine this with substr() to read from specific column. to write use substr_replace(). if the file is big, then doing file() is not advised, you should read the file as stream. read the following functions: fopen(), fclose(), fseek(), fread(), fwrite(). Another question is that if a user has opened the file to read and write , what will happen if another one will open and write the same file? php doesnt handle file locking automatically, so i think it would depend on the OS. if you want to handle file locking, read about flock(). -- Jimmy God is greater than your greatest problem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]