Search Results

Search found 34397 results on 1376 pages for 'php socket'.

Page 16/1376 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Centos 6.2, Apache 2 and Listen port for socket connection

    - by salvosav
    I'm trying to make a socket connection between a client and my server through a php script. To do this, I opened a port on iptables, and configure a virtual host with apache to redirect all traffic from my door to the folder that contains the file index.php, which is my script. Doing some tests the door is open, but using command netstat -ltn , I see ':::35100'. Looking on the net I understand if in this way is only listen inward and not outward. But I don't understand how can I turn this ':::35100 '-' in this '0.0.0.0:35100 '. Or, better yet, how to add this rule. Any ideas? thanks

    Read the article

  • php-fpm + persistent sockets = 502 bad gateway

    - by leeoniya
    Put on your reading glasses - this will be a long-ish one. First, what I'm doing. I'm building a web-app interface for some particularly slow tcp devices. Opening a socket to them takes 200ms and an fwrite/fread cycle takes another 300ms. To reduce the need for both of these actions on each request, I'm opening a persistent tcp socket which reduces the response time by the aforementioned 200ms. I was hoping PHP-FPM would share the persistent connections between requests from different clients (and indeed it does!), but there are some issues which I havent been able to resolve after 2 days of interneting, reading logs and modifying settings. I have somewhat narrowed it down though. Setup: Ubuntu 13.04 x64 Server (fully updated) on Linode PHP 5.5.0-6~raring+1 (fpm-fcgi) nginx/1.5.2 Relevent config: nginx worker_processes 4; php-fpm/pool.d pm = dynamic pm.max_children = 2 pm.start_servers = 2 pm.min_spare_servers = 2 Let's go from coarse to fine detail of what happens. After a fresh start I have 4x nginx processes and 2x php5-fpm processes waiting to handle requests. Then I send requests every couple seconds to the script. The first take a while to open the socket connection and returns with the data in about 500ms, the second returns data in 300ms (yay it's re-using the socket), the third also succeeds in about 300ms, the fourth request = 502 Bad Gateway, same with the 5th. Sixth request once again returns data, except now it took 500ms again. The process repeats for several cycles after which every 4 requests result in 2x 502 Bad Gateways and 2x 500ms Data responses. If I double all the fpm pool values and have 4x php-fpm processes running, the cycles settles in with 4x successful 500ms responses followed by 4x Bad Gateway errors. If I don't use persistent sockets, this issue goes away but then every request is 500ms. What I suspect is happening is the persistent socket keeps each php-fpm process from idling and ties it up, so the next one gets chosen until none are left and as they error out, maybe they are restarted and become available on the next round-robin loop ut the socket dies with the process. I haven't yet checked the 'slowlog', but the nginx error log shows lots of this: *188 recv() failed (104: Connection reset by peer) while reading response header from upstream, client:... All the suggestions on the internet regarding fixing nginx/php-fpm/502 bad gateway relate to high load or fcgi_pass misconfiguration. This is not the case here. Increasing buffers/sizes, changing timeouts, switching from unix socket to tcp socket for fcgi_pass, upping connection limits on the system....none of this stuff applies here. I've had some other success with setting pm = ondemand rather than dynamic, but as soon as the initial fpm-process gets killed off after idling, the persistent socket is gone for all subsequent php-fpm spawns. For the php script, I'm using stream_socket_client() with a STREAM_CLIENT_PERSISTENT flag. A while/stream_select() loop to detect socket data and fread($sock, 4096) to grab the data. I don't call fclose() obviously. If anyone has some additional questions or advice on how to get a persistent socket without tying up the php-fpm processes beyond the request completion, or maybe some other things to try, I'd appreciate it. some useful links: Nginx + php-fpm - recv() error Nginx + php-fpm "504 Gateway Time-out" error with almost zero load (on a test-server) Nginx + PHP-FPM "error 104 Connection reset by peer" causes occasional duplicate posts http://www.linuxquestions.org/questions/programming-9/php-pfsockopen-552084/ http://stackoverflow.com/questions/14268018/concurrent-use-of-a-persistent-php-socket http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/#Heading3 http://stackoverflow.com/questions/242316/how-to-keep-a-php-stream-socket-alive http://php.net/manual/en/install.fpm.configuration.php https://www.google.com/search?q=recv%28%29+failed+%28104:+Connection+reset+by+peer%29+while+reading+response+header+from+upstream+%22502%22&ei=mC1XUrm7F4WQyAHbv4H4AQ&start=10&sa=N&biw=1920&bih=953&dpr=1

    Read the article

  • Advice needed from PHP/Cake PHP expert

    - by Hiro
    I'm very new to programming (besides SQL and databases), but I ultimately want to master Cake PHP for web development. Now, given how new I am, I'm rather lost as to how I get started. Down the road, I want to use MVC framework so that I help myself be disciplined in the way I build. However, I know basic knowledge of PHP and OOP PHP are required. So my question is this: what are the right steps to mastering Cake PHP? I don't want to skip critical phases of learning before learning to Cake PHP. At the same time, I don't want to spend more time than required learning PHP if I can learn it directly through Cake PHP knowledge. Any advice would be appreciated.

    Read the article

  • How to check PHP filecode syntax in PHP?

    - by Tower
    Hi, I am in a need of running the PHP parser for PHP code inside PHP. I am on Windows, and I have tried system("C:\\Program Files (x86)\\PHP\\php.exe -l \"C:/Program Files (x86)/Apache/htdocs/a.php\"", $output); var_dump($output); without luck. The parameter -l should check for correct PHP syntax, and throw errors if some problems exist. Basically, I want to do something similar to this picture: That is, to be able to detect errors in code.

    Read the article

  • C socket programming: calling recv() changes my socket file descriptor?

    - by fourier
    Hey all, I have this strange problem with recv(). I'm programming client/server where client send() a message (a structure to be exact) and server recv() it. I am also working with multiple sockets and select(). while(1) { readset = info->read_set; info->copy_set = info->read_set; timeout.tv_sec = 1; timeout.tv_usec = 0; // 0.5 seconds ready = select(info->max_fd+1, &readset, NULL, NULL, &timeout); if (ready == -1) { printf("S: ERROR: select(): %s\nEXITING...", strerror(errno)); exit(1); } else if (ready == 0) { continue; } else { printf("S: oh finally you have contacted me!\n"); for(i = 0; i < (info->max_fd+1); i++) { if(FD_ISSET(i, &readset)) //this is where problem begins { printf("S: %i is set\n", i); printf("S: we talking about socket %i son\n", i); // i = 4 num_bytes = recv(i, &msg, MAX_MSG_BYTE, 0); printf("S: number of bytes recieved in socket %i is %i\n", i, num_bytes); // prints out i = 0 what?? if (num_bytes == 0) { printf("S: socket has been closed\n"); break; } else if (num_bytes == -1) { printf("S: ERROR recv: %d %s \n", i, strerror(errno)); continue; } else { handle_request(arg, &msg); printf("S: msg says %s\n", msg->_payload); } } // if (FD_ISSET(i, &readset) else printf("S: %i is not set\n", i); } // for (i = 0; i < maxfd+1; i++) to check sockets for msg } // if (ready == -1) info->read_set = info->copy_set; printf("S: copied\n"); } the problem I have is that in read_set, 0~3 aren't set and 4 is. That is fine. But when i call recv(), i suddently becomes 0. Why is that? It doesn't make sense to me why recv() would take an socket file descriptor number and modify to another number. Is that normal? Am I missing something? S: 0 is not set S: 1 is not set S: 2 is not set S: 3 is not set S: 4 is set S: we talking about socket 4 son S: i is strangely or unstrangely 0 S: number of bytes recieved in socket 0 is 40 That's what it prints out.

    Read the article

  • Apache 2.4 PHP 5.4 mysql not found?

    - by jurchiks
    Just tried setting up the latest Apache (2.4.1 x86 VC10 from apachelounge) and PHP (5.4 VC9 TS X86, with the php5apache2_4.dll) on my PC and ran into this weird problem; in my php.ini I have enabled all of the following: extension=php_mysql.dll extension=php_mysqli.dll extension=php_pdo_mysql.dll but when I try to print the available PDO's using this: print_r(PDO::getAvailableDrivers()); It gives me an empty array. PhpMyAdmin and MantisBT also refuse to work, saying that the mysql extension is missing. phpinfo() gives this: PDO PDO support enabled PDO drivers no value and when searching for mysql, only the mysqlnd section pops up... The DLLs are there in the D:/php/ext folder and no errors pop up when starting up Apache, as well as no errors in the Windows Event Log, and PHP itself has no error log anyway. What could possibly be the problem with this? Before this I had Apache 2.2.22 from apachelounge and PHP 5.3.9 and I had no problems. Now nothing works...

    Read the article

  • PHP sqlite not working in 13.10

    - by user97954
    According to >ls /etc/php5/mods-available/ I have a pdo.ini pdo_mysql.ini pdo_sqlite.ini sqlite3.ini for example sqlite.ini contains: ; configuration for php SQLite module ; priority=20 extension=sqlite3.so and >php -i | grep pdo_ gives: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_sqlite.so' - /usr/lib/php5/20121212/pdo_sqlite.so: undefined symbol: sqlite3_column_table_name in Unknown on line 0 /etc/php5/cli/conf.d/20-pdo_mysql.ini,/etc/php5/cli/conf.d/20-pdo_sqlite.ini, Simple stuff like this: <?php echo sqlite_libversion(); ?> Gives a blank page. Also phpliteadmin won't work either, complaining of no sqlite3 or pdo_sqlite, etc. Been all over this planet's Internet chasing leads and clues to no avail. What's wrong?

    Read the article

  • UDP Socket Client in .NET

    - by Betamoo
    I use UDP Sokckts in my client application. Here are some code snippets: SendIP = new IPEndPoint(IPAddress.Parse(IP), port); ReceiveIP = (EndPoint)(new IPEndPoint(IPAddress.Any, 0)); socket = new Socket( AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); socket.Bind(ReceiveIP); And to Receive (while(true)): byte[] data = new byte[BUFFERSIZE]; int receivedDataLength = socket.ReceiveFrom(data, ref ReceiveIP); string s= Encoding.ASCII.GetString(data, 0, receivedDataLength); I am doing an infinite while on the receive, there are other things to be done in the while, even if nothing is received.. I want to check if there are actually available data then receive else do not wait.. (Note the current receive method waits until the server sends a message)

    Read the article

  • Good PHP books for starters, any recommendations?

    - by Goma
    I started reading some PHP books. Most of them in their introduction say that this book , unlike other books, it follows a good habits and practices. Now, I do not know which book tells the truth, and which writer is the most experienced in PHP. These are the books that I had a quick look to their first chapter: PHP and MySQL Web Development (Developer's Library) by Luke Welling and Laura Thomson. Build Your Own Database Driven Web Site Using PHP & MySQL by Kevin Yank. PHP and MySQL for Dummies by Janet Valade. Now, it's your time to advise me and tell me about the excellent one that follows best practices, please give an advice from your experience. (It could be any other book!). Regards,

    Read the article

  • Socket Read In Multi-Threaded Application Returns Zero Bytes or EINTR (104)

    - by user309670
    Hi. Am a c-coder for a while now - neither a newbie nor an expert. Now, I have a certain daemoned application in C on a PPC Linux. I use PHP's socket_connect as a client to connect to this service locally. The server uses epoll for multiplexing connections via a Unix socket. A user submitted string is parsed for certain characters/words using strstr() and if found, spawns 4 joinable threads to different websites simultaneously. I use socket, connect, write and read, to interact with the said webservers via TCP on their port 80 in each thread. All connections and writes seems successful. Reads to the webserver sockets fail however, with either (A) all 3 threads seem to hang, and only one thread returns -1 and errno is set to 104. The responding thread takes like 10 minutes - an eternity long:-(. *I read somewhere that the 104 (is EINTR?), which in the network context suggests that ...'the connection was reset by peer'; or (B) 0 bytes from 3 threads, and only 1 of the 4 threads actually returns some data. Isn't the socket read/write thread-safe? I use thread-safe (and reentrant) libc functions such as strtok_r, gethostbyname_r, etc. *I doubt that the said webhosts are actually resetting the connection, because when I run a single-threaded standalone (everything else equal) all things works perfectly right, but of course in series not parallel. There's a second problem too (oops), I can't write back to the client who connect to my epoll-ed Unix socket. My daemon application will hang and hog CPU 100% for ever. Yet nothing is written to the clients end. Am sure the client (a very typical PHP socket application) hasn't closed the connection whenever this is happening - no error(s) detected either. Any ideas? I cannot figure-out whatever is wrong even with Valgrind, GDB or much logging. Kindly help where you can.

    Read the article

  • Is php|architect any good?

    - by Andrew Heath
    Kind of a hard topic to search for, as architect turns up a lot about software architects instead. After 8 months of PHP self-study, I finally stumbled across the php|architect site. The length of time it took me to find it makes me suspicious of its quality. 3 related questions: do professional PHP coders read/care about php|architect? is it a good source for PHP beginners? assuming yes to either of the above, how far back in the archives to articles remain relevant? (ex: does stuff written about PHP4 still matter?)

    Read the article

  • Good PHP BOOKS for starters!

    - by Goma
    I started reading some PHP books. Most of them in their introduction say that this book , unlike other books, it follows a good habits and practices. Now, I do not know which book tells the truth, and which writer is the most experienced in PHP. These are the books that I had a quick look to their first chapter: PHP and MySQL Web Development (Developer's Library) by Luke Welling and Laura Thomson. Build Your Own Database Driven Web Site Using PHP & MySQL by Kevin Yank. PHP and MySQL for Dummies by Janet Valade. Now, it's your time to advise me and tell me about the excellent one that follows best practices, please give an advice from your experience. (It could be any other book!). Regards,

    Read the article

  • SocketTimeOutException while creating socket, java

    - by Sunil Kumar Sahoo
    Hi All, I have created a sample java socket application. I used Socket s = new Socket(ip, port) Now it works fine. but when my internet connection is very slow that time after a long interval (even if sometimes after 2 minutes) i used to get SocketTimeOutException in that line. means it gives that error while creating socket. I want the exception should be handled properly means if internet connection is very slow then if that error occurs it happens very late now . I want if this type of error occurs then it should be caught very fast means the error should not come at such a delay interval of time rather it should come immediately. How to achieve this. Thanks Sunil Kumar Sahoo

    Read the article

  • Learning and Developing with PHP [closed]

    - by KyelJmD
    I am here to ask you What is a good PHP Book that doesn't contain too much details but it is compose of all necessary information to develop in PHP such as (OO PHP, Handling Forms, Database etc etc) This may be subjective but I've tried to look php book recomendations here at Stackoverflow but I cannot find any. Next is What are the things I need to know in learning a PHp framework? specifically I want to learn CAKEPHP. NOTE I do not need those lenghty books that discuss loops and such I already have experience programming with java and C#.

    Read the article

  • php is not working well on ubuntu 13.10 and mcrypt is missing in phpmyadmin

    - by mohamad
    I've upgraded from UBUNTU 13.04 to 13.10 but I can not work with php pages or phpmyadmin . I've tried this way to install lamp on ubuntu sudo apt-get install lamp-server^ phpmyadmin and I've done all of the configuration correctly after installation I've added this line Include /etc/phpmyadmin/apache.conf to /etc/apache2/apache2.conf then I restarted apache2 but in phpmyadmin on the bottom of the page is this error : The mcrypt extension is missing. Please check your PHP configuration I've check and mcrypt was in it , but in phpmyadmin it gives me error of missing . the other problem is on PHP pages it seems like there is no PHP and it's all html because lots of PHP lines are printed in textbox's like : <? echo $row['details']; ?> can anybody tell me what should I do ?

    Read the article

  • Is php|architect any good?

    - by Andrew Heath
    Kind of a hard topic to search for, as architect turns up a lot about software architects instead. After 8 months of PHP self-study, I finally stumbled across the php|architect site. The length of time it took me to find it makes me suspicious of its quality. 3 related questions: do professional PHP coders read/care about php|architect? is it a good source for PHP beginners? assuming yes to either of the above, how far back in the archives to articles remain relevant? (ex: does stuff written about PHP4 still matter?)

    Read the article

  • Java Socket Programming

    - by Bapi
    Java Socket Program did not work for WAN I have written a TCP IP socket program which works fine in my LAN. One of my friend is at bangalore He ran the server and I ran the client with the host name of my friend's IP. In this case my socket program did not work.

    Read the article

  • Python socket error on UDP data receive. (10054)

    - by Charles
    I currently have a problem using UDP and Python socket module. We have a server and clients. The problem occurs when we send data to a user. It's possible that user may have closed their connection to the server through a client crash, disconnect by ISP, or some other improper method. As such, it is possible to send data to a closed socket. Of course with UDP you can't tell if the data really reached or if it's closed, as it doesn't care (atleast, it doesn't bring up an exception). However, if you send data and it is closed off, you get data back somehow (???), which ends up giving you a socket error on sock.recvfrom. [Errno 10054] An existing connection was forcibly closed by the remote host. Almost seems like an automatic response from the connection. Although this is fine, and can be handled by a try: except: block (even if it lowers performance of the server a little bit). The problem is, I can't tell who this is coming from or what socket is closed. Is there anyway to find out 'who' (ip, socket #) sent this? It would be great as I could instantly just disconnect them and remove them from the data. Any suggestions? Thanks.

    Read the article

  • Destroy guest OS using php

    - by Alee
    I am using libvirt-php to manage my virtual machines, and I need to shutdown/destroy domU. For this I used the following php script: < ? php $conn=libvirt_connect("xen:///"); $name=libvirt_domain_lookup_by_id($conn,4); $dest=libvirt_domain_destroy($name); echo $dest; ? When I run this on xampp server i get the following output: Warning: libvirt_domain_destroy() [function.libvirt-domain-destroy]: operation virDomainDestroy forbidden for read only access in /opt/lampp/htdocs/xampp/byname.php on line 5. Here is the documentation: http://libvirt.org/php/api-reference.html#libvirt_domain_destroy

    Read the article

  • Impact of changing from PHP to Java after 1 year or 6 months

    - by user62909
    I'm MCA final year student and I have very poor school record and had 2 years of gap. I'm first class with distinction in graduation and in post graduation is first class.Companies are coming for campus recruitment.I have very less companies like 4 or 5 who don't impose any criteria. there is a company who work on PHP and i have cleared its aptitude test and technical only HR remaining. I'm actually interested in Java and have knowledge about it but company work on PHP.I was fretting about If i work on PHP for 6 or 1 year can I change later to Java ? because i will also have experience of 6 or 12 months ? Will be considered an experienced employee if I apply for java developer later ? Will manager think that I worked in PHP and not allowed for Java ? Will I have to pursue java OCJP certification so i can get job even after 1 year experience of PHP ? Only 8 days are remaining for Hr round so please need help

    Read the article

  • How to learn PHP effectively?

    - by Goma
    A dozen of bad tutorials out there that teach you bad habits especially when we speak about PHP. I want to learn how to avoid the things that can lead me to develop inefficient web applications. I like to learn from videos but most videos I've found on the internet are provided by people who do not follow good practices. My second option is to learn from books but I did not find a good book for starters in PHP! It would be very helpful for me if you can tell me about your story in learning PHP, what are things that I should avoid? How to learn about PHP security from the beginning to avoid unlearn something later on?. Please provide links to books, websites that provide high quality video tutorials for PHP, and you tips for a good start!

    Read the article

  • Job selection between (.net) or PHP [closed]

    - by Swapnil Gondkar
    Hi am Swapnil I am just a fresher passout of 2011 batch of engineering from Mumbai University I have developed dynamic websites on PHP and have quite a good experience working with php for 2years. Now When I went for interviews I got selected for a company that manifolds into PHP and its technologies to create websites.The other company in which I also got selected offers more than half the higher package than previous but I have to work here on .net platform and all the Microsoft Technologies which I do not merry. The work environment of php company is quite cool with 400employees(onli 10 php developers) and the .net company has only a strength of 20employees Now the thing is I do not know about Enterprise Application Building and other stuff so guys If any advice that may help me select my job would be appreciated.

    Read the article

  • Socket Read In Multi-Threaded Application Returns Zero Bytes or EINTR (-1)

    - by user309670
    Hi. Am a c-coder for a while now - neither a newbie nor an expert. Now, I have a certain daemoned application in C on a PPC Linux. I use PHP's socket_connect as a client to connect to this service locally. The server uses epoll for concurrent connections via a Unix socket. A user submitted string is parsed for certain characters/words using strstr() and if found, spawns 4 joinable threads to different websites simultaneously. I use socket, connect, write and read, to interact with the said webservers via TCP on port 80 in each thread. All connections and writes seems successful. Reads to the webserver sockets fail however, with either (A) all 3 threads seem to hang, and only one thread returns -1 and errno is set to 104. The responding thread takes like 10 minutes - an eternity long:-(. *I read somewhere that the 104 (is EINTR) suggests that ...'the connection was reset by peer', or (B) 0 bytes from 3 threads, and only 1 of the 4 threads actually returns some data. Isn't the socket read/write thread-safe? Otherwise, use thread-safe (and reentrant) libc functions such as strtok_r, gethostbyname_r, etc. *I doubt that the said webhosts are actually resetting the connection, because when I run a single-threaded standalone (everything else equal) all things works perfectly right. There's a second problem too (oops), I can't write back to the client who connect to my epoll-ed Unix socket. My daemon application will hang and hog CPU 100% for ever. Yet nothing is written to the clients end. Am sure the client (a very typical PHP socket application) hasn't closed the connection whenever this is happening - no error(s) detected either. I cannot figure-out whatever is wrong even with Valgrind or GDB

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >