Re: [PHP] How to "download" a multi-part file at the "server" side?
On Sat, Nov 2, 2013 at 1:03 PM, Ajay Garg wrote: > Hi all. > > 1. > I could have the proper "$_FILES["userfile"]["name"]" been echoed back, by > replacing >ContentBody cbFile = new > FileBody(file, "image/png"); > > with >ContentBody cbFile = new > FileBody(file); > > > > 2. > However, now I am stuck with the following server-side code. > No matter what I do, I always get a "no" echoed back (specifying that the > file is not copied to its target place). > > > > ### > > $headers = apache_request_headers(); > > foreach ($headers as $header => $value) > { > if($header == "active_window_title") > { > $active_window_title = $value; > break; > } > } > > > $target_path = "/home/ajay/success.png"; > > move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path); > if(file_exists($target_path)) > { > echo "yes"; > } > else > { > echo "no"; > } > > echo "\n" . $_FILES["userfile"]["name"]; # I always get the proper > file-name echoed. > > ?> > > > > > > > > Any ideas what stupidity am I making in the PHP code? > > > On Sat, Nov 2, 2013 at 7:13 PM, Ajay Garg wrote: > > > Does not work :( > > > > > > As per the code-snippet I pasted, > > $_FILES["userfile"]["name"] > > > > should be > > /path/to/png/file.png > > > > > > However, $_FILES["userfile"]["name"] is empty. > > > > > > On Sat, Nov 2, 2013 at 6:59 PM, Shawn McKenzie >wrote: > > > >> Fairly easy: > >> http://www.php.net/manual/en/features.file-upload.post-method.php > >> > >> > >> On Sat, Nov 2, 2013 at 7:36 AM, Ajay Garg > wrote: > >> > >>> Hi all. > >>> > >>> I intend to implement a use-case, wherein the client uploads a file in > >>> multi-part format, and the server then stores the file in a mysql > >>> database > >>> (after "downloading it at the server side). > >>> > >>> I have been unable to find any immediate answers through googling; I > will > >>> be grateful if someone could start me in a direction to achieve the > >>> "downloading at server via php" requirement. > >>> > >>> (Don't think it should matter, but I use Java to upload a file in > >>> multi-part format). > >>> > >>> I will be grateful for some pointers. > >>> > >>> Thanks in advance > >>> > >>> > >>> Thanks and Regards, > >>> Ajay > >>> > >> > >> > > > > > > -- > > Regards, > > Ajay > > > > > > -- > Regards, > Ajay > Ajay, try changing your mpEntity to: new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE) See if it makes a difference.
Re: [PHP] How to "download" a multi-part file at the "server" side?
Hi Aziz. Thanks for the reply. Unfortunately, making the change suggested by you does not make any difference :( Sorry, Thanks and Regards On Sat, Nov 2, 2013 at 10:51 PM, Aziz Saleh wrote: > > > > On Sat, Nov 2, 2013 at 1:03 PM, Ajay Garg wrote: > >> Hi all. >> >> 1. >> I could have the proper "$_FILES["userfile"]["name"]" been echoed back, by >> replacing >>ContentBody cbFile = new >> FileBody(file, "image/png"); >> >> with >>ContentBody cbFile = new >> FileBody(file); >> >> >> >> 2. >> However, now I am stuck with the following server-side code. >> No matter what I do, I always get a "no" echoed back (specifying that the >> file is not copied to its target place). >> >> >> >> >> ### >> > >> $headers = apache_request_headers(); >> >> foreach ($headers as $header => $value) >> { >> if($header == "active_window_title") >> { >> $active_window_title = $value; >> break; >> } >> } >> >> >> $target_path = "/home/ajay/success.png"; >> >> move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path); >> if(file_exists($target_path)) >> { >> echo "yes"; >> } >> else >> { >> echo "no"; >> } >> >> echo "\n" . $_FILES["userfile"]["name"]; # I always get the proper >> file-name echoed. >> >> ?> >> >> >> >> >> >> >> >> Any ideas what stupidity am I making in the PHP code? >> >> >> On Sat, Nov 2, 2013 at 7:13 PM, Ajay Garg wrote: >> >> > Does not work :( >> > >> > >> > As per the code-snippet I pasted, >> > $_FILES["userfile"]["name"] >> > >> > should be >> > >> /path/to/png/file.png >> > >> > >> > However, $_FILES["userfile"]["name"] is empty. >> > >> > >> > On Sat, Nov 2, 2013 at 6:59 PM, Shawn McKenzie > >wrote: >> > >> >> Fairly easy: >> >> http://www.php.net/manual/en/features.file-upload.post-method.php >> >> >> >> >> >> On Sat, Nov 2, 2013 at 7:36 AM, Ajay Garg >> wrote: >> >> >> >>> Hi all. >> >>> >> >>> I intend to implement a use-case, wherein the client uploads a file in >> >>> multi-part format, and the server then stores the file in a mysql >> >>> database >> >>> (after "downloading it at the server side). >> >>> >> >>> I have been unable to find any immediate answers through googling; I >> will >> >>> be grateful if someone could start me in a direction to achieve the >> >>> "downloading at server via php" requirement. >> >>> >> >>> (Don't think it should matter, but I use Java to upload a file in >> >>> multi-part format). >> >>> >> >>> I will be grateful for some pointers. >> >>> >> >>> Thanks in advance >> >>> >> >>> >> >>> Thanks and Regards, >> >>> Ajay >> >>> >> >> >> >> >> > >> > >> > -- >> > Regards, >> > Ajay >> > >> >> >> >> -- >> Regards, >> Ajay >> > > Ajay, try changing your mpEntity to: > > new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE) > > See if it makes a difference. > Ajay
Re: [PHP] How to capture uploaded file data
Thanks, Bastien > On Sep 27, 2013, at 12:56 AM, Mariusz Drozdowski wrote: > > Hi all php experts, > > I would like to ask you all a question, I hope this is the right place > to ask it. > > I'm writing a PHP extension now in c/c++. User uploads a file (could be POST > or PUT method, but I can limit it to POST only). I need to capture the > file data while being > uploaded, without writing it to disk on the server. I need to process > the data and (maybe, > depending on a situation) send it somewhere else or save it to disk. > Of course I know, that I can process the file > after it has been uploaded (saved on disk on the server), but I would > like to avoid it. > I also need to do something opposite: I need to generate a file "on the > fly" and send it > to the user. All metadata of the generated file is known beforehand > (e.g. size, name). > > I've been searching around for some time now and I could not find > anything even close to the solution. > Is there any example(s) or existing PHP extension that do(es) something > like this (at least something simmilar) ? > If you could give me any pointers that would be awesome. > > Thanks for your help The question I have is why? Should your upload fail for any reason you've got a half processed file that is non-recoverable. No do-overs. If you stick to the standard processes with out the extension, Upload Save somewhere (or leave in temp upload folder) Process Send result back to user Unlink file Generating the file and sending it to the user is also pretty standard Create your dataset Send appropriate headers Send data Close connection For this, there usually isn't a need to save the file. You may run into issues streaming the data to certain browsers. Also one of the main downsides to your upload is high load situations or large file situations (where file size exceeds php's upload limit). My personal preference is to save that file to disk so that if needed I can work with it later ( if say the server load is high) and email the results to the user. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to capture uploaded file data
Hi all php experts, I would like to ask you all a question, I hope this is the right place to ask it. I'm writing a PHP extension now in c/c++. User uploads a file (could be POST or PUT method, but I can limit it to POST only). I need to capture the file data while being uploaded, without writing it to disk on the server. I need to process the data and (maybe, depending on a situation) send it somewhere else or save it to disk. Of course I know, that I can process the file after it has been uploaded (saved on disk on the server), but I would like to avoid it. I also need to do something opposite: I need to generate a file "on the fly" and send it to the user. All metadata of the generated file is known beforehand (e.g. size, name). I've been searching around for some time now and I could not find anything even close to the solution. Is there any example(s) or existing PHP extension that do(es) something like this (at least something simmilar) ? If you could give me any pointers that would be awesome. Thanks for your help in advance. Mariusz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to send "post"-variables in a "Location" header
On Mon, Aug 26, 2013 at 3:48 PM, Ajay Garg 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. No. Sending a 'Location:' header issues an HTTP 301 by default, which means the browser will follow it using a GET request. If you can't pass the information from one location to another using sessions or (less ideally) cookies, you might consider doing a cURL POST request in the background and passing the session ID back to the browser, and having it handle it appropriately (read: session hijack). -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to do PHP build test
Hi, Can anybody help me answering my doubt. I wanted to check if there are any errors with the php compilation and build. I have ran "make", "make test". "make test" didnt give any errors to me. Is there any other method or command to run through which we can see if there are any errors in building the php source code. Thanks, Shahina Rabbani
Re: [PHP] How to send "post"-variables in a "Location" header
On Aug 26, 2013, at 2:48 PM, Ajay Garg 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 :) Since this seems that it will not work, I'm wondering if you could take a step back for us and say what is it you're hoping to accomplish by this. Maybe there's a better way to get you what you need that is possible, and also will be good PHP. Describe your scenario in higher level terms, not how you'd implement it, but what the outcome you need is, and what the design goal is for the user. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to send "post"-variables in a "Location" header
On Mon, Aug 26, 2013 at 9:48 PM, Ajay Garg 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] How to send "post"-variables in a "Location" header
> Ajay Garg hat am 26. August 2013 um 21:48 > geschrieben: > > > 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. Iirc it is not possible to pass post body content via location redirect. What you can do: Set auth headers http://forums.phpfreaks.com/topic/84480-solved-how-to-send-authorization-basic-header/ > > > Looking forward to a reply :) > > > -- > Regards, > Ajay -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to send "post"-variables in a "Location" header
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 :) -- Regards, Ajay
Re: [PHP] How to upstream code changes to php community
On Tue, Aug 13, 2013 at 12:38 AM, Shahina Rabbani wrote: > Hi, > > I have done some modifications to the php source code and i tested it with > php bench and I observed some improvement. > > I wanted to upstream these code changes to PHP community. > I searched the wed but i didnt find proper guide to upstream the code to > php. > > Please help me by providing the information how to upstream my code > changes to php source code community. Start by subscribing to intern...@lists.php.net and introducing yourself on that list, which is intended for the discussion of the ongoing development of the runtime and related things. You may also want to hop on EFNet and join #php.pecl, which - like internals@ - is specifically for discussion of furthering the core development (not for any time of support). -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to upstream code changes to php community
Hi, I have done some modifications to the php source code and i tested it with php bench and I observed some improvement. I wanted to upstream these code changes to PHP community. I searched the wed but i didnt find proper guide to upstream the code to php. Please help me by providing the information how to upstream my code changes to php source code community. Thanks, Shahina Rabbani
Re: [PHP] how to see all sessions sets in server
On Sun, Aug 04, 2013 at 05:58:53PM +0100, Ashley Sheridan wrote: [snip] > > I'm not saying the method is bad, but the way Facebook does it isn't > great, I'm constantly seeing people online who "sign out" when I open > up a message box. Now that might be genuine, but I'm not *that* > unpopular! I'm sorry. Were you saying something? As soon as I saw "Ashley Sheridan" in my email client, it closed and my computer rebooted for some strange reason. ;-} Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to see all sessions sets in server
Matijn Woudt wrote: >On Sun, Aug 4, 2013 at 4:00 PM, Ashley Sheridan >wrote: > >> >> >> Farzan Dalaee 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 wrote: >> >>> >> >>> > >> >>> > >> >>> > >> >>> > On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee >> > 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 I'm not saying the method is bad, but the way Facebook does it isn't great, I'm constantly seeing people online who "sign out" when I open up a message box. Now that might be genuine, but I'm not *that* unpopular! Thanks, Ash -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to see all sessions sets in server
> > > > On Sun, Aug 4, 2013 at 4:00 PM, Ashley Sheridan > wrote: >> >> >> Farzan Dalaee 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 wrote: >> >>> >> >>> > >> >>> > >> >>> > >> >>> > On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee >> > 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 So best way is use a script(javascript) to send ajax to server every 5 second to check users is logged in or not? Is that okey? I want to write chat module like facebook and i need a solution to find online users and way to send messages when users chat together, does any one write similar module like that?
Re: [PHP] how to see all sessions sets in server
On Sun, Aug 4, 2013 at 4:00 PM, Ashley Sheridan wrote: > > > Farzan Dalaee 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 wrote: > >>> > >>> > > >>> > > >>> > > >>> > On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee > > 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] how to see all sessions sets in server
Farzan Dalaee 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 wrote: >>> >>> > >>> > >>> > >>> > On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to see all sessions sets in server
On 4 Aug 2013, at 14:36, Farzan Dalaee wrote: > I need to inspect each visitor to show how online or who offline for chat > Like facebook chat PHP sessions is a really bad mechanism to use to accomplish this. In the past I've used memcached or redis for presence indicators. Both allow you to set keys that expire after a set period. The problem with this is that a user can appear to be online for up to "set period" seconds longer than they actually are. In the system I'm currently building I've got a node.js daemon to which the browser connects. That daemon exposes an API that the rest of the system can call to get lists of online users, which is easily gathered since it's just the list of connected users. There is then no delay between the browser closing the connection and the daemon deciding that user is no longer online. If you have a chat system I'm curious as to how it works, since presence is usually tied closely to how the client is detecting new messages. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to see all sessions sets in server
> 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 wrote: >> >> > >> > >> > >> > On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee >> > 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 >
Re: [PHP] how to see all sessions sets in server
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 wrote: > > > > > > > > > On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee > > 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
Re: [PHP] how to see all sessions sets in server
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 wrote: > > > > On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee > 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 >
Re: [PHP] how to see all sessions sets in server
On Sun, Aug 4, 2013 at 11:02 AM, Farzan Dalaee 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
[PHP] how to see all sessions sets in server
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?
Re: [PHP] How to delete 3 months old records in my database?
Yeah, just spelling mistake :-) And yes, it should be: $query = "DELETE FROM `__table_name__` WHERE `__date__` <= NOW() - INTERVAL 3 MONTH" Cheers ;-) On Fri, Aug 2, 2013 at 2:35 PM, Simon Schick wrote: > On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen > wrote: > > > > 2013/8/2 Dušan Novaković > > > > > $query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() - > > > INTERVAL 3 MONTH AND NOW()" > > > > > > > This delete everything from now and 3months backwards. I want to store 3 > > months from now and delete OLDER than 3 months old records. > > > > Karl > > Hi, Karl > > You're right, but restructuring, to get it the way you want, isn't be > that hard, is it? :) > > $query = "DELETE FROM `__table_name__` WHERE `__date__` < NOW() - > INTERVAL 3 MONTH" > > @Dusan, > Btw: What is "DELECT"? I assume it should've been "DELETE", right? > > Bye > Simon > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- mob: + 46 7 230 230 19 web: http://novakovicdusan.com Please consider the environment before printing this email.
Re: [PHP] How to delete 3 months old records in my database?
On Fri, Aug 2, 2013 at 2:02 PM, Karl-Arne Gjersøyen wrote: > > 2013/8/2 Dušan Novaković > > > $query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() - > > INTERVAL 3 MONTH AND NOW()" > > > > This delete everything from now and 3months backwards. I want to store 3 > months from now and delete OLDER than 3 months old records. > > Karl Hi, Karl You're right, but restructuring, to get it the way you want, isn't be that hard, is it? :) $query = "DELETE FROM `__table_name__` WHERE `__date__` < NOW() - INTERVAL 3 MONTH" @Dusan, Btw: What is "DELECT"? I assume it should've been "DELETE", right? Bye Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to delete 3 months old records in my database?
2013/8/2 Dušan Novaković > $query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() - > INTERVAL 3 MONTH AND NOW()" > This delete everything from now and 3months backwards. I want to store 3 months from now and delete OLDER than 3 months old records. Karl
Re: [PHP] How to delete 3 months old records in my database?
Hello, Try something like: $oldDate = new DateTime(); $oldDate->sub(new DateInterval('P3M')); $old_records_to_delete = $oldDate->format('Y-m-d'); Hope this helps, Si Sent from my iPhone On 2 Aug 2013, at 11:58, Karl-Arne Gjersøyen wrote: > Hello again, folks! > I wish to delete records in my database that is older than 3 months. > > $todays_date = date('Y-m-d'); > $old_records_to_delete = ??? > > if($old_records_to_delete){ > include(connect.php); > $sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'"; > mysql_query($sql, $connect_db) or die(mysql_error()); > } > > Thank you very much for your help to understand also this question :) > > Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to delete 3 months old records in my database?
$query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() - INTERVAL 3 MONTH AND NOW()" On Fri, Aug 2, 2013 at 12:58 PM, Karl-Arne Gjersøyen wrote: > Hello again, folks! > I wish to delete records in my database that is older than 3 months. > > $todays_date = date('Y-m-d'); > $old_records_to_delete = ??? > > if($old_records_to_delete){ > include(connect.php); > $sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'"; > mysql_query($sql, $connect_db) or die(mysql_error()); > } > > Thank you very much for your help to understand also this question :) > > Karl > -- mob: + 46 7 230 230 19 web: http://novakovicdusan.com Please consider the environment before printing this email.
[PHP] How to delete 3 months old records in my database?
Hello again, folks! I wish to delete records in my database that is older than 3 months. $todays_date = date('Y-m-d'); $old_records_to_delete = ??? if($old_records_to_delete){ include(connect.php); $sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'"; mysql_query($sql, $connect_db) or die(mysql_error()); } Thank you very much for your help to understand also this question :) Karl
Re: [PHP] How to extract php source code from joomla
On 23/07/2013 16:54, Yoinier Hernandez Nieves wrote: El 22/07/13 15:49, elk dolk escribió: Thank you for the quick response ! What I am trying to do : I have to complete two university projects for my professor ! project One : Make an online shop and must use the following components in it Shopping cart, Catalog of products, payment gateway , user login and user activity log . You can use Prestashop, Magento, Oscommerce, etc, and modify at you're needed. IMO do NOT use Oscommerce (or the ZenCart fork for that matter) ... unless you want a lesson in how not to write an application in PHP... the code and architecture is (well it was the last time I had the dubious pleasure of working with it...) truly awful Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to extract php source code from joomla
El 22/07/13 15:49, elk dolk escribió: Thank you for the quick response ! What I am trying to do : I have to complete two university projects for my professor ! project One : Make an online shop and must use the following components in it Shopping cart, Catalog of products, payment gateway , user login and user activity log . You can use Prestashop, Magento, Oscommerce, etc, and modify at you're needed. project Two : Implementing of a B2B sell-side portal with negotiation mechanism. You can modify above softwares to this purpose. Thanks As I am familiar with php and My.SQL and I have only 20 days to complete those projects ! I thought it's (...) Thanks, Ash http://www.ashleysheridan.co.uk -- _.___. .__ \__ | | |__| ___ __ __ / | |/\| |/ __ \ \/ // __ \ / ___/ \ | | \ \ ___/\ /\ ___/ \___ \ / __|___| /__|\___ >\_/ \___ > > \/ \/\/ \/ \/ .___ __ ___ __ __| _/_/ |_ \ \ _/ |_ / __ |/ _ \ __\/ | \_/ __ \ __\ / /_/ ( <_> ) | /|\ ___/| | \ |\/|__| \|__ /\___ >__| \/ \/ \/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to extract php source code from joomla
I study for MSc degree at university. Are you in an advanced class?
Re: [PHP] How to extract php source code from joomla
On Jul 22, 2013, at 3:49 PM, elk dolk wrote: > Thank you for the quick response ! What I am trying to do : I have to > complete two university projects for > > my professor ! > > project One : Make an online shop and must use the following components in > it > > > Shopping cart, Catalog of products, payment gateway , user login and user > activity log . > > > project Two : Implementing of a B2B sell-side portal with negotiation > mechanism. > > As I am familiar with php and My.SQL and I have only 20 days to complete > those projects ! I thought it's > > better to use Joomla I'll be grateful if you can give me an advice > > > thank you > Sounds more like a client than someone who teaches php. I couldn't do that from scratch in 20 days and I teach php at college level. That's more than my entire 16 weeks course of introductory php. Are you in an advanced class? tedd _ tedd.sperl...@gmail.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to extract php source code from joomla
On Mon, 2013-07-22 at 13:10 -0700, elk dolk wrote: > I am allowed to use tools or code by hand , it does not matter ,the professor > wants to have the source code. > > > > You say tools, but would he consider a full-blown complex CMS as merely a tool, or not? At this point, I agree, your best option is probably a CMS with plugins, because 20 days is not much time to build that sort of thing, and that's coming from someone who develops in PHP for a living. Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] How to extract php source code from joomla
I am allowed to use tools or code by hand , it does not matter ,the professor wants to have the source code.
Re: [PHP] How to extract php source code from joomla
On Mon, 2013-07-22 at 12:49 -0700, elk dolk wrote: > Thank you for the quick response ! What I am trying to do : I have to > complete two university projects for > > my professor ! > > project One : Make an online shop and must use the following components in > it > > > Shopping cart, Catalog of products, payment gateway , user login and user > activity log . > > > project Two : Implementing of a B2B sell-side portal with negotiation > mechanism. > > As I am familiar with php and My.SQL and I have only 20 days to complete > those projects ! I thought it's > > better to use Joomla I'll be grateful if you can give me an advice > > > thank you > > > - Forwarded Message - > From: Ashley Sheridan > To: elk dolk > Cc: "php-general@lists.php.net" > Sent: Monday, July 22, 2013 11:45 PM > Subject: Re: [PHP] How to extract php source code from joomla > > > On Mon, 2013-07-22 at 12:18 -0700, elk dolk wrote: > > > Hi all, > > I want to build a website using Joomla 2.5 . It should have 5 pages: > > > > index.php > > pageOne.php > > pageTwo.php > > ... > > > > How can I get the php source code for those pages? > > > > I installed joomla 2.5 on my windows box and use XAMPP's appache web server > > thanks > > > Erm, Joomla is a CMS, which means that you don't have source code for > individual pages like that. If you want, you don't have to get involved > with the PHP at all in Joomla. What is it that you're actually trying to > achieve? > > Thanks, > Ash > http://www.ashleysheridan.co.uk 20 days seems awfully ambitious, does your professor expect you to code these by hand or are you allowed to use an existing CMS, I ask because your original question seemed a bit odd. For e-commerce you're better off choosing a CMS which does that out of the box. Joomla has plugins that allow you to do these things, but it can be a hefty CMS, and it's not particularly suited for shops, plus it has a bit of a learning curve and some large security holes (which I know first hand having had to just get a Joomla site to pass a rigorous security test) Lastly, please try not to top post :) Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] How to extract php source code from joomla
Thank you for the quick response ! What I am trying to do : I have to complete two university projects for my professor ! project One : Make an online shop and must use the following components in it Shopping cart, Catalog of products, payment gateway , user login and user activity log . project Two : Implementing of a B2B sell-side portal with negotiation mechanism. As I am familiar with php and My.SQL and I have only 20 days to complete those projects ! I thought it's better to use Joomla I'll be grateful if you can give me an advice thank you - Forwarded Message - From: Ashley Sheridan To: elk dolk Cc: "php-general@lists.php.net" Sent: Monday, July 22, 2013 11:45 PM Subject: Re: [PHP] How to extract php source code from joomla On Mon, 2013-07-22 at 12:18 -0700, elk dolk wrote: > Hi all, > I want to build a website using Joomla 2.5 . It should have 5 pages: > > index.php > pageOne.php > pageTwo.php > ... > > How can I get the php source code for those pages? > > I installed joomla 2.5 on my windows box and use XAMPP's appache web server > thanks Erm, Joomla is a CMS, which means that you don't have source code for individual pages like that. If you want, you don't have to get involved with the PHP at all in Joomla. What is it that you're actually trying to achieve? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] How to extract php source code from joomla
On Mon, 2013-07-22 at 12:18 -0700, elk dolk wrote: > Hi all, > I want to build a website using Joomla 2.5 . It should have 5 pages: > > index.php > pageOne.php > pageTwo.php > ... > > How can I get the php source code for those pages? > > I installed joomla 2.5 on my windows box and use XAMPP's appache web server > thanks Erm, Joomla is a CMS, which means that you don't have source code for individual pages like that. If you want, you don't have to get involved with the PHP at all in Joomla. What is it that you're actually trying to achieve? Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] How to extract php source code from joomla
Hi all, I want to build a website using Joomla 2.5 . It should have 5 pages: index.php pageOne.php pageTwo.php ... How can I get the php source code for those pages? I installed joomla 2.5 on my windows box and use XAMPP's appache web server thanks
Re: [PHP] How to read PHP-FPM config values using phpinfo
Daniel, thanks for asking. I do have Apache correctly configured to use fpm, in fact, phpinfo shows php-fpm as the cgi module. Only problem is to read (or dump) the Fpm configs from phpinfo. Regards, Amiya. Original message From: Daniel Date: 07/16/2013 9:48 PM (GMT-05:00) To: Amiya Maji Cc: php-general@lists.php.net Subject: Re: [PHP] How to read PHP-FPM config values using phpinfo Hi there, Just a question, do you have Apache configured to use the PHP-FPM and not the Apache module? That something that people can mess up on. Thanks :) On Wed, Jul 17, 2013 at 9:58 AM, Amiya Maji wrote: > Hi all, > > I am using PHP-FPM with Apache 2.4. I periodically change my php-fpm.conf > and reload it by sending USR2 signal to the FPM process. Is there a way to > print the updated parameters in FPM using phpinfo(). > At present I am not seeing any FPM specific parameters in phpinfo. Any > suggestion is appreciated. > > Thanks! > Amiya. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
Re: [PHP] How to read PHP-FPM config values using phpinfo
Hi there, Just a question, do you have Apache configured to use the PHP-FPM and not the Apache module? That something that people can mess up on. Thanks :) On Wed, Jul 17, 2013 at 9:58 AM, Amiya Maji wrote: > Hi all, > > I am using PHP-FPM with Apache 2.4. I periodically change my php-fpm.conf > and reload it by sending USR2 signal to the FPM process. Is there a way to > print the updated parameters in FPM using phpinfo(). > At present I am not seeing any FPM specific parameters in phpinfo. Any > suggestion is appreciated. > > Thanks! > Amiya. > > -- > 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] How to read PHP-FPM config values using phpinfo
Hi all, I am using PHP-FPM with Apache 2.4. I periodically change my php-fpm.conf and reload it by sending USR2 signal to the FPM process. Is there a way to print the updated parameters in FPM using phpinfo(). At present I am not seeing any FPM specific parameters in phpinfo. Any suggestion is appreciated. Thanks! Amiya. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to enable cURL php extension on Debian Wheezy?
Csanyi Pal wrote: > I have installed following packages related to this issue: > curl, libcurl3, libcurl3-gnutls, php5-curl. All good. > I have in > /etc/php5/mods-available/curl.ini > ; configuration for php CURL module > ; priority=20 > extension=curl.so Have you enabled the extension as well? That looks like the standard set-up, which means that curl.ini is available, but you still have to enable it. Check in /etc/php5/conf.d to see if there's a symlink in there, otherwise look through the various bits to see if it's included somewhere in one of the stock php.ini files. Here's an example from one of my servers: tamara@gandimouse /etc/php5$ ll mods-available/ total 4.0K -rw-r--r-- 1 root root 66 Sep 15 2012 pdo.ini tamara@gandimouse /etc/php5$ ll conf.d/ total 0 lrwxrwxrwx 1 root root 25 Sep 24 2012 10-pdo.ini -> ../mods-available/pdo.ini If you make changes here, ensure you restart your sever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to enable cURL php extension on Debian Wheezy?
On Sat, Jun 01, 2013 at 09:41:33PM +0200, Csanyi Pal wrote: > Hi, > > I just upgraded Squeeze to Wheezy, and have difficulties with cURL PHP > extension: I can't enable it. > > I have installed following packages related to this issue: > curl, libcurl3, libcurl3-gnutls, php5-curl. > > I have in > /etc/php5/mods-available/curl.ini > ; configuration for php CURL module > ; priority=20 > extension=curl.so > > I know that cURL extension is not enabled because I want to install > Moodle and it complains about cURL extension. > > How can I solve this problem? Hi, what error message do you get? Also, have you restarted apache after installing the extension? Regards, A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to enable cURL php extension on Debian Wheezy?
On Sat, Jun 01, 2013 at 09:41:33PM +0200, Csanyi Pal wrote: > Hi, > > I just upgraded Squeeze to Wheezy, and have difficulties with cURL PHP > extension: I can't enable it. > > I have installed following packages related to this issue: > curl, libcurl3, libcurl3-gnutls, php5-curl. > > I have in > /etc/php5/mods-available/curl.ini > ; configuration for php CURL module > ; priority=20 > extension=curl.so > > I know that cURL extension is not enabled because I want to install > Moodle and it complains about cURL extension. > > How can I solve this problem? Hi, what error message do you get? Also, have you restarted apache after installing the extension? Regards, A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to enable cURL php extension on Debian Wheezy?
Hi, I just upgraded Squeeze to Wheezy, and have difficulties with cURL PHP extension: I can't enable it. I have installed following packages related to this issue: curl, libcurl3, libcurl3-gnutls, php5-curl. I have in /etc/php5/mods-available/curl.ini ; configuration for php CURL module ; priority=20 extension=curl.so I know that cURL extension is not enabled because I want to install Moodle and it complains about cURL extension. How can I solve this problem? -- Regards from Pal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to insert html code with PHP
On Apr 11, 2013 6:35 AM, "Rafnews" wrote: > > Hi, > > I would like to insert a piece of HTML code inside several pages. > all pages are differently named. > > i need in each page to find a particular tag, let's say ... (so based on its ID and tagname) and inside it to insert my PHP/HTML code. > > how can i do that ? I am a little confused. If you want to insert the same bit of code in a php file, use the include function. If you need to do same thing across a number of pages, you probably have found a spot to refactor your code. If your talking about inserting it in real time in the client's browser, you want jQuery/AJAX for that, not php. (php can serve up the HTML in response to an AJAX request, though) > > thx. > > A. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
[PHP] how to insert html code with PHP
Hi, I would like to insert a piece of HTML code inside several pages. all pages are differently named. i need in each page to find a particular tag, let's say id="#submenu">... (so based on its ID and tagname) and inside it to insert my PHP/HTML code. how can i do that ? thx. A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to calculate how much data does each ip address use ?
On Wed, Feb 6, 2013 at 11:15 AM, Aaron Holmes wrote: > No one has mentioned Cacti yet? It does exactly what Bulent is looking for. > > http://cacti.net/ > > > On 2/5/13 6:46 PM, Sean Greenslade wrote: >> >> On Tue, Feb 5, 2013 at 10:13 AM, Bulent Malik >> wrote: >>> >>> > This task is not really suited for php. I would suggest looking into >>> >>> Ntop. > > It does exactly what you described. >> >> Hello >> >> I have a freebsdbox firewall . also I have some internet customers. >> I want to save how much data they used in a table ( such as mysql >> table ) for each ip address. >> Apache2, php5 and mysql5.5 work on the box. >> >> How can I do it ? any script or tool. >> >> Thanks How can i save in table using ntop ? is there any document ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Read the man pages. There are sql export options that you can specify on run. >>> >>> I could not see any sql options on the man file of ntop. >>> Where is it? >>> >>> >>> >> Whoops, my mistake. I was reading the NetFlow documentation and going >> off vague memories of older versions of Ntop. >> >> Ntop saves data in RRD files. There are PHP libraries to parse this >> data [1]. You could theoretically scrape the RRDs and put them in a >> SQL DB, but they may be useful enough on their own if you can parse >> them correctly. (Note: I have never personally parsed RRDs manually. >> This info was pulled from a simple Google search. YMMV.) >> >> [1] >> http://www.ioncannon.net/system-administration/59/php-rrdtool-tutorial/ >> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Neat, I'd never heard of that package before. -- --Zootboy Sent from some sort of computing device. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to calculate how much data does each ip address use ?
No one has mentioned Cacti yet? It does exactly what Bulent is looking for. http://cacti.net/ On 2/5/13 6:46 PM, Sean Greenslade wrote: On Tue, Feb 5, 2013 at 10:13 AM, Bulent Malik wrote: This task is not really suited for php. I would suggest looking into Ntop. It does exactly what you described. Hello I have a freebsdbox firewall . also I have some internet customers. I want to save how much data they used in a table ( such as mysql table ) for each ip address. Apache2, php5 and mysql5.5 work on the box. How can I do it ? any script or tool. Thanks How can i save in table using ntop ? is there any document ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Read the man pages. There are sql export options that you can specify on run. I could not see any sql options on the man file of ntop. Where is it? Whoops, my mistake. I was reading the NetFlow documentation and going off vague memories of older versions of Ntop. Ntop saves data in RRD files. There are PHP libraries to parse this data [1]. You could theoretically scrape the RRDs and put them in a SQL DB, but they may be useful enough on their own if you can parse them correctly. (Note: I have never personally parsed RRDs manually. This info was pulled from a simple Google search. YMMV.) [1] http://www.ioncannon.net/system-administration/59/php-rrdtool-tutorial/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to calculate how much data does each ip address use ?
On Tue, Feb 5, 2013 at 10:13 AM, Bulent Malik wrote: > > >> >This task is not really suited for php. I would suggest looking into > Ntop. >> >It does exactly what you described. >> >> >> Hello >> >> >> >> I have a freebsdbox firewall . also I have some internet customers. >> >> I want to save how much data they used in a table ( such as mysql >> >>table ) for each ip address. >> >>Apache2, php5 and mysql5.5 work on the box. >> >> >> >> How can I do it ? any script or tool. >> >> >> >> Thanks >> >> How can i save in table using ntop ? is there any document ? >> >> >> -- >> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: >> http://www.php.net/unsub.php >> > >>Read the man pages. There are sql export options that you can specify on run. > > I could not see any sql options on the man file of ntop. > Where is it? > > > Whoops, my mistake. I was reading the NetFlow documentation and going off vague memories of older versions of Ntop. Ntop saves data in RRD files. There are PHP libraries to parse this data [1]. You could theoretically scrape the RRDs and put them in a SQL DB, but they may be useful enough on their own if you can parse them correctly. (Note: I have never personally parsed RRDs manually. This info was pulled from a simple Google search. YMMV.) [1] http://www.ioncannon.net/system-administration/59/php-rrdtool-tutorial/ -- --Zootboy Sent from some sort of computing device. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to calculate how much data does each ip address use ?
On 2013/02/01 4:58 PM, Sean Greenslade wrote: > This task is not really suited for php. I would suggest looking into Ntop. > It does exactly what you described. That's one option. I use a custom system, with perl and bash scripts collecting data and saving to rrd databases. php script displaying the images. Using this on a box with 5 interfaces (3 ethernet, 1 openvpn tunnel, 1 ppp session). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to calculate how much data does each ip address use ?
> >This task is not really suited for php. I would suggest looking into Ntop. > >It does exactly what you described. > > >> Hello > >> > >> I have a freebsdbox firewall . also I have some internet customers. > >> I want to save how much data they used in a table ( such as mysql > >>table ) for each ip address. > >>Apache2, php5 and mysql5.5 work on the box. > >> > >> How can I do it ? any script or tool. > >> > >> Thanks > > How can i save in table using ntop ? is there any document ? > > > -- > PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php > >Read the man pages. There are sql export options that you can specify on run. I could not see any sql options on the man file of ntop. Where is it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to calculate how much data does each ip address use ?
Original message From: Sean Greenslade Date: To: Bulent Malik Cc: php-general@lists.php.net Subject: RE: [PHP] how to calculate how much data does each ip address use ? On Feb 1, 2013 10:25 AM, "Bulent Malik" wrote: > > > > >This task is not really suited for php. I would suggest looking into Ntop. > >It does exactly what you described. > > >> Hello > >> > >> I have a freebsdbox firewall . also I have some internet customers. > >> I want to save how much data they used in a table ( such as mysql > >> table ) for each ip address. > >>Apache2, php5 and mysql5.5 work on the box. > >> > >> How can I do it ? any script or tool. > >> > >> Thanks > > How can i save in table using ntop ? is there any document ? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Look at www.highonphp.com/regex-pattern-parsing-ifconfig You can use exec to run ifconfig and parse the output using the above.
RE: [PHP] how to calculate how much data does each ip address use ?
On Feb 1, 2013 10:25 AM, "Bulent Malik" wrote: > > > > >This task is not really suited for php. I would suggest looking into Ntop. > >It does exactly what you described. > > >> Hello > >> > >> I have a freebsdbox firewall . also I have some internet customers. > >> I want to save how much data they used in a table ( such as mysql > >> table ) for each ip address. > >>Apache2, php5 and mysql5.5 work on the box. > >> > >> How can I do it ? any script or tool. > >> > >> Thanks > > How can i save in table using ntop ? is there any document ? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Read the man pages. There are sql export options that you can specify on run.
RE: [PHP] how to calculate how much data does each ip address use ?
>This task is not really suited for php. I would suggest looking into Ntop. >It does exactly what you described. >> Hello >> >> I have a freebsdbox firewall . also I have some internet customers. >> I want to save how much data they used in a table ( such as mysql >> table ) for each ip address. >>Apache2, php5 and mysql5.5 work on the box. >> >> How can I do it ? any script or tool. >> >> Thanks How can i save in table using ntop ? is there any document ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to calculate how much data does each ip address use ?
This task is not really suited for php. I would suggest looking into Ntop. It does exactly what you described. On Feb 1, 2013 9:40 AM, "Bulent Malik" wrote: > Hello > > I have a freebsdbox firewall . also I have some internet customers. I > want > to save how much data they used in a table ( such as mysql table ) for each > ip address. > Apache2, php5 and mysql5.5 work on the box. > > How can I do it ? any script or tool. > > Thanks > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] how to calculate how much data does each ip address use ?
Hello I have a freebsdbox firewall . also I have some internet customers. I want to save how much data they used in a table ( such as mysql table ) for each ip address. Apache2, php5 and mysql5.5 work on the box. How can I do it ? any script or tool. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to build multilingual e-commerce website
Thanks all for your suggestions. I have decided to go through these 2 books & i will also talk to Magento developers. Once again thanks for your input regards Sachin Raut On Sat, Dec 29, 2012 at 9:20 AM, tamouse mailing lists < tamouse.li...@gmail.com> wrote: > On Fri, Dec 28, 2012 at 5:19 AM, Sachin Raut > wrote: > > Dear Friends, > > > > I have to develop multilingual e-commerce (clothing) website. Could > anyone > > who has developed these kind of sites before guide me on how to start the > > development or recommend any tutorial / book for developing these kind of > > sites? > > > > Would really appreciate any inut regarding this. > > > > regards > > Sachin Raut > > > There's this at O'Reilly: "Building eCommerce Applications" > http://shop.oreilly.com/product/0636920023098.do > > And this at Amazon: "Effortless E-Commerce with PHP and MySQL" by > Larry Ullman http://amzn.com/0321656229 > > Also, not really knowing how much you need to do yourself, you could > probably get a leg up using existing frameworks and such. > > The multilingual aspects will certainly be tricky. Gettext is sort of > the standard for doing multilingual things, but in and of itself > doesn't really provide much help in understanding *how* to do > multilingual right, and can be problematic. Some frameworks do support > multilingual sites; I know drupal does, for example, and includes > quite a lot of other things that can help you build an e-commerce site > rather quickly, but drupal itself has a rather steep learning curve. > > Passages of just plain text aren't that difficult; it's when you start > constructing displayed text dynamically that it will be trickier, for > certain. > > Just thinking off the top of my head; you will likely need something > other than just gettext with it's separate language files for things > like product descriptions. I think it gets rather difficult, and > probably bad form, to have your separate strings in files in your code > base linked to data base entries; simpler just to store the various > multilingual data base bits in the data base itself. But you can see > how complex it gets. > > At any rate, I hope you have a fair bit of experience in building > dynamic internet sites already, this is not going to be easy. >
Re: [PHP] how to build multilingual e-commerce website
On Fri, Dec 28, 2012 at 5:19 AM, Sachin Raut wrote: > Dear Friends, > > I have to develop multilingual e-commerce (clothing) website. Could anyone > who has developed these kind of sites before guide me on how to start the > development or recommend any tutorial / book for developing these kind of > sites? > > Would really appreciate any inut regarding this. > > regards > Sachin Raut There's this at O'Reilly: "Building eCommerce Applications" http://shop.oreilly.com/product/0636920023098.do And this at Amazon: "Effortless E-Commerce with PHP and MySQL" by Larry Ullman http://amzn.com/0321656229 Also, not really knowing how much you need to do yourself, you could probably get a leg up using existing frameworks and such. The multilingual aspects will certainly be tricky. Gettext is sort of the standard for doing multilingual things, but in and of itself doesn't really provide much help in understanding *how* to do multilingual right, and can be problematic. Some frameworks do support multilingual sites; I know drupal does, for example, and includes quite a lot of other things that can help you build an e-commerce site rather quickly, but drupal itself has a rather steep learning curve. Passages of just plain text aren't that difficult; it's when you start constructing displayed text dynamically that it will be trickier, for certain. Just thinking off the top of my head; you will likely need something other than just gettext with it's separate language files for things like product descriptions. I think it gets rather difficult, and probably bad form, to have your separate strings in files in your code base linked to data base entries; simpler just to store the various multilingual data base bits in the data base itself. But you can see how complex it gets. At any rate, I hope you have a fair bit of experience in building dynamic internet sites already, this is not going to be easy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to build multilingual e-commerce website
Op 28 dec. 2012 12:20 schreef "Sachin Raut" het volgende: > > Dear Friends, > > I have to develop multilingual e-commerce (clothing) website. Could anyone > who has developed these kind of sites before guide me on how to start the > development or recommend any tutorial / book for developing these kind of > sites? > > Would really appreciate any inut regarding this. > > regards > Sachin Raut How about you just take an open source ecommerce o package, and modify/extend that if you need more functions? I would not recommend reinventing the wheel. Also I doubt there is a tutorial/book on this. As always, source code is probably the best documentation you can get. - Matijn
Re: [PHP] how to build multilingual e-commerce website
Bastien Koert On 2012-12-28, at 6:19 AM, Sachin Raut wrote: > Dear Friends, > > I have to develop multilingual e-commerce (clothing) website. Could anyone > who has developed these kind of sites before guide me on how to start the > development or recommend any tutorial / book for developing these kind of > sites? > > Would really appreciate any inut regarding this. > > regards > Sachin Raut Start by looking at magento. It's a great ecom shop software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to build multilingual e-commerce website
Dear Friends, I have to develop multilingual e-commerce (clothing) website. Could anyone who has developed these kind of sites before guide me on how to start the development or recommend any tutorial / book for developing these kind of sites? Would really appreciate any inut regarding this. regards Sachin Raut
Re: [PHP] how to read emails with php
On 4 December 2012 19:24, Farzan Dalaee wrote: > Warning: imap_open() [function.imap-open]: Couldn't open stream > mail.mydomain.net:143/pop3INBOX in C:\xampp\htdocs\mail.php on line 6 > > this is my code > > $host = 'mail.mydomain.net:143/pop3'; > $user = 'x...@mydomain.net'; > $password = 'myPassword'; > $mailbox = "{$host}INBOX"; ^^^ PHP interprets that as "insert $host in string" and removes the curly braces. Try $mailbox = "{mail.mydomain.net:143/pop3}INBOX"; Cheers, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to read emails with php
On Tue, Dec 4, 2012 at 12:24 PM, Farzan Dalaee wrote: > Warning: imap_open() [function.imap-open]: Couldn't open stream > mail.mydomain.net:143/pop3INBOX in C:\xampp\htdocs\mail.php on line 6 > > Warning: imap_check() expects parameter 1 to be resource, boolean > given in C:\xampp\htdocs\mail.php on line 10 > > Notice: Unknown: Can't open mailbox mail.mydomain.net:143/pop3INBOX: > no such mailbox (errflg=2) in Unknown on line 0 > > > this is my code > > $host = 'mail.mydomain.net:143/pop3'; I'm not hugely familiar with PHP's imap -- but are you trying to connect using the IMAP port (143) but with the POP3 protocol? POP3 is port 110... > $user = 'x...@mydomain.net'; > $password = 'myPassword'; > $mailbox = "{$host}INBOX"; > $mbx = imap_open($mailbox , $user , $password); You might consider checking if $mbx === false here, since if imap_open, it will return false. Then check imap_last_errors/imap_errors to see what the error(s) is(are). if (false === $mbx) exit ("can't connect to $mailbox: ". imap_last_error() . PHP_EOL); > > $check = imap_check($mbx); > > > On 12/4/12, Jonathan Sundquist wrote: >> What does it say when you call imap_errors or imap_last_error? >> >> >> On Tue, Dec 4, 2012 at 10:02 AM, Farzan Dalaee >> wrote: >> >>> i dont have access to log files on server >>> >>> On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: >>> >>> > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee >>> wrote: >>> >> hi guys >>> >> i want to open an email content ( subject ,body , attachment ) with >>> >> php >>> >> i use imap_php but its wont connect to host >>> >> what should i do? >>> >> thanx >>> >>> > >>> >Start by finding out why it won't connect. Check the logs on the >>> > server if you can, that's always the best place to look first. >>> > >>> > -- >>> > >>> > Network Infrastructure Manager >>> > http://www.php.net/ >>> >>> >>> -- >>> 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] how to read emails with php
On 12/04/2012 05:10 AM, Farzan Dalaee wrote: hi guys i want to open an email content ( subject ,body , attachment ) with php i use imap_php but its wont connect to host what should i do? thanx As others have suggested, try connecting using telnet from the same server you are running the PHP from. Here is a page I wrote a while back that shows you how to do this. http://bendsource.cmsws.com/serverSetup -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://bendsource.cmsws.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to read emails with php
I think so, so my code is correct and it should be working, thanks you all for your time Best Regard Farzan DalaeeJonathan Sundquist wrote:It is very likely that the host you are using is blocking access to that port. Also depending on the host you are going to you may need to enable imap as well. On Tue, Dec 4, 2012 at 12:44 PM, Farzan Dalaee wrote: Same error I think its need something else for opening service like ssl setting or somthing like that Or this host im using block imap or pop3 access Best Regard Farzan Dalaee On Dec 4, 2012 10:03 PM, "Jonathan Sundquist" wrote: Try removing the call to the inbox and try getting a list of all the folders using imap_listmailbox($host, "*"); On Tue, Dec 4, 2012 at 12:24 PM, Farzan Dalaee wrote: Warning: imap_open() [function.imap-open]: Couldn't open stream mail.mydomain.net:143/pop3INBOX in C:\xampp\htdocs\mail.php on line 6 Warning: imap_check() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\mail.php on line 10 Notice: Unknown: Can't open mailbox mail.mydomain.net:143/pop3INBOX: no such mailbox (errflg=2) in Unknown on line 0 this is my code $host = 'mail.mydomain.net:143/pop3'; $user = 'x...@mydomain.net'; $password = 'myPassword'; $mailbox = "{$host}INBOX"; $mbx = imap_open($mailbox , $user , $password); $check = imap_check($mbx); On 12/4/12, Jonathan Sundquist wrote: > What does it say when you call imap_errors or imap_last_error? > > > On Tue, Dec 4, 2012 at 10:02 AM, Farzan Dalaee > wrote: > >> i dont have access to log files on server >> >> On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: >> >> > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee >> wrote: >> >> hi guys >> >> i want to open an email content ( subject ,body , attachment ) with >> >> php >> >> i use imap_php but its wont connect to host >> >> what should i do? >> >> thanx >> >> > >> > Start by finding out why it won't connect. Check the logs on the >> > server if you can, that's always the best place to look first. >> > >> > -- >> > >> > Network Infrastructure Manager >> > http://www.php.net/ >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >
Re: [PHP] how to read emails with php
On Tue, Dec 4, 2012 at 1:44 PM, Farzan Dalaee wrote: > Same error > I think its need something else for opening service like ssl setting or > somthing like that > Or this host im using block imap or pop3 access Per list rules, please don't top-post. Some things to consider: 1.) Incorrect domain name. Be sure the domain is spelled correctly and is registered. 2.) System not configured to serve IMAP. 3.) Firewall blocking access to port 143. 4.) Host down. Try pinging the domain. If you get a response back, try either using Telnet to connect to the domain on port 143 or using an email client with the same access details and credentials you're trying to use in your code. At this point, it's evident that it's not a PHP problem, so you'll need to research the rest on your own. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to read emails with php
It is very likely that the host you are using is blocking access to that port. Also depending on the host you are going to you may need to enable imap as well. On Tue, Dec 4, 2012 at 12:44 PM, Farzan Dalaee wrote: > Same error > I think its need something else for opening service like ssl setting or > somthing like that > Or this host im using block imap or pop3 access > > Best Regard > Farzan Dalaee > On Dec 4, 2012 10:03 PM, "Jonathan Sundquist" > wrote: > >> Try removing the call to the inbox and try getting a list of all the >> folders using imap_listmailbox($host, "*"); >> >> >> On Tue, Dec 4, 2012 at 12:24 PM, Farzan Dalaee >> wrote: >> >>> Warning: imap_open() [function.imap-open]: Couldn't open stream >>> mail.mydomain.net:143/pop3INBOX in C:\xampp\htdocs\mail.php on line 6 >>> >>> Warning: imap_check() expects parameter 1 to be resource, boolean >>> given in C:\xampp\htdocs\mail.php on line 10 >>> >>> Notice: Unknown: Can't open mailbox mail.mydomain.net:143/pop3INBOX: >>> no such mailbox (errflg=2) in Unknown on line 0 >>> >>> >>> this is my code >>> >>> $host = 'mail.mydomain.net:143/pop3'; >>> $user = 'x...@mydomain.net'; >>> $password = 'myPassword'; >>> $mailbox = "{$host}INBOX"; >>> $mbx = imap_open($mailbox , $user , $password); >>> >>> $check = imap_check($mbx); >>> >>> >>> On 12/4/12, Jonathan Sundquist wrote: >>> > What does it say when you call imap_errors or imap_last_error? >>> > >>> > >>> > On Tue, Dec 4, 2012 at 10:02 AM, Farzan Dalaee >>> > wrote: >>> > >>> >> i dont have access to log files on server >>> >> >>> >> On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: >>> >> >>> >> > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee < >>> farzan.dal...@gmail.com> >>> >> wrote: >>> >> >> hi guys >>> >> >> i want to open an email content ( subject ,body , attachment ) with >>> >> >> php >>> >> >> i use imap_php but its wont connect to host >>> >> >> what should i do? >>> >> >> thanx >>> >> >>> >> > >>> >> >Start by finding out why it won't connect. Check the logs on the >>> >> > server if you can, that's always the best place to look first. >>> >> > >>> >> > -- >>> >> > >>> >> > Network Infrastructure Manager >>> >> > http://www.php.net/ >>> >> >>> >> >>> >> -- >>> >> PHP General Mailing List (http://www.php.net/) >>> >> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >>> >> >>> > >>> >> >>
Re: [PHP] how to read emails with php
Same error I think its need something else for opening service like ssl setting or somthing like that Or this host im using block imap or pop3 access Best Regard Farzan Dalaee On Dec 4, 2012 10:03 PM, "Jonathan Sundquist" wrote: > Try removing the call to the inbox and try getting a list of all the > folders using imap_listmailbox($host, "*"); > > > On Tue, Dec 4, 2012 at 12:24 PM, Farzan Dalaee wrote: > >> Warning: imap_open() [function.imap-open]: Couldn't open stream >> mail.mydomain.net:143/pop3INBOX in C:\xampp\htdocs\mail.php on line 6 >> >> Warning: imap_check() expects parameter 1 to be resource, boolean >> given in C:\xampp\htdocs\mail.php on line 10 >> >> Notice: Unknown: Can't open mailbox mail.mydomain.net:143/pop3INBOX: >> no such mailbox (errflg=2) in Unknown on line 0 >> >> >> this is my code >> >> $host = 'mail.mydomain.net:143/pop3'; >> $user = 'x...@mydomain.net'; >> $password = 'myPassword'; >> $mailbox = "{$host}INBOX"; >> $mbx = imap_open($mailbox , $user , $password); >> >> $check = imap_check($mbx); >> >> >> On 12/4/12, Jonathan Sundquist wrote: >> > What does it say when you call imap_errors or imap_last_error? >> > >> > >> > On Tue, Dec 4, 2012 at 10:02 AM, Farzan Dalaee >> > wrote: >> > >> >> i dont have access to log files on server >> >> >> >> On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: >> >> >> >> > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee < >> farzan.dal...@gmail.com> >> >> wrote: >> >> >> hi guys >> >> >> i want to open an email content ( subject ,body , attachment ) with >> >> >> php >> >> >> i use imap_php but its wont connect to host >> >> >> what should i do? >> >> >> thanx >> >> >> >> > >> >> >Start by finding out why it won't connect. Check the logs on the >> >> > server if you can, that's always the best place to look first. >> >> > >> >> > -- >> >> > >> >> > Network Infrastructure Manager >> >> > http://www.php.net/ >> >> >> >> >> >> -- >> >> PHP General Mailing List (http://www.php.net/) >> >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >> >> > >> > >
Re: [PHP] how to read emails with php
Try removing the call to the inbox and try getting a list of all the folders using imap_listmailbox($host, "*"); On Tue, Dec 4, 2012 at 12:24 PM, Farzan Dalaee wrote: > Warning: imap_open() [function.imap-open]: Couldn't open stream > mail.mydomain.net:143/pop3INBOX in C:\xampp\htdocs\mail.php on line 6 > > Warning: imap_check() expects parameter 1 to be resource, boolean > given in C:\xampp\htdocs\mail.php on line 10 > > Notice: Unknown: Can't open mailbox mail.mydomain.net:143/pop3INBOX: > no such mailbox (errflg=2) in Unknown on line 0 > > > this is my code > > $host = 'mail.mydomain.net:143/pop3'; > $user = 'x...@mydomain.net'; > $password = 'myPassword'; > $mailbox = "{$host}INBOX"; > $mbx = imap_open($mailbox , $user , $password); > > $check = imap_check($mbx); > > > On 12/4/12, Jonathan Sundquist wrote: > > What does it say when you call imap_errors or imap_last_error? > > > > > > On Tue, Dec 4, 2012 at 10:02 AM, Farzan Dalaee > > wrote: > > > >> i dont have access to log files on server > >> > >> On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: > >> > >> > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee < > farzan.dal...@gmail.com> > >> wrote: > >> >> hi guys > >> >> i want to open an email content ( subject ,body , attachment ) with > >> >> php > >> >> i use imap_php but its wont connect to host > >> >> what should i do? > >> >> thanx > >> > >> > > >> >Start by finding out why it won't connect. Check the logs on the > >> > server if you can, that's always the best place to look first. > >> > > >> > -- > >> > > >> > Network Infrastructure Manager > >> > http://www.php.net/ > >> > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > >
Re: [PHP] how to read emails with php
Warning: imap_open() [function.imap-open]: Couldn't open stream mail.mydomain.net:143/pop3INBOX in C:\xampp\htdocs\mail.php on line 6 Warning: imap_check() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\mail.php on line 10 Notice: Unknown: Can't open mailbox mail.mydomain.net:143/pop3INBOX: no such mailbox (errflg=2) in Unknown on line 0 this is my code $host = 'mail.mydomain.net:143/pop3'; $user = 'x...@mydomain.net'; $password = 'myPassword'; $mailbox = "{$host}INBOX"; $mbx = imap_open($mailbox , $user , $password); $check = imap_check($mbx); On 12/4/12, Jonathan Sundquist wrote: > What does it say when you call imap_errors or imap_last_error? > > > On Tue, Dec 4, 2012 at 10:02 AM, Farzan Dalaee > wrote: > >> i dont have access to log files on server >> >> On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: >> >> > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee >> wrote: >> >> hi guys >> >> i want to open an email content ( subject ,body , attachment ) with >> >> php >> >> i use imap_php but its wont connect to host >> >> what should i do? >> >> thanx >> >> > >> >Start by finding out why it won't connect. Check the logs on the >> > server if you can, that's always the best place to look first. >> > >> > -- >> > >> > Network Infrastructure Manager >> > http://www.php.net/ >> >> >> -- >> 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] how to read emails with php
What does it say when you call imap_errors or imap_last_error? On Tue, Dec 4, 2012 at 10:02 AM, Farzan Dalaee wrote: > i dont have access to log files on server > > On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: > > > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee > wrote: > >> hi guys > >> i want to open an email content ( subject ,body , attachment ) with php > >> i use imap_php but its wont connect to host > >> what should i do? > >> thanx > > > > >Start by finding out why it won't connect. Check the logs on the > > server if you can, that's always the best place to look first. > > > > -- > > > > Network Infrastructure Manager > > http://www.php.net/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] how to read emails with php
i dont have access to log files on server On Azar 14, 1391, at 5:51 PM, Daniel Brown wrote: > On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee wrote: >> hi guys >> i want to open an email content ( subject ,body , attachment ) with php >> i use imap_php but its wont connect to host >> what should i do? >> thanx > >Start by finding out why it won't connect. Check the logs on the > server if you can, that's always the best place to look first. > > -- > > Network Infrastructure Manager > http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to read emails with php
On Tue, Dec 4, 2012 at 8:10 AM, Farzan Dalaee wrote: > hi guys > i want to open an email content ( subject ,body , attachment ) with php > i use imap_php but its wont connect to host > what should i do? > thanx Start by finding out why it won't connect. Check the logs on the server if you can, that's always the best place to look first. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to read emails with php
hi guys i want to open an email content ( subject ,body , attachment ) with php i use imap_php but its wont connect to host what should i do? thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get a PHP bug fixed?
On Sat, Nov 17, 2012 at 1:51 AM, Enumag wrote: > Hi, there is a bug I'd like to be fixed and even a patch is available. But > there is still no reaction at all after 2 years. What else can I do to get > the bug fixed? > > https://bugs.php.net/bug.php?id=45351 - patch available from 2010-06-13 > https://bugs.php.net/bug.php?id=48724 - patch available from 2012-04-13 The PHP General mailing list is only for discussing the use of the language and developing in PHP, not really for the development of the language itself. Instead, you should try to discuss these things on the PHP Internals list at intern...@lists.php.net. You may also want to speak with some of the developers via IRC on EFnet #php.pecl to discuss if there is any interest in patching the bugs you've mentioned. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get a PHP bug fixed?
On Sat, 17 Nov 2012, Enumag wrote: Hi, there is a bug I'd like to be fixed and even a patch is available. But there is still no reaction at all after 2 years. What else can I do to get the bug fixed? https://bugs.php.net/bug.php?id=45351 - patch available from 2010-06-13 https://bugs.php.net/bug.php?id=48724 - patch available from 2012-04-13 It looks like there is a thread about that on the PHP Bugzilla, but it is not admitted as a patch to be accepted. Maybe you might try by GitHub, making a pull request. iñ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get a PHP bug fixed?
Hi, there is a bug I'd like to be fixed and even a patch is available. But there is still no reaction at all after 2 years. What else can I do to get the bug fixed? https://bugs.php.net/bug.php?id=45351 - patch available from 2010-06-13 https://bugs.php.net/bug.php?id=48724 - patch available from 2012-04-13
Re: [PHP] How to limit source IP in PHP
Sorry for the top post but I don't have my laptop with me and, well frankly I'm too tired to be arsed! I think the confusion is coming from the word bind. I don't think man people at aware of he difference between binding a socket and having it listen on the port to which it's bound. People... when you make an outgoing connect ion (using the curl functions, the socket functions, or whatever), the socket is bound to an IP and arbitrary port on the network interface over which the connection is being made. Antonio is wanting to specify which IP address on the interface is used (this is the IP address from which the other end will see the connection coming). This is not hard to understand but it's not well known that the bonding process happens to both ends of a socket connection, and from what I've seen nobody has bothered to explain that. Apache, nginx, whatever the web server is has nothing to do with the question. I hope that helps clear it up for those who are confused. -Stuart -- Sent from my leaf blower On 14 Sep 2012 21:01, "Tonix (Antonio Nati)" wrote: > Il 14/09/2012 21:19, Jim Lucas ha scritto: > >> On 09/13/2012 04:15 PM, Tonix (Antonio Nati) wrote: >> >>> >>> Jim, sorry but you did not read carefully my posts. >>> >>> Since the fist post, I ALWAYS spoke about connections a PHP script may >>> open autonomously (what you name second connection). >>> >>> I'm never speaking about listening/intercepting/using the original HTTP >>> request. >>> >> >> Then why did you bring up apache? That seems to be the source of >> confusion... >> >> > There is no confusion at all. > > When a script is executing under apache, it can do whatever it wants > (within its permissions of course), opening other sockets and making any > kind of processing and IO. It does not interphere with apache connections, > it just uses new connections. > > So, my request is clear: how to force a PHP script to bind only to > permitted IP (i.e. using directive similar to OPEN_BASEDIR). > > The answer is clear. Actually PHP cannot force a PHP script to bind only > to specific IPs. > > So I've filed a request in PHP bug's repository for examining this > possibility. > > In a multi IP apache configuration, I feel right each PHP script should > only (eventually) bind to the IP where the connection is received, or to a > permitted IP. > > Hope this helps. > > Tonino > > > > -- > --**-- > Inter@zioniInterazioni di Antonio Nati >http://www.interazioni.it to...@interazioni.it > --**-- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] How to limit source IP in PHP
Il 14/09/2012 21:19, Jim Lucas ha scritto: On 09/13/2012 04:15 PM, Tonix (Antonio Nati) wrote: Jim, sorry but you did not read carefully my posts. Since the fist post, I ALWAYS spoke about connections a PHP script may open autonomously (what you name second connection). I'm never speaking about listening/intercepting/using the original HTTP request. Then why did you bring up apache? That seems to be the source of confusion... There is no confusion at all. When a script is executing under apache, it can do whatever it wants (within its permissions of course), opening other sockets and making any kind of processing and IO. It does not interphere with apache connections, it just uses new connections. So, my request is clear: how to force a PHP script to bind only to permitted IP (i.e. using directive similar to OPEN_BASEDIR). The answer is clear. Actually PHP cannot force a PHP script to bind only to specific IPs. So I've filed a request in PHP bug's repository for examining this possibility. In a multi IP apache configuration, I feel right each PHP script should only (eventually) bind to the IP where the connection is received, or to a permitted IP. Hope this helps. Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On 09/13/2012 04:15 PM, Tonix (Antonio Nati) wrote: Jim, sorry but you did not read carefully my posts. Since the fist post, I ALWAYS spoke about connections a PHP script may open autonomously (what you name second connection). I'm never speaking about listening/intercepting/using the original HTTP request. Then why did you bring up apache? That seems to be the source of confusion... It is well clear for anyone with a minimum knowledge of programming in apache that only apache listens and answers from the binded port of httpd. And, of course, any program/script/binary called from apache, will return his data to apache, and apache only will send them back to the original requester. That is why your mentioning Apache confused me (and probably others). At the same time it is well clear too that each called program/script/binary may live autonomously before returning data to apache, and do whatever action it requires to do, including the opening of a network socket to an external or internal server. Your still talking about Apache... And this is true for any language, from perl to C to PHP. Only first two replies understood the initial request, all other just added confusion to the thread. Regards, Tonino Which is it that you are talking about? PHP running through Apache or a dedicated PHP script running on its own as a daemon? -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On 09/12/2012 08:21 AM, Daniel Brown wrote: On Wed, Sep 12, 2012 at 10:18 AM, Tonix (Antonio Nati) wrote: Is PHP able to 'force' binding IP? I hoped there was an external directive I did not see, but probably this is a PHP lack. Not at all. Essentially, PHP is an interface to underlying software, OS commands, and APIs. You'd have to configure the system to bind requests, as PHP does not presently have that capability (and, to my knowledge, there's no plan to change that). Daniel, Correct me if I wrong, but you could use the stream_* functions within a process running as a daemon that can listen on a given IP:port . I do this on my php scripts right now. It accepts, processes, and responds to the client connections without the need of any other applications. And, it responds to the client from the IP & PORT that the client made the connection to. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to track for Allowed memory size ?
Hello, is there a way how to track for allowed memory size on ? I receive this error in one class that process sql querys. I want to check somehow when query is processed do php return this error and if this is happened to log sql query in file to can I optimize it latter. I.D. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Are you looking to use sockets? That's the only thing I can think of when you speak of binding to an ip address/port... http://php.net/manual/en/book.sockets.php ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Il 14/09/2012 00:09, Jim Lucas ha scritto: On 09/13/2012 12:55 PM, Tonix (Antonio Nati) wrote: Il 13/09/2012 21:41, Jim Lucas ha scritto: On 09/13/2012 12:28 PM, Tonix (Antonio Nati) wrote: You are speaking about incoming connections, I suppose. I'm speaking about connections started from within PHP. Which is a response to the incoming connection. And so? There is no relation between the call received from Apache (which is not passed to PHP), and any connection PHP may open later. My experience has always been, with Apache and lighttpd at least, that the response comes from the IP:PORT that the request was made to. Jim, sorry but you did not read carefully my posts. Since the fist post, I ALWAYS spoke about connections a PHP script may open autonomously (what you name second connection). I'm never speaking about listening/intercepting/using the original HTTP request. It is well clear for anyone with a minimum knowledge of programming in apache that only apache listens and answers from the binded port of httpd. And, of course, any program/script/binary called from apache, will return his data to apache, and apache only will send them back to the original requester. At the same time it is well clear too that each called program/script/binary may live autonomously before returning data to apache, and do whatever action it requires to do, including the opening of a network socket to an external or internal server. And this is true for any language, from perl to C to PHP. Only first two replies understood the initial request, all other just added confusion to the thread. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On 09/13/2012 12:55 PM, Tonix (Antonio Nati) wrote: Il 13/09/2012 21:41, Jim Lucas ha scritto: On 09/13/2012 12:28 PM, Tonix (Antonio Nati) wrote: You are speaking about incoming connections, I suppose. I'm speaking about connections started from within PHP. Which is a response to the incoming connection. And so? There is no relation between the call received from Apache (which is not passed to PHP), and any connection PHP may open later. My experience has always been, with Apache and lighttpd at least, that the response comes from the IP:PORT that the request was made to. So, if I connect to http://10.10.10.10/ Then the response is going to come from PORT 80. You might want to run a little trafshow on your server to see how the traffic behaves. I have a number of web servers that I run, all with either apache or lighttpd, and they all behave this way. Here is the output of my http request from my office to my server: From Address To Address ProBytes CPS == 66.39.178.2..58479 66.39.167.51..80 tcp 725 12 66.39.167.51..80 66.39.178.2..58479 tcp 2720 66.39.178.2..52515 66.39.167.51..80 tcp 1303 66.39.178.2..54506 66.39.167.51..80 tcp 696 66.39.178.2..62658 66.39.167.51..80 tcp 700 66.39.178.2..65382 66.39.167.51..80 tcp 700 66.39.167.51..80 66.39.178.2..52515 tcp 545 66.39.178.2..50794 66.39.167.51..80 tcp 700 66.39.178.2..65015 66.39.167.51..80 tcp 711 66.39.167.51..80 66.39.178.2..54506 tcp 305 66.39.167.51..80 66.39.178.2..62658 tcp 305 66.39.167.51..80 66.39.178.2..65382 tcp 357 66.39.167.51..80 66.39.178.2..50794 tcp 357 66.39.167.51..80 66.39.178.2..65015 tcp 357 This is running Apache. Unless you are talking about PHP being ran from cron or the CLI. if you are talking about YOU running a PHP script as a daemon, then yes, you have the ability to BIND to an IP address. I do this in a few scripts/daemons of mine. I use the stream_* functions for this. But, if you are talking about calling fopen() from the CLI and have it "bind" to a specific IP when connecting out, that is more of a OS specific option. You will need to find out how to run a php script and have it "bind" to a given IP (or interface) when it connects to the WWW. When apache starts a php script, the script can open a socket towards another end-point, asking to bind to any local address as source address. But this is a secondary connection (that you open in process) and has nothing to do with the request connection to the server from the client. Period. Regards, Tonino -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Il 13/09/2012 21:41, Jim Lucas ha scritto: On 09/13/2012 12:28 PM, Tonix (Antonio Nati) wrote: You are speaking about incoming connections, I suppose. I'm speaking about connections started from within PHP. Which is a response to the incoming connection. And so? There is no relation between the call received from Apache (which is not passed to PHP), and any connection PHP may open later. Unless you are talking about PHP being ran from cron or the CLI. if you are talking about YOU running a PHP script as a daemon, then yes, you have the ability to BIND to an IP address. I do this in a few scripts/daemons of mine. I use the stream_* functions for this. But, if you are talking about calling fopen() from the CLI and have it "bind" to a specific IP when connecting out, that is more of a OS specific option. You will need to find out how to run a php script and have it "bind" to a given IP (or interface) when it connects to the WWW. When apache starts a php script, the script can open a socket towards another end-point, asking to bind to any local address as source address. Period. Regards, Tonino Hope this helps. Jim Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On 09/13/2012 12:28 PM, Tonix (Antonio Nati) wrote: You are speaking about incoming connections, I suppose. I'm speaking about connections started from within PHP. Which is a response to the incoming connection. Unless you are talking about PHP being ran from cron or the CLI. if you are talking about YOU running a PHP script as a daemon, then yes, you have the ability to BIND to an IP address. I do this in a few scripts/daemons of mine. I use the stream_* functions for this. But, if you are talking about calling fopen() from the CLI and have it "bind" to a specific IP when connecting out, that is more of a OS specific option. You will need to find out how to run a php script and have it "bind" to a given IP (or interface) when it connects to the WWW. Hope this helps. Jim Regards, Tonino -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Il 13/09/2012 18:19, Mihamina Rakotomandimby ha scritto: On 09/12/2012 04:53 PM, Tonix (Antonio Nati) wrote: PHP script can freely choose which IP to bind. PHP doesnt bind at all. The HTTP server (Apache, Lighthttpd,...) does. PHP is called only when the HTTP server wants (you configure it that way): make Apache handle PHP on conditionnal REMOTE_HOST if possible (I did not look deep into APache documentation) PHP is like any other programming language. After it is called by apache, he can read and write files, as well as opening incoming and outgoing connections. Please check carefully http://www.php.net/manual/en/book.sockets.php. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Il 13/09/2012 18:16, Mihamina Rakotomandimby ha scritto: On 09/12/2012 07:02 PM, Daniel Brown wrote: So, the answer is no, PHP is not able to do that. There is an (heavy) BASEDIR directive for disk, but nothing equivalent (and simpler) for IP. That's correct. However, that doesn't mean you can't put in a feature request at https://bugs.php.net/ to see if it can be included in a future release. PHP handler is triggered depending on the request (ie: GET /dir/file.php) The HTTP transaction stil has to be initiated fisrt then. The TCP connection has been opened before the HTTP gets to Apache. No chance PHP could change the binding IP. Filing the request is IMHO technically irrelevant. You are speaking about incoming connections, I suppose. I'm speaking about connections started from within PHP. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On 09/12/2012 04:53 PM, Tonix (Antonio Nati) wrote: PHP script can freely choose which IP to bind. PHP doesnt bind at all. The HTTP server (Apache, Lighthttpd,...) does. PHP is called only when the HTTP server wants (you configure it that way): make Apache handle PHP on conditionnal REMOTE_HOST if possible (I did not look deep into APache documentation) -- RMA. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On 09/12/2012 07:02 PM, Daniel Brown wrote: So, the answer is no, PHP is not able to do that. There is an (heavy) BASEDIR directive for disk, but nothing equivalent (and simpler) for IP. That's correct. However, that doesn't mean you can't put in a feature request at https://bugs.php.net/ to see if it can be included in a future release. PHP handler is triggered depending on the request (ie: GET /dir/file.php) The HTTP transaction stil has to be initiated fisrt then. The TCP connection has been opened before the HTTP gets to Apache. No chance PHP could change the binding IP. Filing the request is IMHO technically irrelevant. -- RMA. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Il 12/09/2012 17:52, Tommy Pham ha scritto: On Wed, Sep 12, 2012 at 7:18 AM, Tonix (Antonio Nati) wrote: Il 12/09/2012 16:08, Tommy Pham ha scritto: On Wed, Sep 12, 2012 at 6:53 AM, Tonix (Antonio Nati) wrote: Is there a way to force a PHP script to bind to a prefixed IP? Actually, while you can assign more IPs to Apache for listening, assigning domains to specific IPs, it looks like any PHP script can freely choose which IP to bind. Instead I'd love some domains are permitted to open connections only from the domain IP. In FreeBSD I do it easily, setting up dedicated jails for domains. But how to do it simply using PHP on Linux? Regards, Tonino Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it 1) Use Listen in Apache 2) Use VM such as KVM, VMWare, etc. 3) Make an array containing permissible domains. Check the $_SERVER['SERVER_NAME'] if exists in that array. React/respond accordingly. 1) is only for listening. 2) means a VPS for each domain, which we already do with vmware and FreeBSD jails, but it is too expensive for some customers. 3) means I'm writing the script, which is not the standard situation. You must suppose the script to be written from a malicious user in a shared environment. Is PHP able to 'force' binding IP? I hoped there was an external directive I did not see, but probably this is a PHP lack. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it 2) Previously you've mentioned that you were able to do that in FreeBSD jails. IIRC, the jails are similar to VMs in regards to isolating of environment and dedicated IP for that environment. It seems that you want something that is equivalent of jails and VM but not actual VM/jails. Are you referring to 1 application with one installed point but is used in multiple virtual domains and expect the application to act/respond accordingly to the requests for each virtual domain? Yes, I'm thinking of a low cost shared WEB hosting for people which has limited needs and don't want to spend more for a VM or a jail. In this environment, a well tailored su-exec, with different UID and group for each user, makes an excellent job for protecting disk areas, so the unique point which remains uncovered is to limit network access: * if you have internal interfaces in the same machine where you have public IPs, a web PHP application could try to use the internal address of the interface, exploring internal network (we avoid that thanks to jails). * if apache listens on a specific IP for a single domain, and listens on other IPs for others domains, it would be safe if each domain can use as source IP only the listening IP associated. In our specific case, we always use jails, so each apache is always within a jail and cannot explore other interfaces. When customers ask for dedicated IP, we setup another jail, but that means also one apache server for each domain, and it is justified only for big websites. So, it would be nice if it could exist something which could force a specific source IP or could force to use the listening IP (or both options), on any network binding operation. Of course a script could use external commands (like ping ot telnet) and escape this check, so we don't have complete security, unless we disable any network tool... but it would be a good start. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On Wed, Sep 12, 2012 at 11:38 AM, Tonix (Antonio Nati) wrote: > > So, the answer is no, PHP is not able to do that. > There is an (heavy) BASEDIR directive for disk, but nothing equivalent (and > simpler) for IP. That's correct. However, that doesn't mean you can't put in a feature request at https://bugs.php.net/ to see if it can be included in a future release. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On Wed, Sep 12, 2012 at 7:18 AM, Tonix (Antonio Nati) wrote: > Il 12/09/2012 16:08, Tommy Pham ha scritto: > >> On Wed, Sep 12, 2012 at 6:53 AM, Tonix (Antonio Nati) >> wrote: >>> >>> Is there a way to force a PHP script to bind to a prefixed IP? >>> >>> Actually, while you can assign more IPs to Apache for listening, >>> assigning >>> domains to specific IPs, it looks like any PHP script can freely choose >>> which IP to bind. Instead I'd love some domains are permitted to open >>> connections only from the domain IP. >>> >>> In FreeBSD I do it easily, setting up dedicated jails for domains. But >>> how >>> to do it simply using PHP on Linux? >>> >>> Regards, >>> >>> Tonino >>> >>> >>> Inter@zioniInterazioni di Antonio Nati >>> http://www.interazioni.it to...@interazioni.it >>> >>> >> 1) Use Listen in Apache >> 2) Use VM such as KVM, VMWare, etc. >> 3) Make an array containing permissible domains. Check the >> $_SERVER['SERVER_NAME'] if exists in that array. React/respond >> accordingly. >> > > 1) is only for listening. > 2) means a VPS for each domain, which we already do with vmware and FreeBSD > jails, but it is too expensive for some customers. > 3) means I'm writing the script, which is not the standard situation. > > You must suppose the script to be written from a malicious user in a shared > environment. > > Is PHP able to 'force' binding IP? I hoped there was an external directive I > did not see, but probably this is a PHP lack. > > Regards, > > Tonino > > > -- > > Inter@zioniInterazioni di Antonio Nati >http://www.interazioni.it to...@interazioni.it > > 2) Previously you've mentioned that you were able to do that in FreeBSD jails. IIRC, the jails are similar to VMs in regards to isolating of environment and dedicated IP for that environment. It seems that you want something that is equivalent of jails and VM but not actual VM/jails. Are you referring to 1 application with one installed point but is used in multiple virtual domains and expect the application to act/respond accordingly to the requests for each virtual domain? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Il 12/09/2012 17:21, Daniel Brown ha scritto: On Wed, Sep 12, 2012 at 10:18 AM, Tonix (Antonio Nati) wrote: Is PHP able to 'force' binding IP? I hoped there was an external directive I did not see, but probably this is a PHP lack. Not at all. Essentially, PHP is an interface to underlying software, OS commands, and APIs. You'd have to configure the system to bind requests, as PHP does not presently have that capability (and, to my knowledge, there's no plan to change that). So, the answer is no, PHP is not able to do that. There is an (heavy) BASEDIR directive for disk, but nothing equivalent (and simpler) for IP. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On Wed, Sep 12, 2012 at 10:18 AM, Tonix (Antonio Nati) wrote: > > Is PHP able to 'force' binding IP? I hoped there was an external directive I > did not see, but probably this is a PHP lack. Not at all. Essentially, PHP is an interface to underlying software, OS commands, and APIs. You'd have to configure the system to bind requests, as PHP does not presently have that capability (and, to my knowledge, there's no plan to change that). -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
Il 12/09/2012 16:08, Tommy Pham ha scritto: On Wed, Sep 12, 2012 at 6:53 AM, Tonix (Antonio Nati) wrote: Is there a way to force a PHP script to bind to a prefixed IP? Actually, while you can assign more IPs to Apache for listening, assigning domains to specific IPs, it looks like any PHP script can freely choose which IP to bind. Instead I'd love some domains are permitted to open connections only from the domain IP. In FreeBSD I do it easily, setting up dedicated jails for domains. But how to do it simply using PHP on Linux? Regards, Tonino Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it 1) Use Listen in Apache 2) Use VM such as KVM, VMWare, etc. 3) Make an array containing permissible domains. Check the $_SERVER['SERVER_NAME'] if exists in that array. React/respond accordingly. 1) is only for listening. 2) means a VPS for each domain, which we already do with vmware and FreeBSD jails, but it is too expensive for some customers. 3) means I'm writing the script, which is not the standard situation. You must suppose the script to be written from a malicious user in a shared environment. Is PHP able to 'force' binding IP? I hoped there was an external directive I did not see, but probably this is a PHP lack. Regards, Tonino -- Inter@zioniInterazioni di Antonio Nati http://www.interazioni.it to...@interazioni.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to limit source IP in PHP
On Wed, Sep 12, 2012 at 6:53 AM, Tonix (Antonio Nati) wrote: > > Is there a way to force a PHP script to bind to a prefixed IP? > > Actually, while you can assign more IPs to Apache for listening, assigning > domains to specific IPs, it looks like any PHP script can freely choose > which IP to bind. Instead I'd love some domains are permitted to open > connections only from the domain IP. > > In FreeBSD I do it easily, setting up dedicated jails for domains. But how > to do it simply using PHP on Linux? > > Regards, > > Tonino > > > Inter@zioniInterazioni di Antonio Nati >http://www.interazioni.it to...@interazioni.it > > 1) Use Listen in Apache 2) Use VM such as KVM, VMWare, etc. 3) Make an array containing permissible domains. Check the $_SERVER['SERVER_NAME'] if exists in that array. React/respond accordingly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php