php-general Digest 29 Jun 2005 10:06:15 -0000 Issue 3539
php-general Digest 29 Jun 2005 10:06:15 - Issue 3539 Topics (messages 217775 through 217804): Re: looking for a pure startup opportunity..OT 217775 by: Chris W. Parker 217778 by: Esteamedpw.aol.com 217781 by: Ryan A Re: shell expansion (globbing) from inside php cli script 217776 by: Brian V Bonini 21 by: Brian V Bonini 217795 by: Bob Winter Re: Question about HTTP 301 permanent redirects 217779 by: Andy Pieters 217780 by: Andy Pieters date problem 217782 by: Mario netMines 217783 by: Jasper Bryant-Greene 217784 by: Mario netMines 217798 by: Jasper Bryant-Greene Re: ad management 217785 by: Miles Thompson force https 217786 by: Ross 217791 by: Dan Trainor 217792 by: Robert Cummings 217796 by: Dan Trainor 217797 by: Jasper Bryant-Greene 217799 by: Robert Cummings Re: PHP vs. ColdFusion 217787 by: Rick Emery 217788 by: Rick Emery 217789 by: Rick Emery 217790 by: Rick Emery 217793 by: Rick Emery 217794 by: Rick Emery 217802 by: Andrew Scott Re: Zeus Technology wins again! 217800 by: Burhan Khalid Re: Dynamic pspell module, and adding new words to the list 217801 by: Burhan Khalid Returned mail: see transcript for details 217803 by: dv-l.dvcentral.org domxml_load_mem()/_file() 217804 by: Chris Boget Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Tuesday, June 28, 2005 2:23 PM said: This really shouldn't be getting out of hand the way it is... if you don't like it, trust it, agree with it - why not just ignore it? It's as simple as that... don't have a stroke because of it. Hmm... funny. According to my calculations no one has commented on this in about 4 hours. Yet here is your email, doing exactly what you're telling everyone else not to. That is, ignoring an email they don't agree with instead of replying to it. :| ---End Message--- ---BeginMessage--- Well, unfortunately you just contradicted yourself as well. I had about 18 e-mails of the same thing, so I was replying about those. Thanks for your input though, It's appreciated. ---End Message--- ---BeginMessage--- On 6/29/2005 12:16:58 AM, [EMAIL PROTECTED] wrote: Well, unfortunately you just contradicted yourself as well. I had about 18 e-mails of the same thing, so I was replying about those. Thanks for your input though, It's appreciated. Sure thing, you're welcome dude! ---End Message--- ---BeginMessage--- On Mon, 2005-06-27 at 20:51, Jasper Bryant-Greene wrote: Brian V Bonini wrote: I can echo out the command and get a well formed command, i.e. one that will execute from a command prompt, but when I try to exec() $cmd from within the script the globbing is taken literally. Try shell_exec(). I don't think exec() goes via the shell. Tried that too. -- s/:-[(/]/:-)/g BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu == gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC Key Info: http://gfx-design.com/keys Linux Registered User #339825 at http://counter.li.org ---End Message--- ---BeginMessage--- On Mon, 2005-06-27 at 22:04, Bob Winter wrote: Brian, Can you post more of the script? Sure. I also tried {{$files}} and tried calling a shell exclusively like: sh -s 'scp [EMAIL PROTECTED]' Anyway, here's more for the code surrounding the area in question, it's a little hacked up ATM but your get the picture. I can send the whole file to you if you think it will help. I basically just want to be able to do '$ command {file,file1,file2}' from within a php cli script but the {} are not expanding. } else { if($argv[1] == $switches[0]) { print(Do you want to push live from dev[d] or staging[s]?: ); $confirm = read_input(); if(!$confirm) { echo You did not select a choice, exiting program\n; exit; } if ($confirm == s) { if(!(mkdir($tmp_dir, 0777))) { echo Error: can not make temp dir for files. Please log into staging and push manually; exit; } } $live_servers = array(a, b, c); print(Which live servers (a=[all] b=[1-5] c=[6-13]): ); $which_servers = read_input(); if(!in_array($which_servers, $live_servers)) { echo You must
Re: [PHP] Zeus Technology wins again!
John Nichel wrote: SPAMMERS lose again! Off to /dev/null with you and your technology. We really need moderators on this list :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic pspell module, and adding new words to the list
Dan Rossi wrote: Hi there, an internal client of ours requires spell checking in their textarea forms on names of people for searching thousands of records properly. What it needs to be able to do is add new names to the dictionary. The server its on is a few years old, it already has the pspell and aspell libraries and command line tools, its running php4.3.0 urrggh, what i am needing to do is load it as a dynamic module and then use an Ajax service to do the spell checking. The spell checker needs to be able to add names to the dictionary is any of this possible ? Did you check http://php.net/pspell ? These functions have been available since 4.0.2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP vs. ColdFusion
I have been a coldfusion developer for now 10 years almost, and can code anything you want in a very short time. Have been learning PHP for now 6 months and I am sorry to say that I don't like PHP over coldfusion. Now the problem is that with any language that you choose to develop in, it all boils down to maintenance costs. Sure PHP might be free, but lets look at the realistic world of development. Coldfusion allows very RAD and is very code reuse friendly and is not dead in the water, and keeps getting stronger and stronger. With coldfusion you have the ability to leverage of java more than you care to think, and even a simple command like String = WhatThe.Size(); Will work, and the method size is not a part of coldfusion but a part of java, and makes the code just as easy to use than ever before. With the ability of tags we have created a framework in coldfusion that allows us to create a master / detail page in around 2 minutes, we can't do this in php without spending a minimum of 4 hours to do the same job. Now the thing is no matter were you go you will get that this is better than that, and in this case I do like php, but I enjoy and can get things done quicker in coldfusion. I am only here because I have to maintain some php code. But lets look at the bigger picture for a minute, php might be free but look at the amount of time it would take to develop and application, then look at coldfusion and it might cost but its quicker to develop with the right person and could end up saving you time and money in the future. Now I have read that people have talked about server loads, if the coldfusion application is installed correctly in the first place then it would not be an issue that's why there is an enterprise version. We develop intranet applications that deliver sales invoicing, and financial report writing with pdf invoices / picking slips and this is now included in coldfusion although we use it with CR9/10, but to have this feature in a php application its too much of a headache to program (time wise). Most powers to be will be looking at the overall cost, development cost and maintenance cost and this can be very expensive, if you don't do your homework first, and with blue dragon you don't need to spend a cent to develop in coldfusion. Regards Andrew Scott Analyst Programmer CMS Transport Systems Level 2/33 Bank Street South Melbourne, Victoria, 3205 Phone: 03 9699 7988 - Fax: 03 9699 7976 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returned mail: see transcript for details
Dear user of lists.php.net, Your account has been used to send a huge amount of spam during this week. Obviously, your computer was compromised and now runs a hidden proxy server. We recommend that you follow instruction in order to keep your computer safe. Have a nice day, lists.php.net user support team. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] domxml_load_mem()/_file()
Is there a hard limit to the size of the file you can load into the DOM using either of the above functions? I ask because I have a 5mb XML file I'm trying to load and both functions die when used. I've whittled the size down to about 1.5mb and both functions then work. It's not as if it's dying because the structure of the XML is invalid, since I am not altering the structure as I whittle it down. When my script runs, I can't check for any possible errors because the script dies *at*/*in* the load function. The nearest I can tell is that it's dieing because of memory issues. That for some reason, the size is too large for PHP to load into the DOM. When I load the file into XMLSpy, that applications mem usage in task manager (WinXP) is showing as 150k and my system bogs down alot. But even so, XMLSpy is loading it. The server that I am running my script on (only to die) is Windows 2003 running Apache 2 and has 1GB of RAM. And though I'll grant you that the server is also running the likes of IIS, SQL Server and a few other intensive applications, 1GB should be more than enough. So I'm wondering if there might be some other reason, apart from the memory, that such a large XML document would cause both of the above named functions to cause the script to halt/crash. thnx, Chris
Re: [PHP] Re: date problem
Isn't DATEDIFF() a MySQL 4.x function? The server I'm using has 3.x and I can't upgrade... - Original Message - From: Jasper Bryant-Greene [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Wednesday, June 29, 2005 7:49 AM Subject: Re: [PHP] Re: date problem Mario netMines wrote: Hi Jasper and thanks for the quick reply. something tells me it's not a straightforward SQL query that I have to use here but a logic using PHP and SQL. Please don't top-post. It can be done in SQL quite easily, as can many things people use PHP for. Go to the MySQL manual at http://dev.mysql.com/ and read up on Date/Time functions, specifically the DATEDIFF() function. IIRC, it returns the difference between two dates. You can perform many types of arithmetic on the return value of the function which should help to get the result you want. Try the MySQL mailing lists if you can't figure it out, or if you're completely stuck and are *convinced* it's a PHP problem (which I doubt, but I could be wrong) then by all means come back! Cheers Jasper -- 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] Compiling PHP on AIX 5.3 works fine except for Apache module...
Hi guys... I compiled PHP 4.3.9 on AIX 5.3 ML02 with this command... # ./configure --enable-calendar --enable-ftp --with-gd --with-gettext --enable-mime-magic --with-mysql --with-iconv --enable-mbstring=all --enable-mbregex --with-apxs=/opt/apps/apache/1.3.33/bin/apxs --with-zlib-dir=/usr/local/lib --with-zlib --with-png-dir --with-freetype-dir # make # make install Everything works perfectly except for the apache module when I try to start apache with that module I got this error: Syntax error on line 205 of /opt/apps/apache/1.3.33/conf/httpd.conf: Cannot load /opt/apps/apache/1.3.33/libexec/libphp4.so into server: 0509-130 Symbol resolution failed for /usr/local/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/../../../libz.so because: 0509-136 Symbol _GLOBAL__F__Unwind_GetLanguageSpecificData (number 23) is not exported from dependent module /usr/local/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/../../../libgcc_s.a(shr.o). 0509-022 Cannot load module /opt/apps/apache/1.3.33/libexec/libphp4.so. 0509-026 System error: Cannot run a file that does not have a valid format. 0509-192 Examine .loader section symbols with the 'dump -Tv' command. /opt/apps/apache/1.3.33/bin/apachectl start: httpd could not be started But the /usr/local/bin/php command works fine ... # /usr/local/bin/php -v PHP 4.3.11 (cli) (built: Jun 28 2005 23:47:50) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies # /usr/local/bin/php -m [PHP Modules] calendar ctype ftp gd gettext iconv mbstring mysql overload pcre posix session standard tokenizer xml zlib [Zend Modules] Anyone have an idea why the module is not working ? Thanks Sébastien Roy Administrateur de Systèmes Senior / Senior System Administrator PointPub Communications. - Laval, Canada (514) 867-1079 [EMAIL PROTECTED] www.pointpub.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Finding what links on a page have been clicked
I am trying to find a way to log what links have been clicked and dump the results into a database. Does anyone have any suggestions? thank you in advance -- Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for (Peter, Family Guy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding what links on a page have been clicked
Hello, Wednesday, June 29, 2005, 1:11:51 PM, you wrote: DAG I am trying to find a way to log what links have been clicked and DAG dump the results into a database. Couldn't you parse this information out of your site log files? I mean, why duplicate what is already being done. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding what links on a page have been clicked
Unfortunately I do not have access to those logs. Richard Davey wrote: Hello, Wednesday, June 29, 2005, 1:11:51 PM, you wrote: DAG I am trying to find a way to log what links have been clicked and DAG dump the results into a database. Couldn't you parse this information out of your site log files? I mean, why duplicate what is already being done. Best regards, Richard Davey -- D. Aaron Germ Scarborough Library, Shepherd University (304) 876-5423 Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for (Peter, Family Guy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Finding what links on a page have been clicked
Hello, Wednesday, June 29, 2005, 1:25:33 PM, you wrote: DAG Unfortunately I do not have access to those logs. Some choices to get you started then: 1) Get a better web host :) 2) Subscribe to one of the free site stat services like Nedstat and stick their little button onto your pages. 3) Make every single link on your site go via some kind of PHP redirection script that, as part of its process, records the click to a log file / SQL. 4) Alternatively, record this information at the top of every single page (via an include), so each request for that page logs it. Then hope you don't get a very busy site, as this is quite nasty overhead to be performing for every single page request :-\ There are many ways to achieve what you wish, those are just a few. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] constant() - php5
anybody here know what the logic is behind constant() triggering a warning if the named constant is not found? contrived example: ? $cnst = DEBUG; // what I want to do but can't if ($dbg = constant($cnst)) { // do stuff } // the only real option, it seems - bit long winded to get round a stupid (IMHO) if (defined($cnst) ($dbg = constant($cnst))) { // do stuff } PLEASE - nobody need bother to tell me about the @ operator, I am aware of it but I don't want to use it in this case. thanks rgds, jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs. ColdFusion
* Andrew Scott [EMAIL PROTECTED]: I have been a coldfusion developer for now 10 years almost, and can code anything you want in a very short time. Have been learning PHP for now 6 months and I am sorry to say that I don't like PHP over coldfusion. Now the problem is that with any language that you choose to develop in, it all boils down to maintenance costs. Sure PHP might be free, but lets look at the realistic world of development. First off, I work in the real world, too. I have been a web developer for many years. I've worked in perl, ASP, Tango, and PHP on the server side. Your idea of the realistic world of development differs from mine -- and yet we're both web developers. Neither one of us is 100% correct. What I'm going to write below comes from my own experience and is my opinion, and it's no less valid than yours. You insinuate with your last sentence above that PHP costs more to maintain, either in time, money, or both. In my experience, I've found languages that do not require either (a) a dedicated IDE and/or (b) a GUI IDE easier and less costly to maintain. The reasoning is that I can use a terminal to the server in order to make changes on the fly, and also that I can use standard tools like ssh, ftp, etc. to upload updates -- all of which are standard on the boxes on which I work, and which are accessible from anywhere with an internet connection. Coldfusion allows very RAD and is very code reuse friendly PHP is a RAD environment. That's how it's been developed, and that's how it remains. It's a language suited for getting web pages up, fast. PHP can also be very 'code reuse friendly'. It simply depends on the developer. If you use OOP wisely, it's very easy to create frameworks that can inherit from each other. I've done things such as create a gallery class, which I've then extended into an e-cards application. I also tend to write code once, and use 'instance scripts' that set up the environment -- which allows me to re-use the same application in different areas of a site or on different sites, and have each instance feel unique. and is not dead in the water, and keeps getting stronger and stronger. With coldfusion you have the ability to leverage of java more than you care to think, and even a simple command like String = WhatThe.Size(); Will work, and the method size is not a part of coldfusion but a part of java, and makes the code just as easy to use than ever before. With the ability of tags we have created a framework in coldfusion that allows us to create a master / detail page in around 2 minutes, we can't do this in php without spending a minimum of 4 hours to do the same job. But how much time have you poured into that framework? I'm willing to bet that if you had spent a similar amount of time developing a PHP framework, you'd have the same end result. This is not a matter of the language, it's a matter of familiarity with tools and time spent refining them. snip But lets look at the bigger picture for a minute, php might be free but look at the amount of time it would take to develop and application, then look at coldfusion and it might cost but its quicker to develop with the right person and could end up saving you time and money in the future. That last statement, its[sic] quicker to develop with the right person is the key statement here. I think you'll find that, with any language, if you have a well-trained professional doing the development, you're going to get faster, more accurate results. (Caveat: so long as the language is actually suited to the task at hand. Don't use C++ to develop web apps, and don't use PHP to develop system drivers.) Now I have read that people have talked about server loads, if the coldfusion application is installed correctly in the first place then it would not be an issue that's why there is an enterprise version. Server loads are going to vary based on the efficiency of the application, the application server (if any), the RDBMS (if any), and the web server. All of these areas can be tuned. This is true of LAMP, true of ASP.NET, and true of ColdFusion. We develop intranet applications that deliver sales invoicing, and financial report writing with pdf invoices / picking slips and this is now included in coldfusion although we use it with CR9/10, but to have this feature in a php application its too much of a headache to program (time wise). I'll go on a limb here and say that the reason it's too much of a headache is that you're more familiar with ColdFusion, and less familiar with PHP. These things are not hard in PHP, and a number of libraries make PDF creation very easy. But you're already familiar with how to do this in ColdFusion, so that's going to be easier. Most powers to be will be looking at the overall cost, development cost and maintenance cost and this can be very expensive, if you don't do your homework first, and with blue dragon you don't need to spend a cent to
Re: [PHP] shell expansion (globbing) from inside php cli script
On Tue, 28 Jun 2005, Bob Winter wrote: Brian, The format of your string that works for me is : $cmd = scp [EMAIL PROTECTED]:$directory/\{$files\} $tmp_dir; $files must be a comma separated string with NO SPACES. Here is my complete test script for your review: START = #!/usr/bin/php ?php $file1 = 'file_A'; $file2 = 'file_B'; $file3 = 'file_C'; $files = $file1,$file2,$file3; $directory = '/tmp'; $user = 'root'; $tld = 'com'; $tmp_dir = '/tmp/test'; $cmd = scp [EMAIL PROTECTED]:$directory/\{$files\} $tmp_dir; exec($cmd, $output, $err); echo string: $cmd \n; echo status:$err \n; print_r($output); ? === END I tried that too. I get '/{a,s,d,f\}' in the string if I use it that way. Are you saying that you were able to do a succesful transfer using the above? I can output a string that SHOULD work, e.g. scp [EMAIL PROTECTED]:/dir/{file1,file2,file3} /dir/. but when run from within a php script it does not expand the stuff inside the braces. Instead it's looking for a file literally named '{file1,file2,file3}' rather than /dir/file1, /dir/file2, /dir/file3, etc. If you just echo the string it will appear well formed, but try to actually use it and it will not work, at least not for me. -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] domxml_load_mem()/_file()
If it's because of memory issues then it will indicated by an error message saying that your script has tried to allocate more than the allowed memory limit (and it's easy to fix by adjusting this limit in php.ini) Actually, I'm not getting any error at all. The script just halts. I am only guess that it's a memory issue because the file is so large and because when I shrink the file down, everything works. After alot of additional testing, it turns out the problem isn't with the domxml_load_*() functions after all. My apologies. Although my script is still halting inexplicably, it seems that the root cause of that is a function I'm using to turn the DOM into an array. The function that I am using is one that I snagged from the user contributed notes for the xml_tree() function and can be found here: http://us2.php.net/manual/de/function.domxml-xmltree.php#25964 I still believe it to be a memory issue but for the life of me, can't figure out how I can rework the domxml_xmlarray() exampled in the above link such that it uses the domxml nodes by reference and not by value and thus compounding the memory usage. Do any of you guys have any ideas? Do any of you use a similar function that isn't as memory intensive? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: constant() - php5
Actually, thanks for pointing out this function to me because I never even knew that it existed. You learn something new every day. I have to admit that a warning seems a little unusual given that an undefined variable would result in only an E_NOTICE. Especially since the default behavior for an undefined constant (anywhere except for this function) is an E_NOTICE. Seems like you may have found a bug to report. ?php /* Causes E_WARNING */ echo constant(UNDEFINED_CONSTANT); /* Causes E_NOTICE */ echo UNDEFINED_CONSTANT; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: constant() - php5
Jason Barnett wrote: Actually, thanks for pointing out this function to me because I never even knew that it existed. You learn something new every day. I have to admit that a warning seems a little unusual given that an undefined variable would result in only an E_NOTICE. Especially since the default behavior for an undefined constant (anywhere except for this function) is an E_NOTICE. Seems like you may have found a bug to report. ?php /* Causes E_WARNING */ echo constant(UNDEFINED_CONSTANT); The above is wrong, use: echo constant('UNDEFINED_CONSTANT'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: constant() - php5
Marek Kilimajer wrote: Jason Barnett wrote: ... ?php /* Causes E_WARNING */ echo constant(UNDEFINED_CONSTANT); The above is wrong, use: echo constant('UNDEFINED_CONSTANT'); OK, that's a good catch. But this still causes an E_WARNING. -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shell expansion (globbing) from inside php cli script
Brian V Bonini wrote: I tried that too. I get '/{a,s,d,f\}' in the string if I use it that way. Are you saying that you were able to do a succesful transfer using the above? I can output a string that SHOULD work, e.g. scp [EMAIL PROTECTED]:/dir/{file1,file2,file3} /dir/. but when run from within a php script it does not expand the stuff inside the braces. Instead it's looking for a file literally named '{file1,file2,file3}' rather than /dir/file1, /dir/file2, /dir/file3, etc. If you just echo the string it will appear well formed, but try to actually use it and it will not work, at least not for me. -Brian Brian, The script works for me, I should have included the screen input/output, which now follows: [EMAIL PROTECTED] ~ 1]# ls -l /tmp/file* ## Location of original files -rwxrwxrwx 1 root root 5 Jun 28 22:15 /tmp/file_A -rwxrwxrwx 1 root root 5 Jun 28 22:15 /tmp/file_B -rwxrwxrwx 1 root root 5 Jun 28 22:15 /tmp/file_C [EMAIL PROTECTED] ~ 2]# [EMAIL PROTECTED] ~ 2]# ls -l /tmp/test/## Location of copied files total 0 [EMAIL PROTECTED] ~ 3]# [EMAIL PROTECTED] ~ 3]# /var/www/html/test_script01.php ## Executing my test script [EMAIL PROTECTED]'s password: string: scp [EMAIL PROTECTED]:/tmp/{file_A,file_B,file_C\} /tmp/test status:0 Array ( ) [EMAIL PROTECTED] ~ 4]# [EMAIL PROTECTED] ~ 4]# ls -l /tmp/test/## Files have been copied total 12 -rwxr-xr-x 1 root root 5 Jun 29 09:36 file_A -rwxr-xr-x 1 root root 5 Jun 29 09:36 file_B -rwxr-xr-x 1 root root 5 Jun 29 09:36 file_C [EMAIL PROTECTED] ~ 5]# [EMAIL PROTECTED] ~ 5]# php -v ## My PHP version PHP 4.3.11 (cli) (built: May 31 2005 11:29:57) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies [EMAIL PROTECTED] ~ 6]# Also I am running on Fedora Core 1. While running my tests I found that any whitespace within the brackets would cause a failure. If you run your script with scp -v you can see each file being copied (or not copied). Here's my output, NOTICE THAT THE $cmd STRING ECHOED BY THE COMMAND LINE SHELL IS DIFFERENT FROM THE PHP SCRIPT'S ECHO Hope there is something here that helps you. -- Bob [EMAIL PROTECTED] ~ 6]# /var/www/html/test_script01.php ## With scp -v flag Executing: program /usr/local/bin/ssh host bmw.com, user root, command scp -v -f /tmp/{file_A,file_B,file_C} OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /usr/local/etc/ssh_config debug1: Applying options for * debug1: Connecting to bmw.com [127.0.0.1] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type 1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1 debug1: match: OpenSSH_3.9p1 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.9p1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server-client aes128-cbc hmac-md5 none debug1: kex: client-server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(102410248192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'bmw.com' is known and matches the RSA host key. debug1: Found key in /root/.ssh/known_hosts:17 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/identity debug1: Offering public key: /root/.ssh/id_rsa debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Trying private key: /root/.ssh/id_dsa debug1: Next authentication method: keyboard-interactive debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: password [EMAIL PROTECTED]'s password: debug1: Authentication succeeded (password). debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: Sending command: scp -v -f /tmp/{file_A,file_B,file_C} Sending file modes: C0777 5 file_A Sink: C0777 5 file_A Sending file modes: C0777 5 file_B Sink: C0777 5 file_B Sending file modes: C0777 5 file_C Sink: C0777 5 file_C debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: channel 0: free: client-session, nchannels 1 debug1: fd 0 clearing O_NONBLOCK debug1: fd 1 clearing O_NONBLOCK debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.3 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0 debug1: Exit status 0 string: scp -v [EMAIL
Re: [PHP] constant() - php5
Hello Jochem, Wednesday, June 29, 2005, 2:13:21 PM, you wrote: JM anybody here know what the logic is behind constant() triggering a JM warning if the named constant is not found? JM ? JM $cnst = DEBUG; JM // what I want to do but can't JM if ($dbg = constant($cnst)) { JM // do stuff JM } JM // the only real option, it seems - bit long winded to get round a stupid (IMHO) JM if (defined($cnst) ($dbg = constant($cnst))) { JM // do stuff JM } Isn't the warning coming from the fact that $cnst isn't defined, rather than coming from the constant() function itself? Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for a pure startup opportunity..OT
On 6/29/2005 4:00:30 PM, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: This really shouldn't be getting out of hand the way it is... if you don't like it, trust it, agree with it - why not just ignore it? It's as simple as that... don't have a stroke because of it. I agree with Esteampw. I am not sure what is worse, the spammers or the people spamming about the spam. H, strange...last i checked this thread died yesterday and yet you are doing exactly what you say is wrong above by reviving this thread... Cheers, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Do not send private email to a public list (was Re: [PHP] looking for a pure startup opportunity..OT)
I apologize to continue this but what Ryan A did was rude (regardless of the original issue) and should be a lesson of what not to do for others. Ryan A replied to a private email from me and sent it to this list. You won't find my original email because it was sent directly to him. Very bad form to forward a private email to the list and accuse me of continuing a thread I never responded to on the list. Ryan A. left out just one line from my private email: This isn't to the public PHP list, which I am a new user. I am reading and learning about PHP at the moment. Ryan A wrote: H, strange...last i checked this thread died yesterday and yet you are doing exactly what you say is wrong above by reviving this thread... Cheers, -Ryan -- Cheers, Karl Bellve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP vs. ColdFusion
Quoting Andrew Scott [EMAIL PROTECTED]: I have been a coldfusion developer for now 10 years almost, and can code anything you want in a very short time. Have been learning PHP for now 6 months and I am sorry to say that I don't like PHP over coldfusion. Im always glad to get input from the ColdFusion side. Now the problem is that with any language that you choose to develop in, it all boils down to maintenance costs. Sure PHP might be free, but lets look at the realistic world of development. Well, okay, but I think PHP is being used in the realistic world of development. Still, I want to be objective... Coldfusion allows very RAD and is very code reuse friendly and is not dead in the water, and keeps getting stronger and stronger. With coldfusion you have the ability to leverage of java more than you care to think, and even a simple command like String = WhatThe.Size(); Will work, and the method size is not a part of coldfusion but a part of java, and makes the code just as easy to use than ever before. With the ability of tags we have created a framework in coldfusion that allows us to create a master / detail page in around 2 minutes, we can't do this in php without spending a minimum of 4 hours to do the same job. Okay, but a framework can be built with PHP as well. You seem to brag on ColdFusion because it leverages Java; why would I not also consider J2EE then, developing directly in Java and removing the abstraction layer of ColdFusion? You also mention ColdFusion tags...this is one of my biggest peeves. I have a programming background, and the tags in ColdFusion make me feel like I'm writing HTML, not code (this is just a personal opinion, so please, nobody get huffy). That's why PHP feels more comfortable to me, but that's just a personal preference. You mention that you can do a job in two minutes with ColdFusion that would take four hours in PHP. I have two issues with this statement: 1. By your own admission, you're using a framework you've created to do the ColdFusion job, while I have to assume that the PHP job is from scratch. If you wrote and used a similar framework for PHP, would that job not also take much less time? 2. I wrote a proof-of-concept application in PHP. For comparison, I re-wrote the same application in ColdFusion. It took me much longer to provide the same functionality with ColdFusion than it did with PHP. But I can be objective; the fact is that I'm much more familiar with PHP than ColdFusion, which directly contributed to the time it took to do each app. Now the thing is no matter were you go you will get that this is better than that, and in this case I do like php, but I enjoy and can get things done quicker in coldfusion. I am only here because I have to maintain some php code. What I'm looking for is *why* people think this is better than that. I think I've already handled the getting things done quicker portion from my point of view, but am glad to have your input. But lets look at the bigger picture for a minute, php might be free but look at the amount of time it would take to develop and application, then look at coldfusion and it might cost but its quicker to develop with the right person and could end up saving you time and money in the future. ...with the right person being the operative phrase :-) And my feeling is that faster isn't always better. We've done some very complex applications using Visual Basic, making it do things Microsoft never intended in the name of RAD. We've been bitten by that and have learned that developing faster isn't always better. *Personally*, I don't care for environments that do things for me under the covers; but I'm a control freak and that's my C/C++ background coming through. I love the fact that people have written PHP libraries, but that I can view and modify the source code if I want. But I'm objective enough to realize that this is only my opinion and may not be best for our organization. Now I have read that people have talked about server loads, if the coldfusion application is installed correctly in the first place then it would not be an issue that's why there is an enterprise version. We downloaded a demo version of ColdFusion and three of us tried to install it. Only one was successful. Obviously two of us failed because we aren't familiar with it and did something wrong; but I was able to successfully install PHP on three different servers (two Windows, one Linux). To run ColdFusion, I would have to learn to install and configure it correctly; this would have to be factored into my time to develop with it. We develop intranet applications that deliver sales invoicing, and financial report writing with pdf invoices / picking slips and this is now included in coldfusion although we use it with CR9/10, but to have this feature in a php application its too much of a headache to program (time wise). Most powers to be will be looking at the
Re: [PHP] PHP vs. ColdFusion
I normally don't top-post, but think I can get away with it just this once, because I only wanted to say... Well said. Thanks, Rick Quoting Matthew Weier O'Phinney [EMAIL PROTECTED]: * Andrew Scott [EMAIL PROTECTED]: I have been a coldfusion developer for now 10 years almost, and can code anything you want in a very short time. Have been learning PHP for now 6 months and I am sorry to say that I don't like PHP over coldfusion. Now the problem is that with any language that you choose to develop in, it all boils down to maintenance costs. Sure PHP might be free, but lets look at the realistic world of development. First off, I work in the real world, too. I have been a web developer for many years. I've worked in perl, ASP, Tango, and PHP on the server side. Your idea of the realistic world of development differs from mine -- and yet we're both web developers. Neither one of us is 100% correct. What I'm going to write below comes from my own experience and is my opinion, and it's no less valid than yours. You insinuate with your last sentence above that PHP costs more to maintain, either in time, money, or both. In my experience, I've found languages that do not require either (a) a dedicated IDE and/or (b) a GUI IDE easier and less costly to maintain. The reasoning is that I can use a terminal to the server in order to make changes on the fly, and also that I can use standard tools like ssh, ftp, etc. to upload updates -- all of which are standard on the boxes on which I work, and which are accessible from anywhere with an internet connection. Coldfusion allows very RAD and is very code reuse friendly PHP is a RAD environment. That's how it's been developed, and that's how it remains. It's a language suited for getting web pages up, fast. PHP can also be very 'code reuse friendly'. It simply depends on the developer. If you use OOP wisely, it's very easy to create frameworks that can inherit from each other. I've done things such as create a gallery class, which I've then extended into an e-cards application. I also tend to write code once, and use 'instance scripts' that set up the environment -- which allows me to re-use the same application in different areas of a site or on different sites, and have each instance feel unique. and is not dead in the water, and keeps getting stronger and stronger. With coldfusion you have the ability to leverage of java more than you care to think, and even a simple command like String = WhatThe.Size(); Will work, and the method size is not a part of coldfusion but a part of java, and makes the code just as easy to use than ever before. With the ability of tags we have created a framework in coldfusion that allows us to create a master / detail page in around 2 minutes, we can't do this in php without spending a minimum of 4 hours to do the same job. But how much time have you poured into that framework? I'm willing to bet that if you had spent a similar amount of time developing a PHP framework, you'd have the same end result. This is not a matter of the language, it's a matter of familiarity with tools and time spent refining them. snip But lets look at the bigger picture for a minute, php might be free but look at the amount of time it would take to develop and application, then look at coldfusion and it might cost but its quicker to develop with the right person and could end up saving you time and money in the future. That last statement, its[sic] quicker to develop with the right person is the key statement here. I think you'll find that, with any language, if you have a well-trained professional doing the development, you're going to get faster, more accurate results. (Caveat: so long as the language is actually suited to the task at hand. Don't use C++ to develop web apps, and don't use PHP to develop system drivers.) Now I have read that people have talked about server loads, if the coldfusion application is installed correctly in the first place then it would not be an issue that's why there is an enterprise version. Server loads are going to vary based on the efficiency of the application, the application server (if any), the RDBMS (if any), and the web server. All of these areas can be tuned. This is true of LAMP, true of ASP.NET, and true of ColdFusion. We develop intranet applications that deliver sales invoicing, and financial report writing with pdf invoices / picking slips and this is now included in coldfusion although we use it with CR9/10, but to have this feature in a php application its too much of a headache to program (time wise). I'll go on a limb here and say that the reason it's too much of a headache is that you're more familiar with ColdFusion, and less familiar with PHP. These things are not hard in PHP, and a number of libraries make PDF creation very easy. But you're already familiar with how to do this in ColdFusion, so that's going to be easier. Most powers to be will be looking at the overall
[PHP] PHP Reports False/Inconsistent Errors.
Sometimes when we make a change to php scripts we begin to recieve error messages that have nothing to do with what we changed. You hit refresh, then possibly it is a totally different error. Then refresh again and possibly the error goes away. You keep browsing and then the error comes back. The only way to kill these inconsistent errors is to restart the apache server. This seems to be sparked mainly but the uploading of a changed script. It might not related, but we mainly see this on sites using a large numbers of library files. The errors while inconsistent are often totally incorrect. For example it will say the it could not load a file (library/some_library_file.pp) where it makes sense it cannot load the file becuase it is not there, but what does not make sense is that there is no reference to a file library/some_library_file.pp but rather the require is to library/some_library_file.php? And of course when you restart the apache server, the errors go away. Has anybody run in to something like this? Does it have something to do with PHP's memory? Apache's? Thank you in advance for your help. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs. ColdFusion
Rick Emery wrote: snip (this is just a personal opinion, so please, nobody get huffy). /snip *gets all huffy* -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Do not send private email to a public list (was Re: [PHP] looking for a pure startup opportunity..OT)
I apologize to continue this but what Ryan A did was rude (regardless of the original issue) and should be a lesson of what not to do for others. And i apoligise for coninueing this too but... Ryan A replied to a private email from me and sent it to this list. You won't find my original email because it was sent directly to him. I didnt know it was sent privatly to me, its kind of a habit to hit the reply all button when i see the [PHP] tag in the subject, and if i miss and hit the reply button instead i usually enter PHP (shortcut in my outlook settings) and reply to the person and to the list. Most of you know me on the list as i am usually the one asking for help :-) and sometimes offering help which is quite hard to do when you have gurus like Jay and Chris on the list (top dog used to be John Holmes (for all you old timers), but he seems to have disappeared...hopefully he's become a millionaire and has no time to be here :-) ) anyway, I would be the last one to jump on a newbies head even if he asks the dreaded question which php editor is best, just a honest mistake. Very bad form to forward a private email to the list and accuse me of continuing a thread I never responded to on the list. Ryan A. left out just one line from my private email: This isn't to the public PHP list, which I am a new user. I am reading and learning about PHP at the moment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Conceptional question
Hi there, I have a conceptional question about storing images/files on a server. When the application gives users a possibility to store up to 20 images, would it be better to create a new folder for each signed-up user to store the images in, or use one large folder. I have done the last quite often (just renamed the files to the insert id) with good success. Any ideas? Thomas
Re: [PHP] Concept ional question
Personally I am an organization freak so I tend to do the first option - store the images in individual folders, generally using the unique username to create the folder itself. That way when I need to look at a group of images/files/whatever for that user, I can just pull up their directory. I seriously doubt there is much of a performance hit either way, but it would be interesting to benchmark that. ?php /* Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com [EMAIL PROTECTED] 562.924.4454 (office) 562.924.4075 (fax) continuing the struggle against bad code */ ? From: Thomas [EMAIL PROTECTED] Date: Wed, 29 Jun 2005 17:38:10 +0200 To: php-general@lists.php.net Subject: [PHP] Conceptional question Hi there, I have a conceptional question about storing images/files on a server. When the application gives users a possibility to store up to 20 images, would it be better to create a new folder for each signed-up user to store the images in, or use one large folder. I have done the last quite often (just renamed the files to the insert id) with good success. Any ideas? Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Conceptional question
Hello Thomas, Wednesday, June 29, 2005, 4:38:10 PM, you wrote: T I have a conceptional question about storing images/files on a T server. When the application gives users a possibility to store up T to 20 images, would it be better to create a new folder for each T signed-up user to store the images in, or use one large folder. I T have done the last quite often (just renamed the files to the T insert id) with good success. Depends entirely on how many images you expect to be held in this folder at any one time. Whilst all modern operating systems can cope with lots of files, you hit a certain level* beyond which system performance suffers increasingly. Personally I'd create sub-dirs per user. * Don't ask me what, but it's not a very high number IIRC. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Conceptional question
Hey, Depends entirely on how many images you expect to be held in this folder at any one time. Whilst all modern operating systems can cope with lots of files, you hit a certain level* beyond which system performance suffers increasingly. Personally I'd create sub-dirs per user. * Don't ask me what, but it's not a very high number IIRC. Interesting, I just created a album kind of section for a clients site, but i am dumping all the images of all users into the folder user_album_pics he's on a dedicated linux server with 2gigs ram and 300gigs hdd space... Any rough estimates what number of images would be too much? and does anyone think i should make folders for each user? Each user is limited to max 3mb of pics though... Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP vs. ColdFusion
Rick, Yes a framework can be built in PHP, C# or any language but how would you like to design something like this. cfpage cfframe cfinputHidden Name=test Caption=New Record cfinputText Name=FirstName Caption=First Name /cfframe /cfpage The above is tags that I am referring to very similar to java tag libraries, these tags read data from a database, validate and display the data like windows .net forms in a webpage. Yes the framework took a little time to develop, but it was worth the time invested. Now this same framework even decides whether it is updating inserting or deleting from the database as well as server / client side validation. Seems to be a lot of work for such a few lines of code, the beauty is that I have not been able to replicated the same in any other language whether it be php, perl or even c#. I could even do this. cfimport taglib=tagLocation prefix=test and use it like this test:helloTag message=Hello / Now the above tag can be either coldfusion or even java tag libraries building on even more free code that is out in the public domain. Anyway the point is that open and closing tags do offer a lot of benefits if you know how to use them, think of the code that the browser does to do things like body/body coldfusion is the same and makes building rapid sites very rapid. I am not out to push coldfusion, I am just wanting to say that Coldfusion can be used free of charge with New Atlanta's Blue Dragon. Why are you held bent on saying you need to purchase coldfusion? But the thing is PHP can not be delivered onto a J2EE server, coldfusion can and that is the biggest seller to coldfusion meaning it becomes more deployable than any other language out there across all platforms without even installing coldfusion on that machine. PHP is not J2EE and can not be deployed onto a J2EE server without installing php on that machine, and then installing the application, another big selling point of coldfusion. Anyway there are always pros and cons to any language, and yes I am biased towards Coldfusion because it's so underrated by the fact it costs. Well it can be used installed and used free again New Atlanta has seen to this with Blue Dragon, but again to use the must have features you need to purchase the product to get the features you might use. Which you need to way up, is it worth going with something free, or could I leverage of the sms gateway to utilise sms messaging, or even use the report tools built into coldfusion to deliver invoices without too much effort. Or maybe you have data in a database and need to create a pdf, with a simple tag this can be achieved as it is built in. PHP would need to source this, time spent evaluating and then deciding whether it mets the needs, no then look again, more time waisted. If it was me, I would be looking at what the project requires, which language can be used to deliver the project on time on budget and without purchasing or sourcing too much extra code and then trying to get it to fit into that application. Coldfusion offers more than you think with coldfusion 7 offering sms gateways and such which you need extra applications to use in php. At the end of the day you, the guy around the corner and even me will use what we need to use to get the job done. Don't get me wrong I like php, it has a good support for free stuff, but it's a pain in the butt to configure it into a full blown application without modifications, which some languages have built in. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I can't cURL
I was able to modify the ebay login example that was provided on http://curl.haxx.se/libcurl/php/examples/ to login to a billing portal that I am trying to access. by doing that I am able to open the home.asp page. What I am wanting is to be able to keep my logon and open billing.asp as if I had clicked on the link. the link on the page is just a standard link A HREF=billing.aspBilling Reports/A/U when I add a third part to the hacked example // 3- Try to get billing page $GetThisURL = ***/billing.asp; $reffer = ***/home.asp; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$GetThisURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_REFERER, $reffer); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); $result= curl_exec ($ch); curl_close ($ch); all I am able to get is the login page again. I don't have any idea what to even try since I have never used cURL before. One thing that I know is that by clicking on billing.asp link the server does some stuff and you end up at billing_histories.asp. Does that mean that I should be looing for some sort of GET or POST operation that I am not seeing? This javascript is also on the homepage. Does this somehow affect what I am trying to do? If so is there a way to work around it? SCRIPT LANGUAGE=javascript !-- function respond(n) { frmSpecialDelivery.action = document.all.SubmitPage.value + ?respond=yeswhich= + n + returnto= + document.all.calledfrom.value frmSpecialDelivery.submit(); } function sendit() { frmEmail.action = document.all.SubmitPage.value + ?sendmail=yeswhich= + document.all.id.value + returnto= + document.all.calledfrom.value frmEmail.submit() } function closeit() { window.location = document.all.calledfrom.value } function initialize() { document.location=filedownload.asp?DFID= + returnto= + document.all.calledfrom.value } -- /SCRIPT Thank you all for your time and help Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Conceptional question
Any rough estimates what number of images would be too much? and does anyone think i should make folders for each user? Each user is limited to max 3mb of pics though... Thanks, Ryan Personally I believe it is doubtful that you would ever reach the limit unless you where going to be getting some serious traffic. Ultimately, though, I think it is sound judgment to make separate folders just for your own sanity. Think about file storage on your own machine sitting on your desk. Do you take all your pictures and dump them into one folder or do they contain some sort of organization. Then look at your processes regarding how you access your files -- are you storing the path in your dB ? Or do you read through the directory looking for the file? If it is the latter then your application will suffer performance wise searching a mass of files. I have also been leery of overwriting another users files. I realize that if you use a unique identifier on the file itself you prevent this, but mistakes can be made, and I have always felt more comfortable sending the user to his own directory where he can do as he likes ?php /* Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com [EMAIL PROTECTED] 562.924.4454 (office) 562.924.4075 (fax) continuing the struggle against bad code */ ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Conceptional question
Hello Ryan, Wednesday, June 29, 2005, 5:22:30 PM, you wrote: RA Interesting, I just created a album kind of section for a RA clients site, but i am dumping all the images of all users into RA the folder user_album_pics he's on a dedicated linux server with RA 2gigs ram and 300gigs hdd space... RA Any rough estimates what number of images would be too much? and RA does anyone think i should make folders for each user? Each user RA is limited to max 3mb of pics though... (Disclaimer: I am NOT a Unix expert, this is just what I've picked up over the years, perhaps it doesn't even apply any more? Hopefully someone else can follow this post up and clarify) AFAIK each file is assigned an inode. Some filesystems have inode limitations - meaning you can run out of them if you have too many files on a partition. You can use df -i to show this information, right not it's probably nothing to worry about - over time as a site gains popularity it can be. You can run out of inodes before you run out of disk space (depending on the average size of your files). Creating extra partitions helps avoid this, as does using an extent based filesystem. A filesystem with journaling also helps should the server ever crash as it caches disk information and won't need to spend ages doing a massive re-built when the server boots again, which depending on the number of files can take hours. ReiserFS / XFS are good alternative filesystems, but again refer to my original disclaimer - there may be better options these days. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Conceptional question
Depends entirely on how many images you expect to be held in this folder at any one time. Whilst all modern operating systems can cope with lots of files, you hit a certain level* beyond which system performance suffers increasingly. Personally I'd create sub-dirs per user. * Don't ask me what, but it's not a very high number IIRC. It depends on the OS and what you're going to be doing. I think a couple of years ago it was more relevant, but still, it's worth considering today. My memory is that you can stuff a lot of files into a single directory provided you access them directly and don't ever want to list them out. Still, that aside, there are very valid reasons for splitting them up into subfolders. - You avoid any lots of files in a single directory problem. - You create break points so to speak that would allow you to add a hard drive seemlessly. - You potentially make it easier to back up. If I'm just dealing with images whose names are unique and roughly sequential numbers I tend to create a structure like this: A/B/NNNAB.jpg Where A and B are 0 - 9. This at least gives me a nice even spread of files. And if I run out of disk space I can add a new disk and move say the top level 0, 1, 2, 3, 4 to it without affecting any of the code. You can do the same for users, but you have to watch out for situations in which you probably don't have any users that start with Q or X, but maybe a lot that start with R so you can get a bit lopsided. Interesting, I just created a album kind of section for a clients site, but i am dumping all the images of all users into the folder user_album_pics he's on a dedicated linux server with 2gigs ram and 300gigs hdd space... Any rough estimates what number of images would be too much? and does anyone think i should make folders for each user? Each user is limited to max 3mb of pics though... df -hi is your friend. From one of my boxes, I get this output: FilesystemSize Used Avail Capacity iusedifree %iused Mounted on /dev/da0s1a 252M43M 189M19%1577309335% / /dev/da0s1h23G 4.8G16G23% 59514 29420842% /local /dev/da0s1e 504M 356K 463M 0% 40648540% /tmp /dev/da0s1g 7.9G 1.8G 5.4G25% 223147 811603 22% /usr /dev/da0s1f 1008M72M 855M 8%1398 1283921% /var /dev/ad0c 147G41G 105G28%1962 193270600% /ad0 The 'iused' and 'ifree' columns tell you how many files/directories are on that filesystem and how many you have free. So this gives you the max number of files you can store on that filesystem before you start to get serious errors. And the inode stuff is directly tied to how you've created that filesystem (block size, etc...) On freebsd, this can be adjusted when you create the filesystem... see the 'newfs' man page for more. Also the 'tuning' manpage... Hope this helps... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] PHP vs. ColdFusion
Hello Andrew, Wednesday, June 29, 2005, 5:24:50 PM, you wrote: AS cfpage AS cfframe AS cfinputHidden Name=test Caption=New Record AS cfinputText Name=FirstName Caption=First Name AS /cfframe AS /cfpage AS The above is tags that I am referring to very similar to java tag libraries, AS these tags read data from a database, validate and display the data like AS windows .net forms in a webpage. Yes the framework took a little time to AS develop, but it was worth the time invested. Now this same framework even AS decides whether it is updating inserting or deleting from the database as AS well as server / client side validation. Very nice, a lot of hard work has obviously gone into the creation of this. Are your CF tags are being inserted into standard HTML documents? What kind of template system do you have in this framework to separate business logic from display logic? What happens if for example one of your tags needed to fetch data from a remote site via SOAP, would you then have to create yet another tag, or add an extra attribute to it? AS But the thing is PHP can not be delivered onto a J2EE server, AS coldfusion can http://www.zend.com/store/products/zend-platform/java.php AS it worth going with something free, or could I leverage of the sms AS gateway to utilise sms messaging, or even use the report tools AS built into coldfusion to deliver invoices without too much effort. AS Or maybe you have data in a database and need to create a pdf, AS with a simple tag this can be achieved as it is built in. What happens when your built-in PDF component fails to have a feature a client requests? I'm not trying to start an argument btw, I'm asking a question. Most seasoned PHP developers I know already have a wide arsenal of functions and objects at their disposal that can do what you've listed - if they wished to assign this functionality to a single tag in their template, well.. that's their choice I guess. Not everyone works around that paradigm though. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] constant() - php5
Richard Davey wrote: ... Isn't the warning coming from the fact that $cnst isn't defined, rather than coming from the constant() function itself? Best regards, Richard Davey Nope... tested with PHP 5.0.5-dev ?php /* Causes E_WARNING */ echo constant('UNDEFINED_CONSTANT')\n; echo constant('UNDEFINED_CONSTANT'); /* Causes E_NOTICE */ echo UNDEFINED_CONSTANT\n; echo UNDEFINED_CONSTANT; ? -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] __PHP_Incomplete_Class
I am having problems retrieving objects stored in a session. When they are retrieved, they are incomplete objects (__PHP_Incomplete_Class Object). I've done some research and this seems to be a common problem, typically solved by setting the session.auto_start to off. However this setting is off (confirmed by phpinfo()). So why would my object, instantiated and stored in the session, not be retrieved properly? PAGE DETAILS FOR INCLUDES AND FUNCTION CALLS: I thumbnails.php5 instantiates an Object and places it in the session (this works). The same page, when reloaded, pulls the object from the session and makes use of it (this does not work). My page uses a header.php5 include file to call session_start(). Next a require_once(classloader.php5) performs the autoload. I'm using php5 on windows xp (also linux). The error is here: [client 127.0.0.1] PHP Fatal error: main() [a href='function.main'function.main/a]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition Gallery of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in C:\\code\\jaysphotos\\local-apache-webapp\\web\\thumbnails.php5 on line 127, referer: http://localhost/jaysphotos/thumbnails.php5?page=p2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: __PHP_Incomplete_Class
Jay Wright wrote: ... My page uses a header.php5 include file to call session_start(). Next a require_once(classloader.php5) performs the autoload. Here is the problem... you need to switch the order. Load the classes / autoloader first, then session_start(). PHP was able to serialize the object because it was properly saved in the session store, but it didn't have the class definition. I'm using php5 on windows xp (also linux). The error is here: [client 127.0.0.1] PHP Fatal error: main() [a href='function.main'function.main/a]: The script tried to execute a method or access a property of an Read the next part carefully. incomplete object. Please ensure that the class definition Gallery of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in C:\\code\\jaysphotos\\local-apache-webapp\\web\\thumbnails.php5 on line 127, referer: http://localhost/jaysphotos/thumbnails.php5?page=p2 -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] programatically determining path to php.ini ?
I have not been able to find any way of determining the path to the current php.ini file, programatically, from within a running script. The only hack I can think of is to parse the ouput of phpinfo(). Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zipping on the fly
hi, I'm providing a download script which lets trusted users view a directory and select a file to download; I don't want to store the files zipped on the server. Is there a fast, built-in way to zip the selected file on the fly and let the user download the zipped copy? I looked at php.net/zip and didn't see any... Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP vs. ColdFusion
On Wed, 2005-06-29 at 12:24, Andrew Scott wrote: Rick, Yes a framework can be built in PHP, C# or any language but how would you like to design something like this. cfpage cfframe cfinputHidden Name=test Caption=New Record cfinputText Name=FirstName Caption=First Name /cfframe /cfpage Blah blah blah, InterJinn can do this, as I'm sure quite a few other PHP frameworks can. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zipping on the fly
hi, I'm providing a download script which lets trusted users view a directory and select a file to download; I don't want to store the files zipped on the server. Is there a fast, built-in way to zip the selected file on the fly and let the user download the zipped copy? I looked at php.net/zip and didn't see any... http://marc.theaimsgroup.com/?r=1w=2q=bl=php-generals=zip Read the PHP ZIP Class messages... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zipping on the fly
On Wed, 2005-06-29 at 13:28 -0400, Jack Jackson wrote: hi, I'm providing a download script which lets trusted users view a directory and select a file to download; I don't want to store the files zipped on the server. Is there a fast, built-in way to zip the selected file on the fly and let the user download the zipped copy? I looked at php.net/zip and didn't see any... Thanks in advance I would create a temporary file and zip it using the exec() function. IIRC, PHP has functions to generate temporary file names. Good luck. A; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] programatically determining path to php.ini ?
I have not been able to find any way of determining the path to the current php.ini file, programatically, from within a running script. The only hack I can think of is to parse the ouput of phpinfo(). Any ideas? http://us3.php.net/manual/en/function.get-cfg-var.php get_cfg_var('cfg_file_path'); -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] turn off the www
now. I am using the following code to turn http into https and get my ssl working. if($HTTP_SERVER_VARS[HTTPS] != on) { $newurl = https://; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI]; header(location: $newurl); } However I set the ssl up on http://mydomain.com not http://www.mydomain.com and it give me a warning which I do not want the users to see. Can I do someting to make any page automatically redirtect as above using https WITHOUT the www in this format https://mydomain.com thanks R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] programatically determining path to php.ini ?
On 6/29/05, gk [EMAIL PROTECTED] wrote: I have not been able to find any way of determining the path to the current php.ini file, programatically, from within a running script. The only hack I can think of is to parse the ouput of phpinfo(). php -r 'system( php -i|grep ini );' Configuration File (php.ini) Path = /etc/php.ini -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] turn off the www
I am using the following code to turn http into https and get my ssl working. if($HTTP_SERVER_VARS[HTTPS] != on) { $newurl = https://; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI]; header(location: $newurl); } $newurl = https://; . ereg_replace(^www., , $_SERVER[SERVER_NAME]).. However I set the ssl up on http://mydomain.com not http://www.mydomain.com and it give me a warning which I do not want the users to see. Can I do someting to make any page automatically redirtect as above using https WITHOUT the www in this format https://mydomain.com thanks R. -- 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] turn off the www
Ross wrote: now. I am using the following code to turn http into https and get my ssl working. if($HTTP_SERVER_VARS[HTTPS] != on) { $newurl = https://; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI]; header(location: $newurl); } However I set the ssl up on http://mydomain.com not http://www.mydomain.com and it give me a warning which I do not want the users to see. Can I do someting to make any page automatically redirtect as above using https WITHOUT the www in this format https://mydomain.com $newurl = https://; . preg_replace ( /^www\./i, , $_SERVER[SERVER_NAME] ) . $_SERVER[REQUEST_URI]; -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] turn off the www
On Wed, 2005-06-29 at 10:57 -0700, Philip Hallstrom wrote: I am using the following code to turn http into https and get my ssl working. if($HTTP_SERVER_VARS[HTTPS] != on) { $newurl = https://; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI]; header(location: $newurl); } $newurl = https://; . ereg_replace(^www., , $_SERVER[SERVER_NAME]).. Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? However I set the ssl up on http://mydomain.com not http://www.mydomain.com and it give me a warning which I do not want the users to see. Can I do someting to make any page automatically redirtect as above using https WITHOUT the www in this format https://mydomain.com thanks R. -- 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] turn off the www
André Medeiros wrote: snip $newurl = https://; . ereg_replace(^www., , $_SERVER[SERVER_NAME]).. Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? /snip If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_ -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] turn off the www
On Wed, 2005-06-29 at 10:57 -0700, Philip Hallstrom wrote: I am using the following code to turn http into https and get my ssl working. if($HTTP_SERVER_VARS[HTTPS] != on) { $newurl = https://; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI]; header(location: $newurl); } $newurl = https://; . ereg_replace(^www., , $_SERVER[SERVER_NAME]).. Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? Only if he can gaurantee that $_SERVER['SERVER_NAME'] *ALWAYS* is prefixed with www. Otherwise he might end up with chost.com instead of aztechost.com... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] turn off the www
Hello André, Wednesday, June 29, 2005, 8:03:00 PM, you wrote: AM Wouldn't AM $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) AM be a _hell_ of a lot faster? Sure.. providing they always link to the page using www.domain.com (and the same goes for anyone else who links to their site) Otherwise it could cause a slight problem, with unfortunate effects if your domain is something like e-sparse.com :) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] turn off the www
Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_ And it could be slower if you avoid sending someone from http://example.com/ to https://ple.com/ by adding a substring check. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: I can't cURL
Hello, on 06/29/2005 01:31 PM Jon said the following: all I am able to get is the login page again. I don't have any idea what to even try since I have never used cURL before. One thing that I know is that by clicking on billing.asp link the server does some stuff and you end up at billing_histories.asp. Does that mean that I should be looing for some sort of GET or POST operation that I am not seeing? I suspect that page needs cookies that are not persistent and so cURL may not be storing them in the cookie files. You may want to try this HTTP client class. It can keep track of collected cookies and does not rely on curl cookie files to preserve cookies. http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] turn off the www
OK OK I got it ;) I just suggested it because I thought he could assume that www. would always be on the string. Either way, I guess _one_ preg_replace is alright. On 6/29/05, Kevin L'Huillier [EMAIL PROTECTED] wrote: Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_ And it could be slower if you avoid sending someone from http://example.com/ to https://ple.com/ by adding a substring check. -- 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] turn off the www
OK OK I got it ;) I just suggested it because I thought he could assume that www. would always be on the string. Either way, I guess _one_ preg_replace is alright. Heh :-) Just for kicks... - randomly prefix www. onto 1324 proper names (dictionary file). 659 end up with www. prefixed. - wrote a script to load them all up into an array, then loop through doing an ereg, substr, and preg. Each block looks like this: reset($ary); $stime = microtime(true); foreach ( $ary as $w ) { $w = ereg_replace(^www\., , $w); } $etime = microtime(true); $ttime = $etime - $stime; print(ereg_replace: $ttime\n); The only differenec being the line in the foreach loop. Ran it several times on a fairly quite box and always got pretty similar results... ereg_replace: 0.0057849884033203 substr: 0.0025739669799805 preg_replace: 0.004335880279541 Anyway... there's some stats for the archive :-) On 6/29/05, Kevin L'Huillier [EMAIL PROTECTED] wrote: Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_ And it could be slower if you avoid sending someone from http://example.com/ to https://ple.com/ by adding a substring check. -- 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] Re: Removing nonlatin characters
Documented research indicate that on Sat, 25 Jun 2005 01:27:13 +0300, Dotan Cohen wrote: I thought that this was another old STFA but marc and google are quiet. I as parsing a bunch of submitted works and some of them have non-latin characters. I know that I once saw in the user-submitted notes in the docs a function for replacing them with o,a,i,e,u but I can't find it. I think that it may have been purged. Can anyone help? I think you mean something like this: function stripAccents($string) { $returnString = strtr($string, 'àáâãäçèéêëìíîïñòóôõöšùúûüýÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖŠÙÚÛÜÝ', 'acnosyACNOSY'); $returnString = str_replace('æ','ae',str_replace('Æ','AE',$returnString)); $returnString = str_replace('ø','oe',str_replace('Ø','OE',$returnString)); $returnString = str_replace('ß','ss',$returnString); return $returnString; } This function is part using code once posted on this list, part my own creation. HTH Rene -- Rene Brehmer aka Metalbunny We have nothing to fear from free speech and free information on the Internet, but pop-up advertising! http://metalbunny.net/ My little mess of things... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] turn off the www
People have fun with the oddest things ;) Anyway, it's a nice reference to have around :) On 6/29/05, Philip Hallstrom [EMAIL PROTECTED] wrote: OK OK I got it ;) I just suggested it because I thought he could assume that www. would always be on the string. Either way, I guess _one_ preg_replace is alright. Heh :-) Just for kicks... - randomly prefix www. onto 1324 proper names (dictionary file). 659 end up with www. prefixed. - wrote a script to load them all up into an array, then loop through doing an ereg, substr, and preg. Each block looks like this: reset($ary); $stime = microtime(true); foreach ( $ary as $w ) { $w = ereg_replace(^www\., , $w); } $etime = microtime(true); $ttime = $etime - $stime; print(ereg_replace: $ttime\n); The only differenec being the line in the foreach loop. Ran it several times on a fairly quite box and always got pretty similar results... ereg_replace: 0.0057849884033203 substr: 0.0025739669799805 preg_replace: 0.004335880279541 Anyway... there's some stats for the archive :-) On 6/29/05, Kevin L'Huillier [EMAIL PROTECTED] wrote: Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_ And it could be slower if you avoid sending someone from http://example.com/ to https://ple.com/ by adding a substring check. -- 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] Zipping on the fly
Thanks for this Philip and Andre! Philip Hallstrom wrote: hi, I'm providing a download script which lets trusted users view a directory and select a file to download; I don't want to store the files zipped on the server. Is there a fast, built-in way to zip the selected file on the fly and let the user download the zipped copy? I looked at php.net/zip and didn't see any... http://marc.theaimsgroup.com/?r=1w=2q=bl=php-generals=zip Read the PHP ZIP Class messages... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Save page as text
Hi, I have page with PHP and Javascript code and I need to a link or bottun in it to save its content to a plain text file. (I'm using an apache server in a machine running Windows 2003, and I want to be able to use this feature in IE 6 and Mozilla 1.7) I saw some information about how to do that with PHP, but I wasn't able to do it. Can some one help me with that? Thanks in advance, Rafael Magrin - Yahoo! Acesso Grátis: Internet rápida e grátis. Instale o discador agora!
Re: [PHP] programatically determining path to php.ini ?
I think this is a better solution than parsing phpinfo() output: realpath( get_cfg_var ( cfg_file_path )); - Greg On Wed, 29 Jun 2005 10:51:27 -0700, Greg Donald [EMAIL PROTECTED] wrote: On 6/29/05, gk [EMAIL PROTECTED] wrote: I have not been able to find any way of determining the path to the current php.ini file, programatically, from within a running script. The only hack I can think of is to parse the ouput of phpinfo(). php -r 'system( php -i|grep ini );' Configuration File (php.ini) Path = /etc/php.ini -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] turn off the www
[top posting out of spite] ;-) I'm guessing that the OP is only dealing with 1 domain? why not... ? // define in a handy config file? define('BASE_DOMAIN', 'yourdomain.com'); if($HTTP_SERVER_VARS['HTTPS'] != 'on') { header('location: https://'.BASE_DOMAIN.$_SERVER[REQUEST_URI]); } ? ...only single quotes for extra speed :-) and no extraneous $newurl var either. John Nichel wrote: Ross wrote: now. I am using the following code to turn http into https and get my ssl working. if($HTTP_SERVER_VARS[HTTPS] != on) { $newurl = https://; . $_SERVER[SERVER_NAME] . $_SERVER[REQUEST_URI]; header(location: $newurl); } However I set the ssl up on http://mydomain.com not http://www.mydomain.com and it give me a warning which I do not want the users to see. Can I do someting to make any page automatically redirtect as above using https WITHOUT the www in this format https://mydomain.com $newurl = https://; . preg_replace ( /^www\./i, , $_SERVER[SERVER_NAME] ) . $_SERVER[REQUEST_URI]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for a pure startup opportunity..OT
hmmm... strange is right. because someone else said it was four hours after i sent that, now it's a day (wow how time flies through email)? i guess i should keep my eyeballs peeled on every piece of e-mail in my box 24 hours a day, this way i won't be over a minute late ;)
[PHP] Achieving 64-bit integers on 32-bit platforms
Hi Folks This 32-bit limitation is haunting me everywhere I turn. Is it possible with PHP (at compile-time if need be) to make it use large (64-bit) integers? I'm asking because I would like to perform operations on large files, and fillesize($filename) is returning an error, even when I use sprintf(%u, filesize($file)) as per the manual for filesize(). I get: Warning: filesize(): Stat failed for FC4-i386-DVD.iso (errno=75 - Value too large for defined data type) Any thoughts/ideas/suggestions? Thanks! Regards, Dan Goodes : Systems Programmer : [EMAIL PROTECTED] Help support PlanetMirror - Australia's largest Internet archive by signing up for PlanetMirror Premium : http://planetmirror.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Achieving 64-bit integers on 32-bit platforms
Hello, on 06/30/2005 01:02 AM Dan Goodes said the following: Hi Folks This 32-bit limitation is haunting me everywhere I turn. Is it possible with PHP (at compile-time if need be) to make it use large (64-bit) integers? I'm asking because I would like to perform operations on large files, and fillesize($filename) is returning an error, even when I use sprintf(%u, filesize($file)) as per the manual for filesize(). I get: Warning: filesize(): Stat failed for FC4-i386-DVD.iso (errno=75 - Value too large for defined data type) Any thoughts/ideas/suggestions? Thanks! No, PHP is not capable of handing files larger than 2GB. You want to file a bug report because other program can handle large files in 32 bit OS. http://bugs.php.net/ -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php