RE: [PHP] Speed Issues PHP vs ASP.net
-Original Message- Recently i read this blog post about speed issues comparing PHP with ASP.net, please, read that and comment what you think about it: http://misfitgeek.com/blog/aspnet/php-versus-asp-net-ndash-windows-versu s-linux-ndash-who-rsquo-s-the-fastest/ The big deal is: I don't know if this bechmark is true or false but, what are doing the PHP team about speed issues? Results like that maybe results like this can tarnish the image of language. So, what do you think about it? -- My main issue with the tests is this: ASP.NET (C#) is psuedo-byte-code compiled and cached prior to execution. This is a huge boost to performance. The tests should be re-done with something like IonCube compiled PHP. I think ASP.NET would still win, though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] More on "JS alert that links to file"
You really can't send multiple files in a single response, and you certainly can't send multiple headers after data has gone through. Zipping would be a nice approach. Another would be to use AJAX calls to sequenctially download the files. HTH, - Kyle -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Mon 7/27/2009 8:30 AM To: tony mount Cc: php-general@lists.php.net Subject: Re: [PHP] More on "JS alert that links to file" I assume you want to force the files to the user as a series of files to download? Have you considered just offering a page of links to each file? You can actually have the links go to a PHP script which can stream the file as a forced download, and the user can then download the files one-by-one by clicking the link as if it were a normal link. Alternatively, you could zip the files up into one archive using PHP and offer stream that file down to the user. Thanks, Ash http://www.ashleysheridan.co.uk On Mon, 2009-07-27 at 21:54 +0930, tony mount wrote: > I have a question that follows on from this discussion. I have a loop > which creates a number of files. It first write each file to a server > location then sets up the headers and asks the "Save As" question. This > works OK once, but after the first download it exits without any errors > or messages. If I remove the header() lines (ie just create the files on > the server) no worries, it creates them all. (I start op buffer at the > top of the code and flush the buffer on each loop). Anyone have any > ideas please? > Thanks > Tony > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?
One of two things is happening: - PHP is crashing, maybe a memory leak, etc. Or - That while(true) loop is exiting, and the script is completing. Would be interesting to know which, try adding this after the loop: $fp = fopen('/tmp/test','w'); fputs($fp, 'My script left the loop and exited cleanly. True == false.'); fclose($fp); Back on my first point, have you kept an eye on the memory usage over the 3 hours? If your version of PHP has a memory leak with while() or sleep() (would be odd), a bazillion iterrations could break the PHP defined memory limit (8M by default) and cause it to exit abruptly. Are you capturing the output anywhere? For example, in Linux is it being run from cron or another script? Try redirecting STDOUT and STDERR somewhere useful, i.e.: php my_php_script > /tmp/scriptoutput 2>&1 (2>&1 means "output stream 2 [stderr] to the same place as stream 1") Hope any of these crazy ideas are helpful... - Kyle -- Kyle Smith Unix Systems Administrator -Original Message- From: Robert Cummings [mailto:rob...@interjinn.com] Sent: Thursday, June 11, 2009 8:25 AM To: Ford, Mike Cc: php-general@lists.php.net Subject: Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI? Ford, Mike wrote: > On 11 June 2009 12:00, Ashley Sheridan advised: > >> On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote: >>> Hi! >>> I'm stuck. >>> I don't understand why the php CLI dies after 3 hours in my script. > Any >>> idea to solve? Thanks >>> >>> >>> PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr 7 > 2009 >>> 20:06:36) Linux ubuntu 2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 > UTC >>> 2008 x86_64 GNU/Linux >>> >>> Conf [php.ini] >>> max_execution_time=0 >>> >>> >> while (true) { >>> sleep(5); >>> } >>> >>> >> The while loop will continue executing until its condition is false. > As >> you've got a boolean true as the condition, it will never end. > > I think he realises that. His question is why "never" equates to 3 > hours in his environment. Shouldn't be max execution time issue if he's running the CLI. Maybe account limits? Maybe the above snippet isn't what's really happening... I mean what purpose would the above script serve for 3 hours? Looks like it's been dumbed down for us dummies on the list. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Not a regular file?
Likewise, do some debug output. echo "I'm going to upload $FilePath to $remote_path."; Make sure it looks sane, maybe your variables aren't what you think they are... You can also use is_file() on http:// locations, AFAIK. -Original Message- From: Miller, Terion [mailto:tmil...@springfi.gannett.com] Sent: Thursday, June 04, 2009 10:32 AM To: haliphax; PHP-General List Subject: Re: [PHP] Not a regular file? Here is my code for the ftp_put $conn_id = ftp_connect($ftp_server);$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);$FilePath = "http://localhost:/HarrisAutomate/output/WebImagesHiRes/$ImageName";; $remote_path = "/httpdocs/Announcements/photos/obitsTest/"; set_time_limit(120);ftp_pasv($conn_id, true);// upload a fileif (ftp_put($conn_id, $remote_path, $FilePath, FTP_BINARY)) {echo "successfully uploaded $ImageName\n";} else { echo "There was a problem while uploading $ImageName\n";} // close the connection ftp_close($conn_id); Since it is passing a full path I don't know how it can be only going to the directory? On 6/4/09 9:22 AM, "haliphax" wrote: On Thu, Jun 4, 2009 at 9:07 AM, Miller, Terion wrote: > I've never encountered this error: > > Warning: ftp_put() [function.ftp-put]: > /httpdocs/Announcements/photos/obitsTest/: Not a regular file in > /Applications/MAMP/htdocs/HarrisAutomate/ObitsTester.php on line 149 > There was a problem while uploading 659428.jpg 658626 > > Can't find much info on how to correct it, anyone seen this? http://www.lmgtfy.com/?q=php+%22not+a+regular+file%22 Apparently, it's not actually a file in the first place. Just a guess--but most all incidents of ftp_put throwing this error that I've found in web searches point to someone using it on a directory/etc. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Not a regular file?
Wrap some debug code in the loop: echo "I want to upload $file. Is it a file?" . is_file($file) . ""; See what that says. -Original Message- From: haliphax [mailto:halip...@gmail.com] Sent: Thursday, June 04, 2009 10:23 AM To: php-general@lists.php.net Subject: Re: [PHP] Not a regular file? On Thu, Jun 4, 2009 at 9:07 AM, Miller, Terion wrote: > I've never encountered this error: > > Warning: ftp_put() [function.ftp-put]: > /httpdocs/Announcements/photos/obitsTest/: Not a regular file in > /Applications/MAMP/htdocs/HarrisAutomate/ObitsTester.php on line 149 > There was a problem while uploading 659428.jpg 658626 > > Can't find much info on how to correct it, anyone seen this? http://www.lmgtfy.com/?q=php+%22not+a+regular+file%22 Apparently, it's not actually a file in the first place. Just a guess--but most all incidents of ftp_put throwing this error that I've found in web searches point to someone using it on a directory/etc. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Numerical Recipe - Scheduling Question
I'm confused as to why cron doesn't work for you. It doesn't explicitly tell you when the next X occurences will be, but math does. If you schedule something to run every 5 minutes starting at 1:45 PM, it's simple work to be able to report that the next times would be 1:50 PM, 1:55 PM, 2:00 PM etc. Is this running in a web browser, somehow? If not, PHP is not the solution. HTH, Kyle -Original Message- From: bruce [mailto:bedoug...@earthlink.net] Sent: Friday, May 29, 2009 1:11 PM To: php-general@lists.php.net Subject: [PHP] Numerical Recipe - Scheduling Question Hi.. Got a need to be able to allow a user to specify the frequency to run certain apps/processes.. I need to be able to have the user specify a start Time, as well as a periodic frequency (once, hourly, daily, weekly...) as well as allow the user to specify every XX minutes... So i basically need to be able to determine when the future events/occurances are, based on the user input. I've searched the net for alogorithms dealing with scheduling and haven't come up with any php based solutions.. I've also looked at numerical recipes and some other sources (freshmeat/sourceforge/etc..) with no luck.. I have found an approach in another language that I could port to php.. But before I code/recreate this, I figured I'd see if anyone here has pointers or suggestions... Cron doesn't work for me, as it can run a process at a given time.. but it doesn't tell me when the next 'X' occurance would be... Thoughts/Comments.. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IE can't download, FF can: SSL ? Need special headers?
SSL occurs a layer above HTTP, so HTTP/1.1 is correct. HTTPS is not a different data protocol, but a different transport protocol. HTH, Kyle -Original Message- From: Dee Ayy [mailto:dee@gmail.com] Sent: Friday, May 22, 2009 11:05 AM To: php-general@lists.php.net Subject: [PHP] IE can't download, FF can: SSL ? Need special headers? The following code has been working for about 6 years. The only change I am aware of is that now it is being served from a server requiring SSL to access it. header("Content-type: $type"); header("Content-length: $size"); header("Content-Disposition: attachment; filename=\"$name\""); echo $data; It still works in FF, so I assume the variables are being filled in. For example: header("Content-type: application/pdf"); header("Content-length: 75485"); header("Content-Disposition: attachment; filename=\"test.pdf\""); In DebugBar HTTP(S) after the GET request which had to be authorized by htaccess it reports: HTTP/1.1 200 OK Date: Fri, 22 May 2009 14:38:18 GMT Server: Apache/2.0.50 (Fedora) X-Powered-By: PHP/5.1.6 Set-Cookie: PHPSESSID=743ba4d8e056873c4da52b123df4b1ad; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-length: 7359 Content-Disposition: attachment; filename="test.pdf" Connection: close Content-Type: application/pdf Should "HTTP/1.1 200 OK" be "HTTPS/1.1 200 OK"? If so, how can I get that set? Is there some funky header I need? Oh, the IE 7 error is: Internet Explorer cannot download my_php_file.php?a_name=a_value from my.site.com. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. FYI: If the user cannot choose a filename to save as, it gets saved as "my_php_file.php" which needs to be renamed to extension ".pdf" to be viewed in a PDF viewer. So if you have any helpful headers to force the filename, I'd appreciate that too. Apparently Content-Disposition: attachment; filename="test.pdf" doesn't work (on FF and maybe other browsers). There is an issue with Internet Explorer 6 http://support.microsoft.com/?kbid=816037 that seems to relate, but this is for IE 7, and I can't verify if it is also failing on IE 6. But I found this (which didn't work for me) http://www.vistaheads.com/forums/microsoft-public-internetexplorer-gener al/313324-downloading-ftp-files-ie7.html Regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sending SMS through website
Most carriers have email-to-sms bridges. For example, I use AT&T Wireless and you can text me by sending an email to myphonenum...@txt.att.net. HTH, Kyle -Original Message- From: dheeraj bansal [mailto:bansalcooldhee...@gmail.com] Sent: Wednesday, May 13, 2009 10:24 AM To: php-general@lists.php.net Subject: [PHP] Sending SMS through website Hi All, Does anyone know how to send sms through a php website. I am completely new to the requirement and don't know even the pre-requisite of doing it. You can also drop in link to a good tutorial. Any help will be highly appreciated. Thanks and Regards, Dheeraj Bansal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Warning: Division by zero
It's always better to validate your inputs in any was possible, this helps prevent exploits. -Original Message- From: Gary [mailto:gwp...@ptd.net] Sent: Thursday, April 30, 2009 8:51 AM To: php-general@lists.php.net Subject: [PHP] Warning: Division by zero I have a script that is a result of data entered in a form On the script (when I test without data entry), I am getting a warning that Warning: Division by zero in .inc.php on line 15. The warning is correct, however the viewer cannot access the second script without entering the data that would cancel the warning. Is this something I should worry about? or would it be better to right in an isset? I'm sorry if this does not seem clear. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unable to send mail from PHP to AT&T e-mail address
> Phpster wrote: >> >> >> On Apr 21, 2009, at 20:32, Edward Diener wrote: >> >>> I have a PHP script which uses the PHP 'mail' function. When the >>> script's 'to' address is an AT&T address, such as my own as an AT&T >>> ISP customer, the mail never gets to me. If the 'to' address is >>> anything other than an AT&T address, the mail gets to the recipient. >>> The PHP code for sending the mail is essentially: >>> >>>$headers = 'MIME-Version: 1.0' . "\r\n"; >>>$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; >>>$headers .= 'From: Some From Name '; >>>$to = 'mybellsouthaddress.net'; >>>$subject = 'Some Subject'; >>>$msg = 'Some Message'; >>>if(mail($to,$subject,$msg."\r\n\r\n",$headers)) >>>echo "good"; >>>else >>>echo "bad"; >>> >>> In the actual PHP script the $to, $subject, and $msg are >>> successfully passed to the script from the client side as $_POST, >>> $_POST and $_FILES parameters respectively. I have just filled them >>> in above so that they can be seen as if they were part of the >>> script. The script always returns "good", so the mail function must be successful. >>> >>> In my project, testing has reported that any attempt to use the >>> 'mail' function on the server to send to an AT&T address fails to >>> reach the recipient, while all other addresses used in the testing >>> succeed in reaching the recipient. I can assert this to be the case >>> with my own AT&T address also. I have also checked my AT&T mailbox >>> online to make sure the mail is not being received as Spam. >>> >>> Does anybody have an idea why using the 'mail' function succeeds >>> with all but AT&T $to addresses ? Naturally in the client-server >>> application on which I am working, sending mail from the server must >>> work for all $to addresses. >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) To unsubscribe, >>> visit: http://www.php.net/unsub.php >>> >> >> It might be that the server IP has been blacklisted with at&t as a >> domain from which spam is sent. > > I have found out that the server adds a from header of > 'nob...@myserver.com' where 'myserver' is the name of the server. This > header gets placed first before the From header I supply in my PHP > script ( which should have had the form in the example above of > 'somefromn...@myserver.com, my bad ). > > Perhaps the AT&T mail server, when it sees the 'nob...@myserver.com' > treats it as spam and does not deliver the mail to even the > recipient's spam mailbox. > > I am not sure if it is normal for outgoing SMTP mail servers to > automatically add the 'nob...@myserver.com' from address first in the > header, or even why it does so ? Does anybody know if this is normal > for mail servers to do this ? Evidently other incoming mail servers do > not react to the 'nob...@myserver.com' in any way, so maybe AT&T is > unique in this. > > Any light anyone can throw on the 'nob...@myserver.com' address would > be most welcome. >It is using the apache user @ your host name as the default. Try this: >ini_set('sendmail_from', 'whate...@wherever.com'); You can also add headers to display custom formatted From: with a nice display name, like this: $to = "j...@user.com"; $subject = "Automated Notification"; $body = "Joe, you're using too much disk space!"; $headers = "From: Automated Disk Notifications \n\rReply-to: no-re...@website.com\n\r"; mail($to, $subject, $body, $headers); EDIT: Oops, didn't read OP. Sorry! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unable to send mail from PHP to AT&T e-mail address
Edward Diener wrote: > Phpster wrote: >> >> >> On Apr 21, 2009, at 20:32, Edward Diener wrote: >> >>> I have a PHP script which uses the PHP 'mail' function. When the >>> script's 'to' address is an AT&T address, such as my own as an AT&T >>> ISP customer, the mail never gets to me. If the 'to' address is >>> anything other than an AT&T address, the mail gets to the recipient. >>> The PHP code for sending the mail is essentially: >>> >>>$headers = 'MIME-Version: 1.0' . "\r\n"; >>>$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; >>>$headers .= 'From: Some From Name '; >>>$to = 'mybellsouthaddress.net'; >>>$subject = 'Some Subject'; >>>$msg = 'Some Message'; >>>if(mail($to,$subject,$msg."\r\n\r\n",$headers)) >>>echo "good"; >>>else >>>echo "bad"; >>> >>> In the actual PHP script the $to, $subject, and $msg are >>> successfully passed to the script from the client side as $_POST, >>> $_POST and $_FILES parameters respectively. I have just filled them >>> in above so that they can be seen as if they were part of the >>> script. The script always returns "good", so the mail function must be successful. >>> >>> In my project, testing has reported that any attempt to use the >>> 'mail' function on the server to send to an AT&T address fails to >>> reach the recipient, while all other addresses used in the testing >>> succeed in reaching the recipient. I can assert this to be the case >>> with my own AT&T address also. I have also checked my AT&T mailbox >>> online to make sure the mail is not being received as Spam. >>> >>> Does anybody have an idea why using the 'mail' function succeeds >>> with all but AT&T $to addresses ? Naturally in the client-server >>> application on which I am working, sending mail from the server must >>> work for all $to addresses. >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) To unsubscribe, >>> visit: http://www.php.net/unsub.php >>> >> >> It might be that the server IP has been blacklisted with at&t as a >> domain from which spam is sent. > > I have found out that the server adds a from header of > 'nob...@myserver.com' where 'myserver' is the name of the server. This > header gets placed first before the From header I supply in my PHP > script ( which should have had the form in the example above of > 'somefromn...@myserver.com, my bad ). > > Perhaps the AT&T mail server, when it sees the 'nob...@myserver.com' > treats it as spam and does not deliver the mail to even the > recipient's spam mailbox. > > I am not sure if it is normal for outgoing SMTP mail servers to > automatically add the 'nob...@myserver.com' from address first in the > header, or even why it does so ? Does anybody know if this is normal > for mail servers to do this ? Evidently other incoming mail servers do > not react to the 'nob...@myserver.com' in any way, so maybe AT&T is > unique in this. > > Any light anyone can throw on the 'nob...@myserver.com' address would > be most welcome. >It is using the apache user @ your host name as the default. Try this: >ini_set('sendmail_from', 'whate...@wherever.com'); You can also add headers to display custom formatted From: with a nice display name, like this: $to = "j...@user.com"; $subject = "Automated Notification"; $body = "Joe, you're using too much disk space!"; $headers = "From: Automated Disk Notifications \n\rReply-to: no-re...@website.com\n\r"; mail($to, $subject, $body, $headers); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex not working with ":"
Have you tried escaping the : with a \? Like: mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents ,'UTF-8'); Also, have you tried removing the : and adjusting the input string to verify your belief that it's the :? HTH, Kyle -Original Message- From: Merlin Morgenstern [mailto:merli...@fastmail.fm] Sent: Wednesday, April 22, 2009 4:09 AM To: php-general@lists.php.net Subject: [PHP] Regex not working with ":" Hi there, I am trying to remove a text which does contain a : inside. Somehow the regex does not match, no matter what I do: $contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '', $contents ,'UTF-8'); Looks like this is a result of the :. Does anybody have an idea how to do this? Thank you for any help. Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need Your Help :) I'm Just About Creating File Uploading Service
How is 700MB too big for HTTP? Ever download a linux distro? Ever benchmark FTP vs HTTP, the overhead is minimal... -- Kyle Smith Unix Systems Administrator -Original Message- From: Nitsan Bin-Nun [mailto:nit...@binnun.co.il] Sent: Thursday, April 16, 2009 3:37 PM To: PHP General List Subject: Re: [PHP] Need Your Help :) I'm Just About Creating File Uploading Service My bad, I'm sending a copy to the list. On Thu, Apr 16, 2009 at 9:37 PM, Nitsan Bin-Nun wrote: > Actually I don't much care for that, IMO 700MB~ is way too big for > HTTP, I thought of giving away FTP links for download, but I have > thought of the > following: > * First, there is a solution which will do this session validation/etc > through .htaccess and will only rewrite it to the file instead of > sending it in chunks? because that if the server will have to send it > in chunks it will be a no-reason overkill for the CPU (calculating and > reading these files. overkill). > * Secondly, I thought of sending these 700MB~ through HTTP and giving > away FTP links for the people who bought this functionality, I don't > really care whether it works or not, as long as the website reputation is still up. > > I also have just signed a contract with downloads website which has > 80k unique visitors/DAY! > So I really have to think of scalability from the beginning of it, Do > you have any ideas/notes/anything that I should take care of or keep > in calculations when thinking of 80k crowd driving full speed on > towards my server every DAY?? > > Thanks in Advance, > Nitsan > > > On Thu, Apr 16, 2009 at 9:27 PM, Michael A. Peters wrote: > >> Nitsan Bin-Nun wrote: >> >>> Hi List, >>> >>> I have been thinking for a while about setting up my own >>> rapidshare.comclone, Few days back I went really serious with this >>> and came up with some ideas. >>> >>> This is where I need your help, my partner and I have been thinking >>> about the system that the website should run on. >>> We came to conclusion that we are going to write it in PHP. >>> >>> There are several issues that came up during the mind-storm: >>> First, how we can keep the files out of being published as direct links? >>> >>> My first idea was to host them one directory up from the http directory. >>> It seems good but how I would deliver the files to the users? >>> >> >> php wrapper. >> It validates (session id or whatever) that the client has permission >> to access the file, and then sends the real file. >> >> $archive = /path/to/some/tarball; >> $tarname = "something.tar"; >> >> header("Pragma: public"); >> header("Expires: 0"); >> header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); >> header("Cache-Control: private",false); >> >> header('Content-type: application/x-tar'); >> header("Content-Disposition: attachment; filename=" . $tarname); >> header("Content-Transfer-Encoding: binary"); if ($fp = fopen( >> $archive , 'rb' )) { >> $sendOutput = ""; >> while ($l = fgets($fp)) { >> $sendOutput .= $l; >> } >>$outputLen = strlen($sendOutput); >>header("Content-Length: $outputLen"); >>print $sendOutput; >>} else { >>// for whatever reason we failed >>die(); >>} >> >> >> We are talking about unlimited file-size hosting so that means that >> we >>> will have to stream the files somehow... and they will be BIG (it's >>> defendant, about 700MB~ each) >>> >> >> Then I suggest setting up a torrent instead of direct download. >> You can have protected torrents. I don't know how to set them up but I use >> them - there's a torrent site that requires I log in from the same IP as I'm >> running the torrent client from, for example. >> >> If you want to provide service for those who can not use a torrent client, >> use an ftp server to serve the files - so that ftp clients capable of >> continuing an interrupted download can be used. >> >> 700MB is really too big fot http. Sure, it works, but it is better to use >> a protocol designed for large binary files. >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Strange result, 1 shows up
You're echoing the return value of include(), which is "true", or 1. -- Kyle Smith Unix Systems Administrator -Original Message- From: Gary [mailto:gwp...@ptd.net] Sent: Thursday, April 16, 2009 2:14 PM To: php-general@lists.php.net Subject: [PHP] Re: Strange result, 1 shows up Perfect, thanks so much. Do you know why the number 1 displayed? Thanks again. ""João Cândido de Souza Neto"" wrote in message news:9c.9a.24434.fc477...@pb1.pair.com... > Try using only: include('box.inc.php'); instead of echo > include('box.inc.php'); > > > ""Gary"" escreveu na mensagem > news:63.c9.24434.0b377...@pb1.pair.com... >> When I insert this code into a page, I get a 1 show up. Can anyone >> explain that and tell me how to get rid of it? >> >> Thanks for your help. >> >> Gary >> >> > //Chooses a random number >> $num = Rand (1,6); >> //Based on the random number, gives a quote switch ($num) { case 1: >> echo include('box.inc.php'); >> break; >> case 2: >> echo ""; >> break; >> case 3: >> echo ""; >> break; >> case 4: >> echo ""; >> break; >> case 5: >> echo ""; >> break; >> case 6: >> echo ""; >> } >> ?> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What is wrong with this code
Wow can't believe I missed that. I also was wondering why Ray mailed an empty message... :) -Original Message- From: doctortomor...@gmail.com [mailto:doctortomor...@gmail.com] On Behalf Of 9el Sent: Friday, April 03, 2009 4:05 PM To: Gary Cc: php-general@lists.php.net Subject: Re: [PHP] What is wrong with this code --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sat, Apr 4, 2009 at 1:56 AM, Gary wrote: > Peter > > I had the > > if ( isset( $_POST['submit'] ) ) { > > in there and it did not work. > > > < input name="submit" type="button" value="submit" /> shouldn't this be submit? Ray notified you of this try it out :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What is wrong with this code
This is unrelated, the email sends fine. And it's one per submission. -Original Message- From: doctortomor...@gmail.com [mailto:doctortomor...@gmail.com] On Behalf Of 9el Sent: Friday, April 03, 2009 3:37 PM To: Gary Cc: php-general@lists.php.net Subject: Re: [PHP] What is wrong with this code *Note:* It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient. For the sending of large amounts of email, see the > PEAR::Mail, and > PEAR::Mail_Queue packages. * Note:* The following RFCs may be useful: > RFC 1896, > RFC 2045, > RFC 2046, > RFC 2047, > RFC 2048, > RFC 2049, and > RFC 2822. Copy from PHP Manual. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What is wrong with this code
Well you're specifically missing anything that's in $_POST, which is why I suggested getting yourself the exact contents of $_POST displayed to the page. -Original Message- From: Gary [mailto:gwp...@ptd.net] Sent: Friday, April 03, 2009 3:23 PM To: php-general@lists.php.net Subject: Re: [PHP] What is wrong with this code I recieve an email, it will contain the ip address, it will also contain the name:, email: , comments: but not the information from the form of the name or email or comments. The database also recieves only the ip address. So I assume those parts are working, but I cant seem to find why the others are not. Thanks for your reply. Gary ""kyle.smith"" wrote in message news:d3fe56d174abf6469079ca1a5c8474a804fa9...@nsmail01.inforonics.corp.. . Try something like print_r on $_POST to see if it contains *anything*, seems like it's empty?! Also, when you say blank emails I assume you mean they have the template you made but the variables are empty and not zero-length emails. -Original Message- From: Gary [mailto:gwp...@ptd.net] Sent: Friday, April 03, 2009 3:14 PM To: php-general@lists.php.net Subject: Re: [PHP] What is wrong with this code Its there... "Igor Escobar" wrote in message news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com... > You forgot to mention the "method" of the form. > > ... > > Regards, > Igor Escoar > Systems Analyst & Interface Designer > > -- > > Personal Blog > ~ blog.igorescobar.com > Online Portifolio > ~ www.igorescobar.com > Twitter > ~ @igorescobar > > > > > > On Fri, Apr 3, 2009 at 4:08 PM, Gary wrote: > >> This is driving me nuts. I am getting blank emails and the only >> information that is being passed to MySQL is the IP address. >> >> Can someone tell me what is wrong with this? >> >> >> >> If you can see this, it's an anti-spam measure. Please don't >> fill in the address field. >> Address >> >> >> Name: >> >> Email Address: > type="text" /> Comments: > name="comments" cols="50" rows=""> > type="button" value="submit" /> >> >> > >> // Receiving variables >> >> >> $ip= $_SERVER['REMOTE_ADDR']; >> $name = $_POST['name']; >> $email = $_POST['email']; >> $comments = $_POST['comments']; >> >> //spam filter, do not touch >> if ($_POST['address'] != '' ){ >> >> >> die("Changed field"); >> >>} >> >> //endo fo spam filter >> >> $header = "From: $email\n" >> . "Reply-To: $email\n"; >> $subject = "Response from Assessment Lawyer"; $email_to = >> "sanitized"; $message = "name: $name\n" >> . "email: $email\n" >> . "comments: $comments\n" >> ."Visitors IP: $ip\n"; >> mail($email_to, $subject, $message, $header); >> >> >> >> >> $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I >> have removed the actual information, but it was connecting! >> or die('Could not connect to db'); >> >> $query = "INSERT INTO sanitized VALUES(0,'$name', >> '$email','$comments','$ip')"; >> >> $result = mysqli_query($dbc, $query) >> or die('Error querying database.'); >> >> >> >>mysqli_close($dbc); >> >> echo 'Thank you $name for submitting your inquiry!'; echo 'You >> have supplied the following information:'; echo 'Name: $name >> '; echo 'Email Address: $email '; echo 'Comments: >> $comments'; >> >> ?> >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: >> http://www.php.net/unsub.php >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What is wrong with this code
Try something like print_r on $_POST to see if it contains *anything*, seems like it's empty?! Also, when you say blank emails I assume you mean they have the template you made but the variables are empty and not zero-length emails. -Original Message- From: Gary [mailto:gwp...@ptd.net] Sent: Friday, April 03, 2009 3:14 PM To: php-general@lists.php.net Subject: Re: [PHP] What is wrong with this code Its there... "Igor Escobar" wrote in message news:1f5251d50904031212o6fcc3e43q5c60b7ae373e9...@mail.gmail.com... > You forgot to mention the "method" of the form. > > ... > > Regards, > Igor Escoar > Systems Analyst & Interface Designer > > -- > > Personal Blog > ~ blog.igorescobar.com > Online Portifolio > ~ www.igorescobar.com > Twitter > ~ @igorescobar > > > > > > On Fri, Apr 3, 2009 at 4:08 PM, Gary wrote: > >> This is driving me nuts. I am getting blank emails and the only >> information that is being passed to MySQL is the IP address. >> >> Can someone tell me what is wrong with this? >> >> >> >> If you can see this, it's an anti-spam measure. Please don't >> fill in the address field. >> Address >> >> >> Name: >> >> Email Address: > type="text" /> Comments: > name="comments" cols="50" rows=""> > type="button" value="submit" /> >> >> > >> // Receiving variables >> >> >> $ip= $_SERVER['REMOTE_ADDR']; >> $name = $_POST['name']; >> $email = $_POST['email']; >> $comments = $_POST['comments']; >> >> //spam filter, do not touch >> if ($_POST['address'] != '' ){ >> >> >> die("Changed field"); >> >>} >> >> //endo fo spam filter >> >> $header = "From: $email\n" >> . "Reply-To: $email\n"; >> $subject = "Response from Assessment Lawyer"; $email_to = >> "sanitized"; $message = "name: $name\n" >> . "email: $email\n" >> . "comments: $comments\n" >> ."Visitors IP: $ip\n"; >> mail($email_to, $subject, $message, $header); >> >> >> >> >> $dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I >> have removed the actual information, but it was connecting! >> or die('Could not connect to db'); >> >> $query = "INSERT INTO sanitized VALUES(0,'$name', >> '$email','$comments','$ip')"; >> >> $result = mysqli_query($dbc, $query) >> or die('Error querying database.'); >> >> >> >>mysqli_close($dbc); >> >> echo 'Thank you $name for submitting your inquiry!'; echo 'You >> have supplied the following information:'; echo 'Name: $name >> '; echo 'Email Address: $email '; echo 'Comments: >> $comments'; >> >> ?> >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: >> http://www.php.net/unsub.php >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] formulate nested select
What about using "IN", something like: SELECT * FROM book WHERE id IN (SELECT bookID FROM book_authors WHERE authID IN (SELECT author.id FROM authors WHERE last_name LIKE "$Auth%")); You could use LEFT instead of LIKE, too. -Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Tuesday, March 31, 2009 2:06 PM To: Jim Lucas Cc: Chris; php-general@lists.php.net Subject: Re: [PHP] formulate nested select Gentlemen & all others, The problem was partly fixed with ' ' around $Auth... but... somehow, I see that the results do not work with the rest of the script. The results give a an array within an array - so this mucks up all the rest which is set up to deal with only the book table. The count() is off as it shows the results_per_page setting and the pagination is off - it shows 10 books but only displays 5 entries (from 5 arrays which, I suppose is the reason for the coun() showing 10. The first page shows 5, but the second indicates 7 books but displays only 6... Now, I suppose that there are 2 ways to fix things: 1. Redo the rest of the script (a royal pain, I suspect) or 2. SELECT only the books that are attributed to the targeted authors - which is what I wanted to do in the first place. Something like: $SQL = "SELECT * FROM book b WHERE b.id = (SELECT book_author.bookID WHERE book_author.authID = (SELECT author.id WHERE LEFT(author.last_name, 1 ) = '$Auth')"; I want to avoid joins as that seems to screw up the rest of the code which is in an include page that needs to be repeated as long as there are letters in the alphabet. I'll try to figure something out, but as somebody not too optimistic once said: "it sure don't look too good" (American, I believe...) :-) > Jim Lucas wrote: >> Chris wrote: >>> PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example "SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID && b.id = c.bookID >>> Not really a php question :P >>> >>> You don't need a subquery for this. You can join all of the tables >>> together and just use the where clause to cut down your results, but >>> I'll give an example of both. >>> >>> select * >>> from >>> books b inner join book_authors c on (b.id=c.bookId) inner join >>> authors a on (a.id=c.authorId) where left(a.last_name = 'A'); >> correct me if I'm wrong, but did you use the left() function >> in-correctly? >> >> The documentation shows a different way to use it then you describe. >> >> Something more like the following: >> >> WHERE >> LEFT(a.last_name, 1) = 'A'; >> >> But that would be case-sensitive... >> >> So, something like this would work better IMHO >> >> WHERE >> UPPER(LEFT(a.last_name, 1)) = 'A'; >> >> or >> >> WHERE >> a.last_name ILIKE 'A%'; >> >> would do the trick >>> or >>> >>> select * >>> from >>> books b inner join book_authors c on (b.id=c.bookId) where >>> c.authorId in ( select id from authors where left(last_name='A') >> Again... >> >> SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') >> >> but yet again, case-sensitive... >> >> SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or >> SELECT id FROM authors WHERE last_name ILIKE 'A%' >> >> would do the trick >> >>> ); >>> >> >> > Thank you for the suggestions, gentlemen. > As to the case sensitivity, since the authors' names must be written > with the first letter in uppercase, even "Anonymous" or "Unknown" I > assume I don't need to specify uppercase. Or does it really make a > difference? Glad to learn of the option, though. > > I'm just starting on the listing of the books by author and just > realized that the sorting should be by author (last name). Can I > foresee a problem in that since the last_name is in associative tables > and not in the book table? Or does the JOIN incorporate the last_name > in the results? -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Rusu Ionut, PHP Question
Have you bolded sections of the email or are there really asterisk characters in those strings? Assuming it's bolding being converted to text, why shouldn't this work? It's definitely not the best approach, for example if you instanciate the "index" class twice, you'll re-include the code *again*. A better approach is require_once(), or placing all the includes at the top of your scripts. Hope this helps, Kyle -Original Message- From: Ionut Rusu [mailto:johnr...@gmail.com] Sent: Thursday, March 26, 2009 10:35 AM To: php-general@lists.php.net Subject: [PHP] Rusu Ionut, PHP Question Hello my name is Rusu Ionut, i'm from Romania and i was wondering if you have the time to to explain to mea little situation that i encountered. So i have a class: *index *and inside this class i have declared a public array containing some classes, inside the constructor of the class i extract the array variables and call the include function to "include" the array variable which is the reference of an php class file. My Question to you is : how is this possible The php doesnt outputs any errors, and i was wondering if this style of codying is making the server to work slower here is my code. class index { public $fisiere=array ( "*main_classes/db/functii.class.php*", "*main_classes/db/mysql.class.php*", "*main_classes/sp/setari_pagina.class.php*", "*main_classes/admin/admin.class.php*", "*main_classes/captcha/captcha.class.php*" ); /*-*/ public function __construct() { $eroare=""; foreach($this->fisiere as $key=>$value) { if(!file_exists(url_dinamice.$value)) { *echo "**error!";* } else { * include url_dinamice.$value;* } } } } $indexObj=new index(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multiple PHP's and php.ini's - Linux 5.2.9/5.2.6
After further suffering, I've discovered this was due to the source tree being used to build two PHPs. I'm not sure the exact cause, but I removed the entire php-5.2.9/ tree and re-extracted the tarball. My new PHP correctly points at /usr/local/. Maybe this will help someone else in the same position. - Kyle -Original Message----- From: kyle.smith [mailto:kyle.sm...@inforonics.com] Sent: Wednesday, March 25, 2009 10:56 AM To: php-general@lists.php.net Subject: [PHP] Multiple PHP's and php.ini's - Linux 5.2.9/5.2.6 I've been wrestling with this issue for a few days, I'm hoping someone can help. The issue we had is that we have a system httpd running a custom php-5.2.9 which is compiled in /opt/php/. The php.ini for this installation linked to and ioncube accelerator Zend module. The same apache also hosted some development work, and the developers want to use Zend Debugger, which cannot be used at the same time as ioncube. Ioncube is needed for a key application. So I build a new httpd, and a I built a new php-5.2.9 in /usr/local/gforge/php-5.2.9, pointing at the new Apache. After this was all done I noticed (in phpinfo) that it said something like "configuration file path = /usr/local/gforge/php-5.2.9/lib/, configuration file loaded = /opt/php/lib/php.ini". I shrugged it off, added a PHPIni apache directive and called it a night. Come to find out that this application (GForge) uses some php-based scripts linked in with their CVS. I don't know that gritty details. Anyway, it uses the system php, which of course links to php.ini in /opt/php/lib.php. I figured it would be a simple task to symlink the system php to this new build of php and it would reference the correct php.ini. Here's where the confusion sets in. [r...@dev2 php-5.2.9]# /usr/local/gforge/php-5.2.9/bin/php -i|grep php.ini Configuration File (php.ini) Path => /usr/local/gforge/php-5.2.9/lib/ Loaded Configuration File => /opt/php/lib/php.ini The path explicitly says "/usr/local/...", yet it loads the "/opt/php/lib/php.ini" file. However, if I set: [r...@dev2 php-5.2.9]# /usr/local/gforge/php-5.2.9/bin/php -c /usr/local/gforge/php-5.2.9/lib/ -i|grep php.ini Configuration File (php.ini) Path => /usr/local/gforge/php-5.2.9/lib/ Loaded Configuration File => /usr/local/gforge/php-5.2.9/lib/php.ini Bingo! Great news. Sort of... I don't want to have to modify every CVS script to add a -c option to the php request. Why should I have to? That should be the first place it looks, right? I recompiled php with --with-config-file-path=/usr/local/gforge/php-5.2.9/lib/. Same results. I compiled php 5.2.6 with the same options. Same results. Am I missing something? Any help is greatly appreciated! Thank you, Kyle Smith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbe question
I'm not sure it will resolve your issue, but the closing ?> is not a requirement and will eliminate any chance of you adding whitespace to the end of your scripts: #!/usr/bin/php mailto:and...@packetstorm.com] Sent: Wednesday, March 25, 2009 11:29 AM To: php-general@lists.php.net Subject: [PHP] newbe question Hi, I want to learn PHP so I started using it for all of my general purpose scripts. The general format of my scripts are like this: #!/usr/bin/php When I run my scripts and I have an echo (or print) at the end of the script to print out the results of the script, I get an extra line feed printed out. It seems that I can use this: echo " bla bla bla with no terminating line feed"; and I will not get a line feed. But when I use the echo at the end of the script I get a terminating line feed. Is this correct or am I misinterpreting this? Does echo and print always terminate the string with a \n ? The function manual does not seem to mention anything about this. thanks, -Andres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple PHP's and php.ini's - Linux 5.2.9/5.2.6
I've been wrestling with this issue for a few days, I'm hoping someone can help. The issue we had is that we have a system httpd running a custom php-5.2.9 which is compiled in /opt/php/. The php.ini for this installation linked to and ioncube accelerator Zend module. The same apache also hosted some development work, and the developers want to use Zend Debugger, which cannot be used at the same time as ioncube. Ioncube is needed for a key application. So I build a new httpd, and a I built a new php-5.2.9 in /usr/local/gforge/php-5.2.9, pointing at the new Apache. After this was all done I noticed (in phpinfo) that it said something like "configuration file path = /usr/local/gforge/php-5.2.9/lib/, configuration file loaded = /opt/php/lib/php.ini". I shrugged it off, added a PHPIni apache directive and called it a night. Come to find out that this application (GForge) uses some php-based scripts linked in with their CVS. I don't know that gritty details. Anyway, it uses the system php, which of course links to php.ini in /opt/php/lib.php. I figured it would be a simple task to symlink the system php to this new build of php and it would reference the correct php.ini. Here's where the confusion sets in. [r...@dev2 php-5.2.9]# /usr/local/gforge/php-5.2.9/bin/php -i|grep php.ini Configuration File (php.ini) Path => /usr/local/gforge/php-5.2.9/lib/ Loaded Configuration File => /opt/php/lib/php.ini The path explicitly says "/usr/local/...", yet it loads the "/opt/php/lib/php.ini" file. However, if I set: [r...@dev2 php-5.2.9]# /usr/local/gforge/php-5.2.9/bin/php -c /usr/local/gforge/php-5.2.9/lib/ -i|grep php.ini Configuration File (php.ini) Path => /usr/local/gforge/php-5.2.9/lib/ Loaded Configuration File => /usr/local/gforge/php-5.2.9/lib/php.ini Bingo! Great news. Sort of... I don't want to have to modify every CVS script to add a -c option to the php request. Why should I have to? That should be the first place it looks, right? I recompiled php with --with-config-file-path=/usr/local/gforge/php-5.2.9/lib/. Same results. I compiled php 5.2.6 with the same options. Same results. Am I missing something? Any help is greatly appreciated! Thank you, Kyle Smith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php