Re: [PHP] Saving session to database
On Thu, May 16, 2013 at 10:43 AM, Lester Caine les...@lsces.co.uk wrote: I'm having a problem with webtrees ... http://webtrees.net/ My copy is running on http://webtrees.lsces.org.uk and you will see that it is throwing an error relating to the session handling. Running Apache 2.2.22, PHP5.4.14, MySQL 5.5.31 ( http://lsces.org.uk/phpinfo.**php http://lsces.org.uk/phpinfo.php ) If I comment out the session_set_save_handler() section of session.php then I can log in and use the site. Have tried reworking that as a SessionHandlerInterface without any success. As far as I can see, the 'write' function of the handler is not being called and while there are various notes about problems with PHP5.4 blocking access to the write and close functions, none of the fixes I have tried have resulted in a working setup. Anybody seen this problem with PHP5.4? http://lsces.org.uk/hg/**webtrees/file/dcf6ff358108/** includes/session.php#l334http://lsces.org.uk/hg/webtrees/file/dcf6ff358108/includes/session.php#l334is the code that seems to be failing. What error do you get? I tried loading the site but it shows up fine. In general, you should post the error message in your email anyway, for two reasons: 1) Most people on this list don't bother to open a (terrible slow) website. 2) Archives, so if anyone after you comes up with the same problem, he will be able to refer to the archives to find his solution. - Matijn
Re: [PHP] php extension about php_stream_fopen_tmpfile()
On Fri, May 10, 2013 at 3:37 AM, Bleakwind bleakw...@gmail.com wrote: I write a php extension. How can I user Zend API do that? where can I find some doc about file_handle-handle ? There's not really a place to ask questions for writing extensions, but most people here will not be able to answer your question, because they only write PHP code. The documentation for the Zend API is freely available from their website. If it is not there, have a look at the source code, the best documentation around for any product. If you still have problems with an extension, the best place to ask would be the PHP internals list, where the PHP devs hang around, but it does probably require more understanding from your side first. ZEND_API zend_op_array *(*org_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); ZEND_API zend_op_array *sead_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) { php_stream *stream; char *data_decode; int data_decode_len; Neither php_stream_write nor fwrite use the int type, use size_t instead. /* ... */ /* Zend API Begin: This unsuccessful */ php_stream *tmpstream; if ((tmpstream = php_stream_fopen_tmpfile()) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to create temporary file. Check permissions in temporary files directory.); php_stream_close(stream); return org_compile_file(file_handle, type TSRMLS_CC); } numbytes = php_stream_write(tmpstream, data_decode, data_decode_len); if (numbytes != data_decode_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Only %d of %d bytes written, possibly out of free disk space, numbytes, data_decode_len); numbytes = -1; } php_stream_rewind(tmpstream); /* Zend API End */ /* C Begin: This is OK */ FILE *tmpstream; tmpstream = tmpfile(); fwrite(data_decode, data_decode_len, 1, tmpstream); rewind(tmpstream); /* C End */ So what happens? You haven't shown us any error, crash, etc? - Matijn
Re: [PHP] A Good OOP Tutorial/Read?
On Fri, May 17, 2013 at 4:04 PM, Tedd Sperling tedd.sperl...@gmail.comwrote: Stuart: You said: An interface does what it says on the tin: it describes an interface that a class can then tell the world it implements. An abstract class provides functionality as well as an interface description. An abstract class cannot be instantiated, it can only be extended. The logging example given by someone earlier in this thread is the most common example given for interfaces. This is where the interface is defined as an API for others to implement and/or use which then enables users to pick and choose the combination of implementations they want to use based on their requirements without needing to change any of the code of either class. I understand the stated differences between abstract and interface. I can cite what the differences are, but I don't see the practical application differences. To me there is no difference between an abstract class (without method declarations) and an interface. However, I view an interface as a statement (a contract) where IF you want someone to use your code you outline the methods you require them to flesh-out in their code -- but I would like to see a simple example of that. I vaguely get the logging example given by Larry, but I'm not good at abstract thinking -- I need a concrete simple example. I tried to create a demo where I had a Toaster Class that contained breadNumber() and toastSetting() methods and then created an interface so my students could use the Toaster, but it didn't really hold up as well as I wanted. So, can anyone give me a simple example where an interface is used so I can easily explain why they are important? Thanks, tedd There are plenty, but they are never required. I see interfaces more as some kind of documentation in PHP code, they have much more advantages in other languages (eg. Java). A good example would be if you build a product that allows plugins to be used. You would create an interface (which requires the functions init, execute and finish for example), and state that any plugin should implement that interface and hese functions. It's the cleaner way of doing things, but it surely would work the same as if you didn't use an interface, and just told in your documentation that a class should have these 3 functions. - Matijn
Re: [PHP] Saving session to database
On Thu, May 16, 2013 at 2:49 PM, Lester Caine les...@lsces.co.uk wrote: Matijn Woudt wrote: On Thu, May 16, 2013 at 10:43 AM, Lester Caine les...@lsces.co.uk mailto:les...@lsces.co.uk wrote: I'm having a problem with webtrees ... http://webtrees.net/ My copy is running on http://webtrees.lsces.org.uk and you will see that it is throwing an error relating to the session handling. Running Apache 2.2.22, PHP5.4.14, MySQL 5.5.31 ( http://lsces.org.uk/phpinfo.__**phphttp://lsces.org.uk/phpinfo.__php http://lsces.org.uk/phpinfo.**php http://lsces.org.uk/phpinfo.php ) If I comment out the session_set_save_handler() section of session.php then I can log in and use the site. Have tried reworking that as a SessionHandlerInterface without any success. As far as I can see, the 'write' function of the handler is not being called and while there are various notes about problems with PHP5.4 blocking access to the write and close functions, none of the fixes I have tried have resulted in a working setup. Anybody seen this problem with PHP5.4? http://lsces.org.uk/hg/__**webtrees/file/dcf6ff358108/__** includes/session.php#l334http://lsces.org.uk/hg/__webtrees/file/dcf6ff358108/__includes/session.php#l334 http://lsces.org.uk/hg/**webtrees/file/dcf6ff358108/** includes/session.php#l334http://lsces.org.uk/hg/webtrees/file/dcf6ff358108/includes/session.php#l334 is the code that seems to be failing. What error do you get? I tried loading the site but it shows up fine. In general, you should post the error message in your email anyway, for two reasons: 1) Most people on this list don't bother to open a (terrible slow) website. 2) Archives, so if anyone after you comes up with the same problem, he will be able to refer to the archives to find his solution. Been working on this most of the morning without success :( Faulty version is back up, and showing all the error messages, but basically ... ERROR 2: session_regenerate_id(): Session object destruction failed 0 Error occurred on in function session_regenerate_id But I think it's the initial session write that is failing ERROR 2: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php5) 0 Error occurred on in function session_write_close But it should be writing to the database not the file directory. It seems to me the session functions are failing, probably due to problems with the database. Have you checked that there actually is a ##session table in your database? You might want to add some debugging code to these functions, to check if errors occur with inserting or retrieving the sessions from the database. - Matijn
Re: [PHP] Saving session to database
On Fri, May 17, 2013 at 8:07 PM, Lester Caine les...@lsces.co.uk wrote: Matijn Woudt wrote: It seems to me the session functions are failing, probably due to problems with the database. Have you checked that there actually is a ##session table in your database? You might want to add some debugging code to these functions, to check if errors occur with inserting or retrieving the sessions from the database. Well past that stage without making any progress. Using the write function outside of the session_set_save_handler() it works perfectly, and then the read can see the saved sessions and can load them. I am convinced that something is wrong with the general setup which is preventing the write and close from firing when it should. I can not trace any attempt to call the write function in the session handling. I'm currently checking out the adodb-session handler which WAS working in PHP5.3 but seems to be showing similar problems in PHP5.4 Well, I'm not sure what would be the problem here, but some general comments: There have been various changes in session handling between 5.3 and 5.4, so most likely it is in there. Check if there are any references to register_shutdown_function, and replace them with session_register_shutdown. Second, check the return value of session_set_save_handler, it is a bad habit not checking return value of a function, just because it works. If that doesn't help, take the session piece out of the big framework, and test it in a separate file. If that also fails, you've got a small piece of code you can post here which will encourage others to have a look at it at their box. - Matijn
Re: [PHP] Moving from mysql functions to mysqli or PDO - which is best?
On Sat, May 18, 2013 at 8:09 PM, dealTek deal...@gmail.com wrote: Hi folks, [post newbie abilities] - I'm attempting to move away from PHP mysql functions to something newer, either mysqli or PDO. I have read various things about them, but I'm curious at this point which would be best to learn for the present and future. I'm usually working on small to medium size projects. I understand that PDO has an extra abstraction layer so it can work with / convert to other databases like oracle and others fairly easily, but some have said that PDO can be a bit slower the MySQLi? So I would really like to hear opinions on the best choices of either MySQLi or PDO. Also I'm also trying to learn OOP, so I'm looking for a very good working PDO and/or mysqli database class - to get started with, that has all the basic needs like UPDATE - INSERT - DELETE - QUERY etc. That would be very helpful. Thanks in advance for your opinions! Hi, Probably some people will say PDO, others will say MySQLi, in general it doesn't really matter, and I think you have named the biggest differences in your mail. So if you're going to stick with MySQL anyway, you can take advantage of the speed with MySQLi. What class are you looking for? MySQLi can be used as a class, and PDO is a class too? - Matijn
Re: [PHP] Question about session_id() and session_start()
On Mon, May 20, 2013 at 5:33 AM, 孟远涛 yuantao.m...@gmail.com wrote: I find the Note in PHP document. http://www.php.net/manual/en/function.session-id.php Note: When using session cookies, specifying an id for session_id() will always send a new cookie when session_start() is called, regardless if the current session id is identical to the one being set. I feel puzzled about this feature. Even if the current session id is identical to the one one being set, session_start will send a new cookie. I want to know why session_start behave in this way. Forgive my poor English. Thanks in advance. You will find the answer in the PHP source code. If you don't want this to happen, check if the current session id matches with the value you want to set it to, and don't set if they match. - Matijn
Re: [PHP] pass parameter via URL
On Mon, May 20, 2013 at 3:17 PM, iccsi inu...@gmail.com wrote: I would like to know how can I pass a parameter via URL using control value on the form. something like myPage.php?MyID=txtMyID.value I can use myPage.php?MyID=1, but cannot use myPage.php?MyID=txtMyID.value. Your help and information is great appreciated, Regards, Iccsi How about just using form action='myPage.php' method='GET'? Put a normal submit button there and you're done (and as a bonus it takes care of character escaping) - Matijn
Re: [PHP] Question about session_id() and session_start()
On Mon, May 20, 2013 at 10:46 PM, David OBrien dgobr...@gmail.com wrote: On Mon, May 20, 2013 at 4:14 PM, Tim Schofield t...@weberpafrica.com wrote: Matijn There are well over half a million lines of source code in PHP. It seems a little unhelpful to tell someone to go and read half a million lines of C when you could just tell them the answer? Thanks Tim Course View Towers, Plot 21 Yusuf Lule Road, Kampala T +256 (0) 312 314 418 M +256 (0) 752 963 325 www.weberpafrica.com Twitter: @TimSchofield2 Blog: http://weberpafrica.blogspot.co.uk On May 20, 2013 6:24 PM, Matijn Woudt tijn...@gmail.com wrote: On Mon, May 20, 2013 at 5:33 AM, 孟远涛 yuantao.m...@gmail.com wrote: I find the Note in PHP document. http://www.php.net/manual/en/function.session-id.php Note: When using session cookies, specifying an id for session_id() will always send a new cookie when session_start() is called, regardless if the current session id is identical to the one being set. I feel puzzled about this feature. Even if the current session id is identical to the one one being set, session_start will send a new cookie. I want to know why session_start behave in this way. Forgive my poor English. Thanks in advance. You will find the answer in the PHP source code. If you don't want this to happen, check if the current session id matches with the value you want to set it to, and don't set if they match. - Matijn I guess it would be to help prevent session hijacks like explained here http://stackoverflow.com/questions/12233406/preventing-session-hijacking How would it help preventing session hijacking if it was sending the a new cookie with the same session id? - Matijn
Re: [PHP] Question about session_id() and session_start()
Op 21 mei 2013 03:59 schreef David OBrien dgobr...@gmail.com het volgende: On May 20, 2013 8:45 PM, Matijn Woudt tijn...@gmail.com wrote: On Mon, May 20, 2013 at 10:46 PM, David OBrien dgobr...@gmail.com wrote: On Mon, May 20, 2013 at 4:14 PM, Tim Schofield t...@weberpafrica.com wrote: Matijn There are well over half a million lines of source code in PHP. It seems a little unhelpful to tell someone to go and read half a million lines of C when you could just tell them the answer? Thanks Tim Course View Towers, Plot 21 Yusuf Lule Road, Kampala T +256 (0) 312 314 418 M +256 (0) 752 963 325 www.weberpafrica.com Twitter: @TimSchofield2 Blog: http://weberpafrica.blogspot.co.uk On May 20, 2013 6:24 PM, Matijn Woudt tijn...@gmail.com wrote: On Mon, May 20, 2013 at 5:33 AM, 孟远涛 yuantao.m...@gmail.com wrote: I find the Note in PHP document. http://www.php.net/manual/en/function.session-id.php Note: When using session cookies, specifying an id for session_id() will always send a new cookie when session_start() is called, regardless if the current session id is identical to the one being set. I feel puzzled about this feature. Even if the current session id is identical to the one one being set, session_start will send a new cookie. I want to know why session_start behave in this way. Forgive my poor English. Thanks in advance. You will find the answer in the PHP source code. If you don't want this to happen, check if the current session id matches with the value you want to set it to, and don't set if they match. - Matijn I guess it would be to help prevent session hijacks like explained here http://stackoverflow.com/questions/12233406/preventing-session-hijacking How would it help preventing session hijacking if it was sending the a new cookie with the same session id? - Matijn I was thinking if I was sitting in a cafe and someone was sniffing and tried to use my session info they would get a new session id where I would still have my original one so they wouldn't be able to hijack mine trying to reuse the same id I have since php would generate a new one No? If you read the original question correctly, it's about a *new cookie* with the *same session id*. Second, if somebody is sniffing you he would also be able to grab the new session id, and yours (old and new one) will be useless if he uses the new session id before you do. Avoiding session hijacking is not that easy, it's much easier to just use an SSL connection. At least that protects you from someone sniffing on a public wifi, but it does not help against sniffing viruses, malicious browser extensions or cross site scripting attacks. Since it's off topic, I'll end here. If you want to learn more, Google is your best friend! - Matijn
Re: [PHP] Simple objective which always seems to make me think I'm doing it wrong.
On Thu, May 23, 2013 at 4:54 PM, Richard Quadling rquadl...@gmail.comwrote: Hi. I'm building an XML file. It is within an OOP structure and is pretty simple. The method is ... snip Nothing particularly difficult to understand, but I just don't like having the XML embedded this way. Ideally, I want a scope aware include function, so I can say _something_ like ... $s_XML = require_once __CLASS__ . DIRECTORY_SEPARATOR . 'normalisedError.xml'; and have the include be aware of the local scope (so $o_XML and $this are all happy). I know I can write a template parser, but I'm just missing an obvious solution that isn't fat and doesn't require a massive learning for the other devs. Ideas? Thanks for reading. Richard. What is wrong with the require_once? I don't see why it would not work. - Matijn
Re: [PHP] json_decode mistery
On Fri, May 24, 2013 at 9:06 AM, Radek Krejča radek.kre...@starnet.czwrote: Hello, I am usin json regulary, but in one script I have mistery: echo($decrypted_data).\n\n; var_dump(json_decode($decrypted_data, true)); echo \n; var_dump(json_decode('{result_ok:true,result_message:null,client_name:Radek Krej\u010da}', true)); I got: {result_ok:true,result_message:null,client_name:Radek Krej\u010da} NULL array(3) { [result_ok]= bool(true) [result_message]= NULL [client_name]= a } string(13) Radek KrejÄ You can see, that in $decrypted_data, is stored valid (by my opinion) json data. If I use this variable in json_decode, I got null. And if I manualy use data displayed on screen, I got valid array. Where I do mistake? If I remove client_name (so no utf8 is in json data), situation is the same. Radek Hi, It could be there are NUL-bytes or other unprintable ASCII characters in the original $decrypted_data. Try this: var_dump(json_encode($decrypted_data)); Yes, json_encode, as it will show \u or any other low unicode value. - Matijn
Re: [PHP] Re: need some regex help to strip out // comments but not http:// urls
On Wed, May 29, 2013 at 6:08 PM, Sean Greenslade zootboys...@gmail.comwrote: On Wed, May 29, 2013 at 9:57 AM, Jonesy gm...@jonz.net wrote: On Tue, 28 May 2013 14:17:06 -0700, Daevid Vincent wrote: I'm adding some minification to our cache.class.php and am running into an edge case that is causing me grief. I want to remove all comments of the // variety, HOWEVER I don't want to remove URLs... KISS. To make it simple, straight-forward, and understandable next year when I have to re-read what I've written: I'd change all :// to QqQ -- or any unlikely text string. Then I'd do whatever needs to be done to the // occurances. Finally, I'd change all QqQ back to ://. Jonesy Wow. This is just a spectacularly bad suggestion. First off, this task is probably a bit beyond the capabilities of a regex. Yes, you may be able to come up with something that works 99% of the time, but this is really a job for a parser of some sort. I'm sorry I don't have any suggestions on exactly where to go with that, however I'm sure Google can be of assistance. The main problem is that regex doesn't understand context. It just blindly finds patterns. A parser understands context, and can figure out which //'s are comments and which are something else. As a bonus, it can probably understand other forms of comments like /* */, which regex would completely die on. It is possible to write a whole parser as a single regex, being it terribly long and complex. That said, there's no other simple syntax that would work, for example in javascript you could to the following: var http = 5; switch(value) { case http:// Http case here! (this whould not be deleted) // Do something } But most likely you wouldn't care about that.. - Matijn
Re: [PHP] Re: need some regex help to strip out // comments but not http:// urls
On Wed, May 29, 2013 at 7:27 PM, Sean Greenslade zootboys...@gmail.comwrote: It is possible to write a whole parser as a single regex, being it terribly long and complex. That said, there's no other simple syntax that would work, for example in javascript you could to the following: var http = 5; switch(value) { case http:// Http case here! (this whould not be deleted) // Do something } But most likely you wouldn't care about that.. - Matijn I would have to disagree. There are things that regex just can't at a fundamental level grok. Things like nested brackets (e.g. the standard blocking syntax of C, javascript, php, etc.). It's not a parser, and despite all the little lookahead/behind tricks that enhanced regex can do, it can't at a fundamental level _interret_ the text it sees. This task involves interpreting what the text you're looking for actually means, and should therefore be handled by something that can interpret. I think it should be possible, but as I said, very very complex. Let's not try it;) Also, (I haven't tested it, but) I don't think that example you gave would work. Without any sort of quoting around the http://; , I would assume the JS interpreter would take that double slash as a comment starter. Do tell me if I'm wrong, though. Which is exactly what I meant. Because http is a var set to 5, it is a valid case statement, it would be equal to: switch(value) { case 5: // Http case here! (this whould not be deleted) // Do something } But any regex given above would treat the first one as a http url, and won't strip the // and everything after it, though in this modified case it will strip the comments. - Matijn
Re: [PHP] Re: need some regex help to strip out // comments but not http:// urls
On Wed, May 29, 2013 at 10:51 PM, Sebastian Krebs krebs@gmail.comwrote: 2013/5/29 Matijn Woudt tijn...@gmail.com On Wed, May 29, 2013 at 6:08 PM, Sean Greenslade zootboys...@gmail.com wrote: On Wed, May 29, 2013 at 9:57 AM, Jonesy gm...@jonz.net wrote: On Tue, 28 May 2013 14:17:06 -0700, Daevid Vincent wrote: I'm adding some minification to our cache.class.php and am running into an edge case that is causing me grief. I want to remove all comments of the // variety, HOWEVER I don't want to remove URLs... KISS. To make it simple, straight-forward, and understandable next year when I have to re-read what I've written: I'd change all :// to QqQ -- or any unlikely text string. Then I'd do whatever needs to be done to the // occurances. Finally, I'd change all QqQ back to ://. Jonesy Wow. This is just a spectacularly bad suggestion. First off, this task is probably a bit beyond the capabilities of a regex. Yes, you may be able to come up with something that works 99% of the time, but this is really a job for a parser of some sort. I'm sorry I don't have any suggestions on exactly where to go with that, however I'm sure Google can be of assistance. The main problem is that regex doesn't understand context. It just blindly finds patterns. A parser understands context, and can figure out which //'s are comments and which are something else. As a bonus, it can probably understand other forms of comments like /* */, which regex would completely die on. It is possible to write a whole parser as a single regex, being it terribly long and complex. No, it isn't. It's better if you throw some smart words on the screen if you want to convince someone. Just thinking about it, it makes sense as a true regular expression can only describe a regular language, and I think all the programming languages are not regular languages. But, We have PHP PCRE with extensions like Recursive patterns[1] and Back references[2], which can describe much more than just a regular language. And I do believe it would be able to handle it. Too bad it probably takes months to complete a regular expression like this. - Matijn [1] http://php.net/manual/en/regexp.reference.recursive.php [2] http://php.net/manual/en/regexp.reference.back-references.php
Re: [PHP] REQUEST
On Wed, May 29, 2013 at 8:56 PM, Stuart Dallas stu...@3ft9.com wrote: [On which note it has to be said he clearly isn't since he couldn't get lasthacker@ and had to settle for lasthacker1@. Just sayin'.] -Stuart I'm surprised he didn't call himself la5T hax0R alwayZ 0nP01nT :)
Re: [PHP] browser rendering
On Sun, Jun 2, 2013 at 3:09 PM, georg georg.chamb...@telia.com wrote: Possibly this issue is for other fora, which you might direct me, anyways; I have been dablling making my own little webpages, however having gotten a nice result jon fireforx, I realize picture sizes gets treated very differntly on different browsers !!! so the looks of the pages get very strange from smaller (Opera) and much bigger (Explorer) brower !!! any hints for mitigation ? br georg Code? It could also be something with the parent element. - Matijn
Re: [PHP] Seemingly incorrect strict standard.
On Mon, Jun 3, 2013 at 7:24 PM, Richard Quadling rquadl...@gmail.comwrote: Hi. I've got an abstract class which requires one of the concrete descendants to implement a static function. The base class will call it using static:: rather than self::. But I'm getting an error at runtime. Static function should not be abstract. It doesn't SEEM right to inhibit this. Am I missing something? I'm on PHP 5.4.15 (Mac and Centos). Hi Richard, This change is done on purpose. From the PHP manual: Dropped abstract static class functions. Due to an oversight, PHP 5.0.x and 5.1.x allowed abstract static functions in classes. As of PHP 5.2.x, only interfaces can have them. I believe you could make yourself in trouble when using it, and that's why there is a warning with strict. It does make sense, because overloading is something that works on classes, and static functions do not reference classes. - Matijn
Re: [PHP] htaccess to make html act as php suffixed files
On Tue, Jun 11, 2013 at 7:17 PM, Stuart Dallas stu...@3ft9.com wrote: On 11 Jun 2013, at 18:16, Tedd Sperling t...@sperling.com wrote: Hi gang: To get html pages to use php scripts, I've used: RewriteEngine on # handler for phpsuexec. -- this makes these prefixes considered for php FilesMatch \.(htm|html)$ SetHandler application/x-httpd-php /FilesMatch In a .htaccess file. However, it works on one site, but not on another -- any ideas as to why? At a rough guess there's an AllowOverride line in the main Apache config that's restricting what you can do in the .htaccess file. Or the .htaccess usage is not enabled at all in that site.
Re: [PHP] Enabling the chroot() function in PHP 5.4
Hi Aaron, It's better if you ask this question on the PHP internals list, there's hardly anyone compiling it's own PHP here. - Matijn On Thu, Jun 13, 2013 at 9:55 AM, Aaron Stephens aaron.t.steph...@gmail.comwrote: Hi All, Does anybody know how to enable the chroot() function in PHP 5.4? It was easy in PHP 5.3 as long as you were building the CLI by itself. In the PHP 5.4 configure script there is a new PHP_BINARIES variable being used instead of setting PHP_SAPI=cli and thus the #define ENABLE_CHROOT_FUNC 1 is never written to the output file. I have been able to manually enable it by adding the define to the main/php_config.h after running configure. The issue seems to be a line: if test program = program. This comparison being true is what causes the configure script to add cli to the PHP_BINARIES variable instead of setting the PHP_SAPI variable. The other prerequisites (HAVE_CHROOT and ZTS) are all at the required settings. It is only the ENABLE_CHROOT_FUNC which is causing the function to not be compiled into the resulting binary. Any information or explanation would be very helpful. For the record, I know what the chroot() function does and does not do. I am experimenting with using chroot() to isolate an already running script to a particular subset of the filesystem for file operations. -- - Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detect and Redirect Mobile Users
On Thu, Jun 13, 2013 at 3:17 AM, Paul M Foster pa...@quillandmouse.comwrote: On Wed, Jun 12, 2013 at 04:19:50PM -0700, dealTek wrote: Hi all, I'm curious of a simple, common, universal way to detect a mobile user so I can redirect them to a mobile directory... What is best for this: Javascript - CSS - PHP? I think for my purposes if I can detect screen size or mobile browser agent - that would be good enough for what I need right now. This is not really a PHP question. I understand your asking it, though. Does anyone know of a better list or whatever for generic web designer questions? To your question, there are two problems: 1) Looking for a browser signature is a needle/haystack proposition, and the haystack is enormous, and it gets bigger every time a new phone/tablet model comes out; 2) Screen size used to be a good indicator, but as I feared when people first started using screen resolution as the main indicator, the screens on mobile devices have become progressively more and more capable. Some of them are better than many desktops I've seen. So I'd be interested in the answer to the question myself. Paul HI, Even though the list gets bigger, there aren't that many mobile operating systems. Any Android device will have Android in it's user agent, and iPhone as iPhone in the User Agent string. If you want to check for tablets, you can check for iPad specifically (it is in the user agent), and for Android, I believe that mobile devices have 'Mobile' in the user agent string, and tablets don't. Then there is ofcourse the small 1 percent or so Blackberry WP users, which can probably be detected easily too with their user agent. Cheers, Matijn
Re: [PHP] Detect and Redirect Mobile Users
On Thu, Jun 13, 2013 at 3:20 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Jun 13, 2013 at 3:17 AM, Paul M Foster pa...@quillandmouse.comwrote: On Wed, Jun 12, 2013 at 04:19:50PM -0700, dealTek wrote: Hi all, I'm curious of a simple, common, universal way to detect a mobile user so I can redirect them to a mobile directory... What is best for this: Javascript - CSS - PHP? I think for my purposes if I can detect screen size or mobile browser agent - that would be good enough for what I need right now. This is not really a PHP question. I understand your asking it, though. Does anyone know of a better list or whatever for generic web designer questions? To your question, there are two problems: 1) Looking for a browser signature is a needle/haystack proposition, and the haystack is enormous, and it gets bigger every time a new phone/tablet model comes out; 2) Screen size used to be a good indicator, but as I feared when people first started using screen resolution as the main indicator, the screens on mobile devices have become progressively more and more capable. Some of them are better than many desktops I've seen. So I'd be interested in the answer to the question myself. Paul HI, Even though the list gets bigger, there aren't that many mobile operating systems. Any Android device will have Android in it's user agent, and iPhone as iPhone in the User Agent string. If you want to check for tablets, you can check for iPad specifically (it is in the user agent), and for Android, I believe that mobile devices have 'Mobile' in the user agent string, and tablets don't. Then there is ofcourse the small 1 percent or so Blackberry WP users, which can probably be detected easily too with their user agent. Cheers, Matijn I forgot to mention, in PHP the user agent string is in $_SERVER['HTTP_USER_AGENT'], and in javascript you can find it in navigator.userAgent. Where you want to redirect, it's up to you. If you want it to do on first attempt, better go with PHP so you can use Header(Location: ...) to redirect the user immediately so the user won't notice he is being redirected.
Re: AW: [PHP] PHP is Zero
On Thu, Jun 13, 2013 at 1:49 PM, BUSCHKE Daniel daniel.busc...@nextiraone.eu wrote: To be more technical: If intval('8315e839da08e2a7afe6dd12ec58245d') would return NULL instead of 8315 then PHP would be still weak-typed and the developer could know that the conversion failed. Good idea? Of course NULL should be transparent in operations like +. So 0 + NULL should be still 0. Regards Daniel It would just break too much. I see lots of scripts that have things like this: $var = '12 beers'; echo $var + 4; and they expect it to be 16 of course. Or what about badly trimmed strings, when reading from a file it can include extra line endings and it's so much easier to just ignore that because PHP will convert it just fine. - Matijn
Re: [PHP] A Strange Problem
On Thu, Jun 20, 2013 at 7:39 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: I have a very strange problem. I can use this statement in one folder: $fcontents = file('docs/admin-email.txt'); But in a different folder with an exact path having 'docs/admin-email.txt', I get: Warning: file(/docs/admin-email.txt) [function.file]: failed to open stream: No such file or directory in cut on line 83 Are you sure it is the same string? It looks like this one has an extra '/' at the beginning? This has got me really puzzled. I have confirmed these are the exact same folders and files, except only in two different places on the server. Both are one level down from root. Any ideas as to what is going on? Cheers, tedd Else it could be permission item, I think the user executing the PHP script (www-user or such for apache), needs to have execute rights on all directories up to the file, to be able to read the file listing. - Matijn
Re: [PHP] Reseting the auto-increment number in a MySQL database.
On Wed, Jun 26, 2013 at 7:35 PM, Tedd Sperling tedd.sperl...@gmail.comwrote: On Jun 26, 2013, at 1:32 PM, Jim Giner jim.gi...@albanyhandball.com wrote: But more importantly - don't you need to figure out why it happened?? As well as correcting any inserts with the bogus id? Yes, I would like to know -- I'm open for suggestions. Cheers, tedd _ tedd.sperl...@gmail.com http://sperling.com What storage engine are you using? InnoDB is known for it's auto increment holes, but I didn't expect the holes to be that big. - Matijn
Re: [PHP] strlen ?
On Fri, Jul 5, 2013 at 8:33 PM, Jim Giner jim.gi...@albanyhandball.comwrote: On 7/5/2013 1:32 PM, shiplu wrote: On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner jim.gi...@albanyhandball.com **wrote: Mike Hall comes back as 10, not 9 F.B. comes back as 5, not 4. Doesn't work for me. php var_dump(Mike Hall, strlen(Mike Hall)); string(9) Mike Hall int(9) Try trimming it first and then apply strlen. Why would I need to trim something that I can already see doesn't have any trailing or leading characters? Because there are characters you can't see?
Re: [PHP] strlen ?
On Fri, Jul 5, 2013 at 8:39 PM, Jim Giner jim.gi...@albanyhandball.comwrote: I checked them in the db manually. Clicked on the name, selected it, no extra space highlighted. Cursored through the length of the value - no extra movements. That does still not guarantee there are no extra characters. Some characters are just not visible (NUL, CR, LF, ..) On 7/5/2013 2:36 PM, Matijn Woudt wrote: On Fri, Jul 5, 2013 at 8:33 PM, Jim Giner jim.gi...@albanyhandball.comwrote: On 7/5/2013 1:32 PM, shiplu wrote: On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner jim.gi...@albanyhandball.com wrote: Mike Hall comes back as 10, not 9 F.B. comes back as 5, not 4. Doesn't work for me. php var_dump(Mike Hall, strlen(Mike Hall)); string(9) Mike Hall int(9) Try trimming it first and then apply strlen. Why would I need to trim something that I can already see doesn't have any trailing or leading characters? Because there are characters you can't see?
Re: [PHP] mongo usage
On Sat, Jul 6, 2013 at 9:16 PM, Tim Dunphy bluethu...@gmail.com wrote: | You commented out the setting of yhe addresses variable Those were both equivalent ways of stating the same thing. I tried substituting the other statement but there was no change: $db = $connection-jfdb; //$collection = $db-addresses; $adresses = $connection-jfdb-adresses; Thanks again! You seem to spell the variable differently (1 'd' vs. 2 'd's)? - Matijn
Re: [PHP] Query regarding temporarily-uploaded files
On Wed, Jul 10, 2013 at 7:21 PM, Ajay Garg ajaygargn...@gmail.com wrote: Hi all. I have a requirement, wherein I need to allow vanilla uploads of files to a HTTPD server. Any client can upload any number of files (one at a time). Also, there is just one directory, where the files get stored finally (that is, after being copied from the temporary location, via move_uploaded_file) Also, I have been able to get the simple file uploading running via PHP, by picking up one of the numerous Hello World examples available :) Now, I am facing the following use-case :: 1) User 1 starts uploading a large file, say big_file.avi. 2) Meanwhile, user 2 also starts uploading a (different) file, but with the same name big_file.avi. In an ideal scenario, user 2 should be prompted with a message, that a file of the same name is already being uploaded by someone else somewhere. Is there a way to do this? ( Note that, had the user 2 started uploading AFTER user 1 had finished with the upload, we could probably modify the PHP-script at the sever-side, to let user-2 know that a file of the same name already exits. But I am failing to find a solution, when the user 2 starts the upload WHILE the large file of user 1 is in the process of completing uploading). Any way the issue may be solved? I will be grateful for any pointers :) Regards, Ajay Hi, This is not possible with PHP, PHP will not know about the file until the upload is completed. You can use HTML5 or flash(not recommended) for an alternative way of uploading, and then you can check the file name in advance. - Matijn
Re: [PHP] strip_tags
Op 21 jul. 2013 02:53 schreef Tedd Sperling t...@sperling.com het volgende: On Jul 20, 2013, at 5:34 PM, Frank Arensmeier farensme...@gmail.com wrote: 20 jul 2013 kl. 18:25 skrev Tedd Sperling t...@sperling.com: Hi gang: I've been using $str = strip_tags($str, $allowable) as it is described via the manuals: http://php.net/manual/en/function.strip-tags.php The problem I've found is the tags br and br / are not stripped. How do you strip all tags, but leave some tags (such as b, i, and u -- I know these are depreciated, but my client wants them anyway). From the manual: allowable_tags You can use the optional second parameter to specify tags which should not be stripped. Note: HTML comments and PHP tags are also stripped. This is hardcoded and can not be changed with allowable_tags. Note: This parameter should not contain whitespace. strip_tags() sees a tag as a case-insensitive string between and the first whitespace or . It means that strip_tags(br/, br) returns an empty string. It's all there… ;-) Cheers, /frank Yeah, but that wasn't the problem -- it was my mistake in coding. In any event, I figured it out. tedd Could you perhaps post what the problem was so that when someone searches for it they will have the answer right here? - Matijn
Re: [PHP] /tmp/directory
On Mon, Jul 22, 2013 at 5:20 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? Cheers, tedd Switch host? /tmp is required by the FHS and POSIX standards (writable for any user), any host changing that should have no customers. - Matijn
Re: [PHP] What wrong am I doing now?
On Wed, Jul 24, 2013 at 2:19 PM, Karl-Arne Gjersøyen karlar...@gmail.comwrote: mysql SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC; +---+ | DATE_FORMAT(dato, '%e-%c-%Y') | +---+ | 24-7-2013 | | 23-7-2013 | +---+ 2 rows in set (0.00 sec) mysql // My PHP code looks like this. // - $sql = SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC; $resultat = mysql_query($sql, $tilkobling) or die(mysql_error()); while($rad = mysql_fetch_array($resultat)){ $dato = $rad['dato']; $rad['dato'] probably doesn't exist because you used DATE_FORMAT. Either use $rad[0], or use the following SQL: $sql = SELECT DATE_FORMAT(dato, '%e-%c-%Y') AS dato FROM transportdokument WHERE dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC; Regards, Matijn
Re: [PHP] Re: What wrong am I doing now?
On Wed, Jul 24, 2013 at 2:45 PM, Jim Giner jim.gi...@albanyhandball.comwrote: On 7/24/2013 8:19 AM, Karl-Arne Gjersøyen wrote: mysql SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC; +-**--+ | DATE_FORMAT(dato, '%e-%c-%Y') | +-**--+ | 24-7-2013 | | 23-7-2013 | +-**--+ 2 rows in set (0.00 sec) mysql // My PHP code looks like this. // --**--- $sql = SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC; $resultat = mysql_query($sql, $tilkobling) or die(mysql_error()); while($rad = mysql_fetch_array($resultat)){ $dato = $rad['dato']; var_dump($dato); I gott NULL,NULL here and believe it is something with my PHP Source that is wrong when using DATE_FORMAT. As you see above it work in terminal. I hope this not is off-topic for the list. If so, I am sorry for it and hope you can give me advice about a good MySQL list for newbie's. Thanks again for your help! Karl Add a check on the query result to be sure your query actually ran. $resultat = mysql_query($sql, $tilkobling) or die(mysql_error()); if (!$resultat) { echo Query failed to run - .mysql_error(); exit(); } while($rad = mysql_fetch_array($resultat)){ ... Jim, He already has that... - Matijn
Re: [PHP] Quick Q.
On Wed, Jul 24, 2013 at 10:45 PM, Richard Quadling rquadl...@gmail.comwrote: PHP 5.5+ is (from news) - Windows XP and 2003 support dropped. Does that mean no longer executes (as is seemingly what I'm seeing) or just no longer supported/developed? Just going to look into getting to the bottom of the CHM build issues and only have an XP license of Windows. Will drop back to PHP 5.4 to see if that's OK on the VM I have. Hi, It is only no longer supported/developed. It probably will compile fine on it for a long time, though some new features might not. It probably also means they are not going to test on XP/2003 anymore, and will not respond to bugs related to these operating systems. - Matijn
Re: [PHP] Quick Q.
On Wed, Jul 24, 2013 at 10:59 PM, Richard Quadling rquadl...@gmail.comwrote: On 24 July 2013 21:54, Matijn Woudt tijn...@gmail.com wrote: On Wed, Jul 24, 2013 at 10:45 PM, Richard Quadling rquadl...@gmail.comwrote: PHP 5.5+ is (from news) - Windows XP and 2003 support dropped. Does that mean no longer executes (as is seemingly what I'm seeing) or just no longer supported/developed? Just going to look into getting to the bottom of the CHM build issues and only have an XP license of Windows. Will drop back to PHP 5.4 to see if that's OK on the VM I have. Hi, It is only no longer supported/developed. It probably will compile fine on it for a long time, though some new features might not. It probably also means they are not going to test on XP/2003 anymore, and will not respond to bugs related to these operating systems. - Matijn From what I can see, PHP V5.5.1 (just downloaded onto a clean VM) fails to execute. But V5.4.17 works fine. -- Richard Quadling Twitter : @RQuadling The precompiled version indeed does not work on XP/2003, but I think you can still compile it yourself for windows XP. - Matijn
Re: [PHP] Sending headers to server
On Thu, Aug 1, 2013 at 4:04 PM, Miguel Guedes miguel.a.gue...@gmail.comwrote: Hello List, I'm running PHP 5.4.9 as CGI (via apache 2.2.22) and can't seem to be able to send headers to the server. Both, header('Status: 500 Internal Server Error'); and, header('HTTP/1.1 500 Internal Server Error', true, 500); result in nothing happening on the client side. What am I missing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Did you print some data before using header? - Matijn
Re: [PHP] Sending headers to server
On Sat, Aug 3, 2013 at 11:46 AM, Karim Geiger gei...@b1-systems.de wrote: Am 02.08.13 18:03, schrieb Miguel Guedes: This is strange. I've just found out that the headers are sent correctly if I access the website outside of localhost. I don't understand why. I also don't. I've tried the exactly same code you posted on my localhost as well and it worked all properly. Weird behaviour, can anyone explain why this happens? Regards Karim Could it be that you're actually ending up with a different site because you have configured your vhost to a certain domain? - Matijn
Re: [PHP] how to see all sessions sets in server
On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee farzan.dal...@gmail.comwrote: hi i want to write online user module for my site and i want to check $_SESSION['userID'] to find all users id who loged in but when i echo this code its return only current user detail how i can see all sessions? foreach($_SESSION as $k = $v) { echo $k.--.$v; } or how i handle online users? You can only access sessions when you know the session id. Most sites handle online users in their database, store a timestamp each time a user loads a page. When you want to display the online users, check where the timestamp is between now and a few minutes ago. Note that without javascript (or flash/java/etc) there is no way to truly know if the user left or not. The session will stay active for a long time, depending on your php.ini settings. - Matijn
Re: [PHP] how to see all sessions sets in server
On Sun, Aug 4, 2013 at 4:00 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: Farzan Dalaee farzan.dal...@gmail.com wrote: On Sun, 2013-08-04 at 14:56 +0430, Farzan Dalaee wrote: You mean when user logged in i add new record to table and when logged out i delete the row? So if user close the browser without logout how can i find user is online or not? Sent from my iPhone On Aug 4, 2013, at 14:44, Matijn Woudt tijn...@gmail.com wrote: On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee farzan.dal...@gmail.com wrote: hi i want to write online user module for my site and i want to check $_SESSION['userID'] to find all users id who loged in but when i echo this code its return only current user detail how i can see all sessions? foreach($_SESSION as $k = $v) { echo $k.--.$v; } or how i handle online users? You can only access sessions when you know the session id. Most sites handle online users in their database, store a timestamp each time a user loads a page. When you want to display the online users, check where the timestamp is between now and a few minutes ago. Note that without javascript (or flash/java/etc) there is no way to truly know if the user left or not. The session will stay active for a long time, depending on your php.ini settings. - Matijn Like Matijn said, unless you're using some kind of client-side method to continually poll the server, you can't know if they've just closed their browser. There are Javascript events for exiting a page, but they don't work correctly on Safari and iOS Safari. You don't have to actually save anything to the DB manually, just instruct PHP to use the DB for its own sessions, rather than files. Do you really need to inspect each visitors session in detail, or do you just need a way to determine how many unique visitors are on the site at any one time? Thanks, Ash http://www.ashleysheridan.co.uk I need to inspect each visitor to show how online or who offline for chat Like facebook chat Ah, so you don't need to see the details of the sessions then. Facebook does this (badly) by using javascript on the client side which triggers an update of a timestamp on the server, which then allows you to determine who is online (or was within a given time limit) Thanks, Ash Maybe it's bad, but there's no good alternative, except sending ping requests to your server every second or so, but any site as large as Facebook will DDOS itself when using things like that ;) - Matijn
Re: [PHP] Finally....
On Fri, Aug 16, 2013 at 5:23 PM, Daniel Brown danbr...@php.net wrote: # ezmlm-list ~ezmlm/php-general | grep skynet supp...@skynet.be # ezmlm-unsub ~ezmlm/php-general supp...@skynet.be # ezmlm-list ~ezmlm/php-general | grep skynet # No more of those Your e-mail concerning our products and services autoreplies from the Belgacom Webteam. Sorry it took me this long to realize it and get around to it. Happy Friday. Daniel, Thank you, thank you, thank you ;)
Re: [PHP] How can I submit more than 2000 items of data?
On Mon, Aug 19, 2013 at 11:54 AM, Stuart Dallas stu...@3ft9.com wrote: On 19 Aug 2013, at 10:49, aesbovis aesbo...@gmail.com wrote: I know Javascript can solve it, but I don't want to use Js. Thank you all the same. I know you've had the right answer, but I think it's worth pointing out that use of JSON in no way requires Javascript, despite its name. -Stuart You might want to explain how you convert form data to JSON without javascript?
Re: [PHP] How can I submit more than 2000 items of data?
On Mon, Aug 19, 2013 at 5:20 PM, Stuart Dallas stu...@3ft9.com wrote: On 19 Aug 2013, at 15:56, Matijn Woudt tijn...@gmail.com wrote: On Mon, Aug 19, 2013 at 11:54 AM, Stuart Dallas stu...@3ft9.com wrote: On 19 Aug 2013, at 10:49, aesbovis aesbo...@gmail.com wrote: I know Javascript can solve it, but I don't want to use Js. Thank you all the same. I know you've had the right answer, but I think it's worth pointing out that use of JSON in no way requires Javascript, despite its name. -Stuart You might want to explain how you convert form data to JSON without javascript? PHP can do it. Ruby can do it. .NET can do it. Just because you want to use JSON in a web browser where Javascript is the go-to method, doesn't mean JSON requires Javascript. -Stuart Yes, of course they can do it, but then you first need to submit the POST data (which he could not do because of the above). Javascript is more or less the only way to do it (yes I know Flash)
Re: [PHP] Mysqli Extension
On Mon, Aug 19, 2013 at 8:02 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote: Dear List - My mysqli extension seems to have gone away. $host = 'localhost'; $user = 'root'; $password = 'SdR3908'; echo hello2br /; var_dump(function_exists('**mysqli_connect'));// this returns boo(false) $db = 'Store'; $cxn = mysqli_connect($host,$user,$**password,$db); I tried to reinstall - rosenberg:/home/ethan# apt-get install php5-common libapache2-mod-php5 php5-cli Reading package lists... Done Building dependency tree Reading state information... Done libapache2-mod-php5 is already the newest version. libapache2-mod-php5 set to manually installed. php5-cli is already the newest version. php5-cli set to manually installed. php5-common is already the newest version. php5-common set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. It did not help. TIA Ethan apt-get install php5-mysql If that doesn't help, there's something wrong with your configuration of the modules. - Matijn
Re: [PHP] Mysqli Extension
On Mon, Aug 19, 2013 at 8:55 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: Curtis Maurand cur...@maurand.com wrote: Ethan Rosenberg wrote: Dear List - My mysqli extension seems to have gone away. $host = 'localhost'; $user = 'root'; $password = 'SdR3908'; echo hello2br /; var_dump(function_exists('mysqli_connect'));// this returns boo(false) $db = 'Store'; $cxn = mysqli_connect($host,$user,$password,$db); I tried to reinstall - rosenberg:/home/ethan# apt-get install php5-common libapache2-mod-php5 php5-cli Reading package lists... Done Building dependency tree Reading state information... Done libapache2-mod-php5 is already the newest version. libapache2-mod-php5 set to manually installed. php5-cli is already the newest version. php5-cli set to manually installed. php5-common is already the newest version. php5-common set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. It did not help. TIA Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Found this in ubuntu forums. http://ubuntuforums.org/showthread.php?t=1814736 sudo apt-get install php5-mysql This package contains the PHP module that interfaces with the MySQL server. Could it be that the mysql service on the server has stopped. Typically you'd do something like this on RedHat/Fedora servers: service mysqld status That would certainly stop the extension working from within PHP. Thanks, Ash I'm sorry, but this is just plain wrong. The extension has nothing to do with the mysql service. In fact, a lot of the larger websites have their database service running at a different server, and probably don't even have the mysql service installed. - Matijn
Re: [PHP] Mysqli Extension
On Mon, Aug 19, 2013 at 9:40 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: Matijn Woudt tijn...@gmail.com wrote: On Mon, Aug 19, 2013 at 8:55 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: Curtis Maurand cur...@maurand.com wrote: Ethan Rosenberg wrote: Dear List - My mysqli extension seems to have gone away. $host = 'localhost'; $user = 'root'; $password = 'SdR3908'; echo hello2br /; var_dump(function_exists('mysqli_connect'));// this returns boo(false) $db = 'Store'; $cxn = mysqli_connect($host,$user,$password,$db); I tried to reinstall - rosenberg:/home/ethan# apt-get install php5-common libapache2-mod-php5 php5-cli Reading package lists... Done Building dependency tree Reading state information... Done libapache2-mod-php5 is already the newest version. libapache2-mod-php5 set to manually installed. php5-cli is already the newest version. php5-cli set to manually installed. php5-common is already the newest version. php5-common set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. It did not help. TIA Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Found this in ubuntu forums. http://ubuntuforums.org/showthread.php?t=1814736 sudo apt-get install php5-mysql This package contains the PHP module that interfaces with the MySQL server. Could it be that the mysql service on the server has stopped. Typically you'd do something like this on RedHat/Fedora servers: service mysqld status That would certainly stop the extension working from within PHP. Thanks, Ash I'm sorry, but this is just plain wrong. The extension has nothing to do with the mysql service. In fact, a lot of the larger websites have their database service running at a different server, and probably don't even have the mysql service installed. - Matijn Look at his connection settings, it says localhost... Thanks, Ash var_dump(function_exists('**mysqli_connect'));// this returns boo(false) I think it explains everything. - Matijn
Re: [PHP] files and folders windows permission
On Fri, Aug 23, 2013 at 4:03 PM, Emiliano Boragina emiliano.borag...@gmail.com wrote: Hi everyone, sorry my ugly english. I did an upload file form. Works very good. Upload the files in the right folder, with the right name. I use chmod 0644, and for try I use 0777. But always the files are copyed blocked. I cant see them with windows preview for example. I read in forums that is Windows fault. How can I fix this? Thanks a lot. Code?
Re: [PHP] How to send post-variables in a Location header
On Mon, Aug 26, 2013 at 9:48 PM, Ajay Garg ajaygargn...@gmail.com wrote: Hi all. I have a scenario, wherein I need to do something like this :: ### $original_url = /autologin.php; $username = ajay; $password = garg; header('Location: ' . $original_url); ### As can be seen, I wish to redirect to the URL autologin.php. Additionally, I wish to pass two POST key-value pairs :: user=ajay and password=garg (I understand that passing GET key-value pairs is trivial). Is it even possible? If yes, I will be grateful if someone could let me know how to redirect to a URL, passing the POST key-value pairs as necessary. Looking forward to a reply :) Usually you would pass this around in sessions. If you must however use post, you can only do so with using some javascript magic. Write a form with hidden input and auto submit it. - Matijn
Re: [PHP] Friday's Question
On Fri, Sep 20, 2013 at 6:51 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: Do you use a Mousepad? My reason for asking is that I've used a Mousepad ever since mice first came out (back when they had one ball). Now that mice are optical (no balls), Mousepads are not really needed -- or so I'll told by the college -- you see, they don't provide Mousepads for their student's computers. As such, I wondered what's the percentage of programmers still using a Mousepad? Secondly, are Mousepads used primarily by older programmers (like me) while younger programmers don't use Mousepads, or what? So -- please respond with: Age: * Mousepad: Yes/No Age: 21 Mouse: No, so why would I need a mousepad?