RE: [PHP] Only allow one vhost to use exec() ?
Enable safe mode ON, and specify that specific directory in safe mode exec dir in php.ini. Alternatively, those settings can be set within Apache configuration (httpd.conf) per any Vhost directive. ... .. .. php_admin_flag safe_mode 1 ... Aras Koktas [EMAIL PROTECTED] Business Excellence Development Phi.dot Internet Systems -Original Message- From: MIKE YRABEDRA [mailto:[EMAIL PROTECTED] Sent: Friday, December 29, 2006 4:53 PM To: php-general@lists.php.net Subject: [PHP] Only allow one vhost to use exec() ? I want to be able to use the exec() function on my site, but do not want to allow all the other users that same ability. IS there a safe and secure way to limit the use of that function to a single virtualhost...maybe even a single page or directory? -- Mike B^)> -- 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] Best way to manage open slots for download
First of all, Happy New Year for everyone in the list. I wish 2007 brings all us happiness, health and peace. I want to read your advises at a point i am stuck within, i have an application that serves downloads to clients. For some reason i am limiting total open slot for some group of users (not related to my technical question). Example; // CHECKS SLOT HERE else { // IF THERE ANY AVAILABLE SLOTS SEND THE FILE // INCREMENT SLOT NUMBER BY 1 $fp = fopen($pathside,"r"); if ($fp) { while (!feof($fp)) { echo fread($fp, 334); $bytes_out += 334; ob_flush(); if ($bytes_out > $size) { // DECREASE SLOT NUMBER BY 1, BECAUSE THIS DOWNLOAD IS FINISHED } } } } Slots are recorded and checked from a simple mysql table. Everything works in this scenario. There is no problem if a person starts a download and finishes it, his slots get empty upon doing so. Yet if he cancelles the transfer, he will never reach my control structure to empty the slot. And slots will be full of zombies. I have thought of updating a mysql field for alive-connections in the while loop, but it will definitely add some load on my server. Updating a system file is not secure and good way. What other ways can you recommend to me for the situtation? Aras Koktas [EMAIL PROTECTED] Business Excellence Development Phi.dot Internet Systems -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Sockets - How to detect client disconnection?
I used Process Control Functions in PHP and installed some signals to catch socket disconnection. My attempt to do this in loops were a harder way or i could not manage it. There must be some notes about this in archives or i can send some of my code so that you can have a look at them. Aras Koktas [EMAIL PROTECTED] Business Excellence Development Phi.dot Internet Systems -Original Message- From: Anthony Rasmussen [mailto:[EMAIL PROTECTED] Sent: Saturday, January 06, 2007 11:12 PM To: php-general@lists.php.net Subject: [PHP] PHP Sockets - How to detect client disconnection? How do I detect a disconnected client from a socket resource? In an infinite loop, I socket_read() every open resource that passes a socket_select(). As far as I know, the only way to detect if the client disconnected unexpectedly from their socket resource is when socket_read() returns FALSE (which, during my testing, produced the warning: "An established connection was aborted by the software in your host machine."). However, socket_read() doesn't return FALSE on a disconnected client's socket resource until I first attempt to socket_write() to that resource. In brief pseudo code... socket_create(AF_INET, SOCK_STREAM, SOL_TCP) while (TRUE) foreach (resource where (false === socket_select($arrayofresources, NULL, NULL, 0, 0)) if (socket_read() === false) WON'T DETECT DISCONNECT UNTIL I FIRST socket_write() I appreciate any support you offer and thank you for your time. Best regards, -Tony _ Type your favorite song. Get a customized station. Try MSN Radio powered by Pandora. http://radio.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] what mail program I'm using?
Try sending a mail through command line manually. Than look at maillog maybe. # sendmail -t [EMAIL PROTECTED] < This is a test mail > EOF Aras Koktas [EMAIL PROTECTED] Business Excellence Development Phi.dot Internet Systems -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, January 12, 2007 10:03 PM To: php-general@lists.php.net Subject: [PHP] what mail program I'm using? hi, a moth ago we (company I work for) moved to new hosting company. we have dedicated sles10/php5/mysq5/apache2 based server. before, sending confirmation emails to clients using mail() functin was working fine. now, many of emails we send don't reach to receiver. first, I'm asssuming, server is not configured corerctly. Though, in header of the email I go on my yahoo account said: Received: by slesvernon.site (Postfix, from userid 2) according php documentation (php.net/manual/en/ref.mail.php) php use by default sendmail. but if other program is selected it has to be specified. do I have to specify it in php code or in php.ini (nothin is specified about Postfix right now in my php.ini)? Also, can't find (but almost sure I saw it before) the line for send back if error, like we have for: From: name <[EMAIL PROTECTED]> CC: name <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] Is it possible the get error back on specific email if email is not (for some reasons) delivered? Thanks for any help. -afan -- 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] remote fopen not working, despite allow_url_fopen = on
Alex, Either the domain you are trying to fetch data is unknown or your resolver settings do not point to a regular resolving server. (check /etc/resolv.conf) Aras Koktas [EMAIL PROTECTED] Business Excellence Development Phi.dot Internet Systems -Original Message- From: alex handle [mailto:[EMAIL PROTECTED] Sent: Thursday, February 15, 2007 3:52 PM To: php-general@lists.php.net Subject: [PHP] remote fopen not working, despite allow_url_fopen = on Hi all, i recently upgraded a server from freebsd 5.x to 6.2 php 4.4.2 -> php 4.4.4 apache 1.3 -> apache 2.2.4. It worked all great till i noticed that the remote fopen()/file() did not work. allow_url_fopen is set to "On" and the httpd-error.log shows this error message: [Thu Feb 15 14:15:42 2007] [error] [client xxx] PHP Warning: file() [function.file ]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /home/domains/x/xxx/tmp/remote.php on line 2 [Thu Feb 15 14:15:42 2007] [error] [client xxx] PHP Warning: file( http://google.com/) [function.file]: failed to open stream: Invalid argument in /home/domains/x/xxx/tmp/remote.php on line 2 A lynx from the server to google.com works. Then i put google.com in the /etc/hosts file and i got this message: [Thu Feb 15 14:19:47 2007] [error] [client xxx] PHP Warning: file( http://google.com/) [function.file]: failed to open stream: HTTP request failed! in /home/domains/x/xxx/tmp/remote.php on line 2 With curl i can fetch remote content, but i have to put the domainname in the hosts file. Verry strange!? Here my test file: http://google.com/')); ?> phpinfo and configure.log of the freebsd-ports is attached Thanks in advance! Alex
RE: [PHP] remote fopen not working, despite allow_url_fopen = on
I do suppose this as a networking error rather than a php problem, or a bug which may be caused by your current combination of OS and software set. By the way, allow_url_fopen is set to OFF, not ON, as it is in the attachement of phpinfo in your previous mail. That would produce a different error i know, but an apache restart may be one more trial for this to work. Aras Koktas [EMAIL PROTECTED] Business Excellence Development Phi.dot Internet Systems -Original Message- From: alex handle [mailto:[EMAIL PROTECTED] Sent: Thursday, February 15, 2007 4:34 PM To: Aras Cc: php-general@lists.php.net Subject: Re: [PHP] remote fopen not working, despite allow_url_fopen = on Hello Aras! my /etc/resolv.conf is ok - a "host google.com" works and i can reach google.com with lynx. There are no firewall or dns issues on the server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] signal handling
Hello Despite all of my results to succeed, i can not make this work. What i want to do is to write a simple socket server in PHP. My current example just prints the same character, you send to server from keyboard. It is successfull in forking, and generates child as people connect. However in any way the client exits, the child process remains defunct on system. I am trying to use signal handling, but some comments say through hanging sockets, it is not possible to handle signals. How can i stop this from happening, i am attaching the code i am working on, the 2 signals added at the bottom are just for test there, i tried all other signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process when the client exits does not kill it too, it still is defunct. My code: http://pastey.net/2910 Thanks! Aras -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and connection to mail account
Forward the e-mail address to a PHP file, through forwarders in your system (depends on the mta, how and where) Than design a php file to read from php://stdin It will read the mails once they are received. --Aras -Original Message- From: Angelo Zanetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 13, 2006 4:18 PM To: PHP List Subject: [PHP] PHP and connection to mail account Dear All. Do u know if its possible with PHP to receive a mail or connect to a mail box and do something with an incomming email ? I see there is that imap_open() but also there are sockets. Basically I need to connect to a mailbox and then when a mail is received it must take that mail and do something with the attachment which I know how to do and is not important to this question. Please maybe advise as to what the best way is and also if you have experienced difficulties with a certain way. Thanks in advance. -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -- 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] Do Sockets Cache?
Hello :) Wonder someone can save some of my hair here. I have a daemon application listening as root on my linux server that i have written in PHP. I use it to communicate web user with the backend linux to make certain operations from web interface. I have a login/verify command that i send to socket server to log in. I send raw command something like (login user hash) ; client command -> login admin Fjsdla5dk2mDke server response -> YES/NO Server reads from a plain text file containing user/hash and gives yes or no. But it is working like a lottery, sometimes yes sometimes no through WEB. When i test through shell, telnet or etc. it is fine, through web it sometimes outputs YES, sometimes outputs nothing (does not give NO), like it is not even connecting or getting no response at all. I have test mechanisms for valid connection and data send. So i get this crazy idea of caching for connections on web. What do you think? --Aras -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] calling a function in the same page
You can not call PHP functions through a href which is used for linking web pages. You need to create a new file or use a switch in your current file for search input, with the function in it. So that you can link to that URL, not the function itself. You can use AJAX as well, to send commands to a php file and get the results in xml/text, but again you need to call Javascript there, your logic is totally wrong. Aras Koktas [EMAIL PROTECTED] Business Excellence Development Phi.dot Internet Systems -Original Message- From: Jahangir [mailto:[EMAIL PROTECTED] Sent: Sunday, December 24, 2006 6:34 PM To: php-general@lists.php.net Subject: [PHP] calling a function in the same page I am trying to call a function from "a href" inside the same page. this is the code: echo "More results from Mysite"; // calling the function isearch function isearch($query) {$query=urlencode($query); $request='http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=Ja hangir&query=' .urlencode($query). '&output=php&results=100&site=mysite.com; $response=file_get_contents($request); if ($response === false) { die('Request failed');} $phpobj=unserialize($response); $count=$phpobj["ResultSet"]["totalResultsReturned"]; if($phpobj["ResultSet"]["totalResultsAvailable"]==0) {echo "NO RESULTS TO DISPLAY"; } echo ""; echo "Results from Mysite"; for($i=0;$i<$count;$i++) { echo ''; $no=$i+1; $url=$phpobj["ResultSet"]["Result"]["$i"]["Url"]; echo "" ."$no. ". "" . $phpobj["ResultSet"]["Result"]["$i"]["Title"] . ""; echo ""; echo ""; echo $phpobj["ResultSet"]["Result"]["$i"]["Summary"]; echo ""; echo ""; echo ""; echo "" .$phpobj["ResultSet"]["Result"]["$i"]["Url"] .""; echo ""; echo ""; $link=$phpobj["ResultSet"]["Result"]["$i"]["DisplayUrl"]; echo ""; echo "$link"; echo ""; echo ''; }} whenever i try to execute this function i either get an "Object not found error" or "Access Forbidden error". Can someone tell me where am i going wrong here?? thanks in advance -- 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] PHP and Apache authorization: how to logout. Help!
My site is in directory which is protected with .htaccess file. I want to develope a logout function, which can reset Apache authorization. What to do? HTTP header... unset $PHP_AUTH_USER ... Any suggestions Sorry for my English :) Aras -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Version difference (4.0.4pl1-4.1.2)
I want to upgrade PHP from 4.0.4 to 4.1.2. Where I can find docs apbout version differences. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Seek server hardware recommendation
Hi, I seek a recommendation for server hardware. Server software: LINUX Apache PHP mySQL Server purpose: One site (PHP+mySQL ) hosting, max 1000 visitors per day. What is recommendet hardware requiremnts (CPU, RAM,...)? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to close a socket output, leave input
Is this for the client application or server? I assume it is a client as you are trying to read a server response. socket_write() will return the length of the buffer that is written to server, so you can check that value to make sure the send is complete. --Aras -Original Message- From: nick.yim [mailto:[EMAIL PROTECTED] Sent: Friday, December 08, 2006 3:39 AM To: php-general Subject: [PHP] how to close a socket output, leave input Hello All, 1. create a socket 2. write something 3. (just) close output 4. read the server response 5. close the socket step 3, i mean close output, let the server know the client send complete Best regards, nick.yim [EMAIL PROTECTED] 2006-12-08 -- 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] signal handling
Roman, Stut and Jochem, thanks for the comments and recommendations on the subject. I have installed my signal as pcntl_signal(SIGCHLD, SIG_IGN) without a specific function handler and it is closing child processes now. I could not use the pcntl_wait because it is available after PHP 5.0 i guess. -Original Message- From: Roman Neuhauser [mailto:[EMAIL PROTECTED] Sent: Friday, December 08, 2006 7:02 PM To: Jochem Maas Cc: php-general@lists.php.net Subject: Re: [PHP] signal handling # [EMAIL PROTECTED] / 2006-12-08 15:36:52 +0100: > Roman Neuhauser wrote: > > # [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200: > >> [...] to write a simple socket server in PHP. My current example just > >> prints the same character, you send to server from keyboard. It is > >> successfull in forking, and generates child as people connect. However in > >> any way the client exits, the child process remains defunct on system. > > The parent needs to wait(2) for its children. http://php.net/pcntl_wait > > have I understood correctly that using pcntl_wait() means you can't do anything in > the parent process until all children are dead? no. > but if it is true how do you go about tackling the signal handling in child processes > AND at the same time have the parent process do something useful like ... > interact/direct child processes, do other management tasks whilst child processes are running? do whatever you want, either have a SIGCLD handler, or check one of the wait(2)-family functions every now and then (and make sure to use WNOHANG). -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- 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