Zdunek
Zdunek

Reputation: 21

cURL in php 5.4.10 and windows file hosts

First, sorry for my english.

I updated php and configure it with nginx. It's work fine. But in my php app i use cURL. And it nor working with my vhosts. Im, set this in my windows hosts file:

127.0.0.1       example.dev

curl script is ok, and working on normal pages, for example google.com And this script i use too in serwer with linux and it's working too

But if i use http://example.dev Only info is " CURL:couldn't connect to host" Address http://example.dev working on my browser and i can ping in cmd.

What can be wrong?

Upvotes: 0

Views: 506

Answers (1)

Zdunek
Zdunek

Reputation: 21

I found problem. One run php is not enough. PHP try run script and curl don't have resources for that, and we have deadlock.

My solution is run more php with other ports, and configure nginx for that. bat script for php

c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9121 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9122 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9123 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9124 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9125 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9126 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9127 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9128 -c D:\AllWebServer\php\php.ini
c:/RunHiddenConsole.exe D:\AllWebServer\php\php-cgi.exe -b 127.0.0.1:9129 -c D:\AllWebServer\php\php.ini

and nginx config

upstream php_farm {
    server 127.0.0.1:9121 weight=1;
    server 127.0.0.1:9122 weight=1;
    server 127.0.0.1:9123 weight=1;
    server 127.0.0.1:9124 weight=1;
    server 127.0.0.1:9125 weight=1;
    server 127.0.0.1:9126 weight=1;
    server 127.0.0.1:9127 weight=1;
    server 127.0.0.1:9128 weight=1;
    server 127.0.0.1:9129 weight=1;

}

...

fastcgi_pass  php_farm;

Upvotes: 0

Related Questions