[PHP] Multithreading for OOP PHP
Hi guys I was wondering, what actually the reason is that PHP itself does not support multi-threading? I guess this would be realizable, or not? If not, why? Maybe this is a stupid question, but still somehow interesting. Realization in a way as Java does (or just something in that way) would actually be a very nice thing, don't you think? Thank you for your answers :) Florian
RE: [PHP] Multithreading for OOP PHP
I actually tought about just the same structures as Java uses(something in this way: Thread t = new Thread(new Runnable() {public void run() {...blabla }} I thought this would actually be a good benefit if PHP supported this. It's just as we sometimes use PHP for doing some big Server works (e.g. database copying or something) and it would be nice to controll by yourself which Thread (or process) does which part of the job. For normal HTTP calls which must be handled within milliseconds, this actually does not make sense, that's right ;) From: ovidiugabr...@gmail.com Date: Wed, 31 Oct 2012 10:59:28 +0200 To: php-general@lists.php.net Subject: [PHP] Multithreading for OOP PHP Hello Florian, Usually you want to run a PHP script in two different environments: 1. inside a webserver 2. in a command line interface For a web application, the application server does the work for you. It is the server job to have a thread pool and balance it correctly. So you don't need threads for the same reason threads are prohibited in Java EE containers. I assume that you don't fork multiple threads for every single HTTP request inside a Java Servlet, for instance. When you are inside a command line usually you start processes instead of threads. And this is fully supported by PHP. However, there are several reasons in choosing processes instead of threads. Several high-level programming languages are starting OS processes for language threads. But maybe this is not on our topic now. But I am wondering what do you mean by multithreading support? Do you need library functions as synchronization primitives? Or you are talking about something like synchronized keyword? On Wed, Oct 31, 2012 at 8:58 AM, Florian Müller florian-muel...@outlook.com wrote: Hi guys I was wondering, what actually the reason is that PHP itself does not support multi-threading? I guess this would be realizable, or not? If not, why? Maybe this is a stupid question, but still somehow interesting. Realization in a way as Java does (or just something in that way) would actually be a very nice thing, don't you think? Thank you for your answers :) Florian -- Cu respect / Best regards, Dipl.-Ing. Ovidiu Farauanu
[PHP] Function links on error and warningmessages
Hi guys, I was wondering some time ago, why the links which are shown on error or warning (E_WARNING etc.) show relative links to an usually non-existing file. Wouldn't it be much more useful if all errors are linking to the function description on php.net? So, if I get an error with file_exists, for example, it links on myCurrentDir/function.file-exists.php. Wouldn't it be nice if it links to http://php.net/file_exists? Regards, Flo
[PHP] Way to output HTML on professional websites
Hi guys Just a little question: I've programmed some nice little websites up to 25'000 lines of code. Now if I see some bigger websites just as facebook and so on, how are they printing their website out? Does it work like ?phpecho htmlhead...;? or do they output it like ?phpif (true) {?body /body?php} else { ?head /head?php}? Or is the code even generated or gotten from a database and evaluated? How does the website itself gets printet on really professional websites? Thanks for answer! Flo == Florian Müller florip...@hotmail.com==
[PHP] Placing the masterpassword
Hi all I got a little question about a good application design in PHP. If I use a mysql connection for example, I have to store my mysql-password somewhere in the code. If it's just in the mysql-class, that's not that good, because if somebody changes the functionality, he'd see it. I also can't store it in a text file. Until now, I just created a password class where all the passwords are described and i can get them by a get-function. Where are passwords stored in the big applications? There has to be at least one big masterpassword somewhere - how can I store it safely? How is this problem solved in big systems in production? Thanks for help ;) Regs, Flo.
RE: [PHP] Opening Multiple Files
Why don't u solve it by iterating through all files and getting their filenames and then execute your file? From: ron.pigg...@actsministries.org To: php-general@lists.php.net Date: Wed, 7 Sep 2011 10:21:18 -0400 Subject: [PHP] Opening Multiple Files Hi Everyone I am trying to load an HTML book into mySQL. The book was distributed with each chapter being it’s own HTML file. The only way I know how to open a file is by specifying the file name. Such as: $myFile = B01C001.htm; $lines = file($myFile); foreach ($lines as $line_num = $theData) { Is there a way PHP will open each file in the directory ending in “.htm”, one file at a time, without me specifying the file name? When the file is open I need the FOREACH (above) to parse the content which ends with an “INSERT INTO” for a mySQL table. Thank you in advance for any help you are able to give me. Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info
RE: [PHP] saving sessions
But please do not use cookies to store a password as code! Cookies are human readable with some add-ons Check like this: if someone registers, insert it into a table: ?php $username = mysql_real_escape_string($_POST[username]); $password = md5($_POST[password]); mysql_query(INSERT INTO USER VALUES(' . $username . ',' . $password . ')); header('location: register_success.php'); ? Then, if someone wants to log in, use like this: ?php $username = mysql_real_escape_string($_POST[username]); $password = md5($_POST[password]); $sel = SELECT * FROM USER WHERE USERNAME = ' . $username . ' AND PASSWORD = ' . $password . '; $unf = mysql_query($sel); $count = mysql_num_rows($unf); if ($count == 1) { header('location: login_success.php'); } else { echo Login not successful!; } ? If you want to store something into cookies, use a name which is not good understandable, like a shortcut for a logical sentense: Titcftmws (This is the cookie for the main webSite) or something ^^ In there, you can save username and password, but PLEASE save the password at least md5()-encryptet, so not everyone can save it. Now you can check like this: ?php if ($_COOKIE['Titcftmws'] == mysql_real_escape_string($_POST[username]) . | . md5($_POST[password])) { //in the cookie is for the user with username 'jack' and password 'test' this value: jack|098f6bcd4621d373cade4e832627b4f6 echo you are logged in; } else { echo not logged in!; } ? This is as far as I know a quite high level of security, in comparisions with other ways. Regs, Flo From: midhungir...@gmail.com Date: Fri, 5 Aug 2011 08:20:11 +0530 To: wilp...@me.com CC: php-general@lists.php.net Subject: Re: [PHP] saving sessions On Sat, Aug 6, 2011 at 7:56 AM, wil prim wilp...@me.com wrote: Hello, im new to the whole storing sessions thing and I really dont know how to ask this question, but here it goes. So on my site when someone logs in the login.php file checks for a the username and password in the table i created, then if it finds a match it will store a $_SESSION [] variable. To be exact the code is as follows: if ($count=='1') { session_start(); $_SESSION['user']=$user; // $user is the $_POST['user'] from the login form header('location: login_success.php'); } Now what i would like to know is how do i make my website save new changes the user made while in their account? thanks! You will have to store the user account related data in the database for persistence Or if the site not having a 'user account system' you may use cookies to store the settings... Midhun Girish
RE: [PHP] Best editor?
I don't think UltraEdit is a good editor, because it has some really great troubles with simple syntax highlighting... Well, my version can't even highlight a string on two rows ¬.¬ Date: Wed, 3 Aug 2011 17:04:01 +0200 From: hbal...@gmail.com To: php-general@lists.php.net Subject: Re: [PHP] Best editor? Hi, On Windows I used UltraEdit. On Linux Kate is simple and comfortable app. Actually I prefer NetBeans too. Eclipse could be faster but I think less comfortable... *Valentine* On Wed, Aug 3, 2011 at 4:45 PM, Matt Giddings mcgid...@gmail.com wrote: Notepad!!! LOL.. I use netbeans but eclipse is nice. A lot of it is personal opinion. On Wed, Aug 3, 2011 at 9:46 AM, Florian Müller florip...@hotmail.com wrote: Maybe an adittional information: PSPad is completely freeware and portable. You can download it right here: http://pspad.en.softonic.com/ This would be the best idea if you can't run a local server, because if there is an editor with this functionality built in, he'd have to bring a little local server with it, and I really don't know an editor which is able to do that without an external software. Regards and much fun ;) Flo From: florip...@hotmail.com To: msa...@gmail.com; sstap...@mnsi.net CC: php-general@lists.php.net Date: Wed, 3 Aug 2011 15:40:12 +0200 Subject: RE: [PHP] Best editor? I'm using PSPad since one year, and I'm very happy with it. With your description, I think it is the most simple way with it: Connect it with a webserver, and then you can edit all files right on the server, so if you save, they are live. PSPad is actually even a portable program, and there are lots of syntax highlighters, so this program is very nice! Date: Wed, 3 Aug 2011 09:32:34 -0400 From: msa...@gmail.com To: sstap...@mnsi.net CC: php-general@lists.php.net Subject: Re: [PHP] Best editor? Let me clarify a bit... I don't own my own machine - I'm using my work computer. I can install an editor, but installing a full fledged server would be verboten (like WAMP). And while its not hard to set up a VM in virtualbox, I'd prefer not to if I don't have to. I know the functionality of testing inside the editor used to be there, I'd just like to see if I can find it again :) If I have to, i'll just go the VM route. On Wed, Aug 3, 2011 at 9:26 AM, Steve Staples sstap...@mnsi.net wrote: On Wed, 2011-08-03 at 09:22 -0400, Matty Sarro wrote: Hey everyone, I am a super newbie just beginning to learn PHP. Awhile ago, I had used aptana for dabbling with php and was amazed to find out that it had a built in php interpreter so I could do some minor testing without having to upload everything to a web server, or have a web server locally. Flash forward to now, and it looks like that functionality doesn't exist anymore (at least not by default). So, I'm curious what editors are out there? Are there any out there which will let me test PHP files without having to upload everything every time I edit it? Any help would be greatly appreciated. Thanks! -Matty I personally use Komodo IDE, but there are lots out there. There is the Eclipse with PHP, or there was the way I learned, NotePad (then switched to EditPlus+) Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best editor?
Ahm . oh ^^ so, for the size of projects which I am realising, there is no problem of live editing. And even for learning PHP, it's a good idea to make it live on a server because if he wants to learn it, he does not have a website he edits on which has a really big traffic. So this would be the best choice I think... If I got bigger projects, I always edit in a single beta folder, just to say ^^ From: tamouse.li...@gmail.com To: php-general@lists.php.net Date: Wed, 3 Aug 2011 11:46:15 -0500 Subject: Re: [PHP] Best editor? On Aug 3, 2011, at 11:39 AM, David Harkness wrote: On Wed, Aug 3, 2011 at 9:36 AM, Tamara Temple tamouse.li...@gmail.com wrote: Not to hijack the thread, but I really, *really* hope you are not suggesting that someone do live edits on a production server I would never consider tinkering on test pages while learning PHP a production server. :) I think you missed my point -- that wasn't to the OP, that was to the respondent talking about how PSPad lets you edit files directly on the webserver
RE: [PHP] Best editor?
I'm using PSPad since one year, and I'm very happy with it. With your description, I think it is the most simple way with it: Connect it with a webserver, and then you can edit all files right on the server, so if you save, they are live. PSPad is actually even a portable program, and there are lots of syntax highlighters, so this program is very nice! Date: Wed, 3 Aug 2011 09:32:34 -0400 From: msa...@gmail.com To: sstap...@mnsi.net CC: php-general@lists.php.net Subject: Re: [PHP] Best editor? Let me clarify a bit... I don't own my own machine - I'm using my work computer. I can install an editor, but installing a full fledged server would be verboten (like WAMP). And while its not hard to set up a VM in virtualbox, I'd prefer not to if I don't have to. I know the functionality of testing inside the editor used to be there, I'd just like to see if I can find it again :) If I have to, i'll just go the VM route. On Wed, Aug 3, 2011 at 9:26 AM, Steve Staples sstap...@mnsi.net wrote: On Wed, 2011-08-03 at 09:22 -0400, Matty Sarro wrote: Hey everyone, I am a super newbie just beginning to learn PHP. Awhile ago, I had used aptana for dabbling with php and was amazed to find out that it had a built in php interpreter so I could do some minor testing without having to upload everything to a web server, or have a web server locally. Flash forward to now, and it looks like that functionality doesn't exist anymore (at least not by default). So, I'm curious what editors are out there? Are there any out there which will let me test PHP files without having to upload everything every time I edit it? Any help would be greatly appreciated. Thanks! -Matty I personally use Komodo IDE, but there are lots out there. There is the Eclipse with PHP, or there was the way I learned, NotePad (then switched to EditPlus+) Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best editor?
Maybe an adittional information: PSPad is completely freeware and portable. You can download it right here: http://pspad.en.softonic.com/ This would be the best idea if you can't run a local server, because if there is an editor with this functionality built in, he'd have to bring a little local server with it, and I really don't know an editor which is able to do that without an external software. Regards and much fun ;) Flo From: florip...@hotmail.com To: msa...@gmail.com; sstap...@mnsi.net CC: php-general@lists.php.net Date: Wed, 3 Aug 2011 15:40:12 +0200 Subject: RE: [PHP] Best editor? I'm using PSPad since one year, and I'm very happy with it. With your description, I think it is the most simple way with it: Connect it with a webserver, and then you can edit all files right on the server, so if you save, they are live. PSPad is actually even a portable program, and there are lots of syntax highlighters, so this program is very nice! Date: Wed, 3 Aug 2011 09:32:34 -0400 From: msa...@gmail.com To: sstap...@mnsi.net CC: php-general@lists.php.net Subject: Re: [PHP] Best editor? Let me clarify a bit... I don't own my own machine - I'm using my work computer. I can install an editor, but installing a full fledged server would be verboten (like WAMP). And while its not hard to set up a VM in virtualbox, I'd prefer not to if I don't have to. I know the functionality of testing inside the editor used to be there, I'd just like to see if I can find it again :) If I have to, i'll just go the VM route. On Wed, Aug 3, 2011 at 9:26 AM, Steve Staples sstap...@mnsi.net wrote: On Wed, 2011-08-03 at 09:22 -0400, Matty Sarro wrote: Hey everyone, I am a super newbie just beginning to learn PHP. Awhile ago, I had used aptana for dabbling with php and was amazed to find out that it had a built in php interpreter so I could do some minor testing without having to upload everything to a web server, or have a web server locally. Flash forward to now, and it looks like that functionality doesn't exist anymore (at least not by default). So, I'm curious what editors are out there? Are there any out there which will let me test PHP files without having to upload everything every time I edit it? Any help would be greatly appreciated. Thanks! -Matty I personally use Komodo IDE, but there are lots out there. There is the Eclipse with PHP, or there was the way I learned, NotePad (then switched to EditPlus+) Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Your language sucks because...
Well . do you have any hobbies or such? I think if you like it to complain about languages sucking and so on, please do NOT spam this mailing list with this really USELESS content. There are some people out there who are using these languages for some good reasons, and I guess they give a f*ck on somebody telling that all languages suxx. Please ask somebody for a hobby. Date: Thu, 14 Jul 2011 01:59:27 +0100 From: les...@lsces.co.uk To: php-general@lists.php.net Subject: Re: [PHP] Your language sucks because... Daevid Vincent wrote: (at the risk of starting another $h!t storm like the last time) http://wiki.theory.org/YourLanguageSucks#PHP_sucks_because: Perhaps when they get around to checking the facts ... most of the content will be deleted? A number of the -ve's I'd personally flag as +ve's and complain if anybody changed them ... Generally I'd say the whole page simply sucks :) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php