m4rw3r / php-libev

PHP extension providing an object-oriented binding to the libev event-loop library.
97 stars 18 forks source link

error: ext/sockets/php_sockets.h: No such file or directory when running make #2

Closed jonathaningram closed 12 years ago

jonathaningram commented 12 years ago

Do you know why that would be the case? I used your installation instructions from your README.

/m4rw3r/php-libev/php_libev.h:42:37: error: ext/sockets/php_sockets.h: No such file or directory
m4rw3r commented 12 years ago

What version of PHP are you trying to compile it for?

Have you enabled the sockets support (--enable-sockets) when compiling PHP? (I should probably have added this to the installation instructions.)

jonathaningram commented 12 years ago

5.3.9 and 5.3.10 - both fail.

Hmmm it's not a PHP version compiled from source, so maybe that's my problem. I didn't think I'd have to compile PHP from source to use the extension.

m4rw3r commented 12 years ago

Then I see a few possibilities to why this would be happening:

Looking at php_libev.h, it seems like it manages to include php.h, php_ini.h, php_streams.hand php_network.h, which means that it likely is the first alternative or that they have forgotten to bundle the ext/sockets/php_sockets.h header with the binary.

This is the reason to why it might be a good idea to compile PHP by yourself, because sometimes the available binaries do not include all the core extensions the extension needs to compile.

But I think I can add a condition so that php-libev can be compiled without sockets support, not sure how useful that would be though.

jonathaningram commented 12 years ago

Alright thanks I'll look into it. It's a PHP binary through Macports so possibly they don't consider sockets a necessary component. Maybe on a RHEL install, for example, it is available out of the box. Cheers.

On 24/06/2012, at 6:13 PM, Martin Wernståhlreply@reply.github.com wrote:

Then I see a few possibilities to why this would be happening:

  • The PHP versions are not compiled with sockets support, you can check it with phpinfo() ("Sockets Support enabled")
  • The PHP binaries did not include the C headers during the installation, or don't include all of the headers required for extension building.

Looking at php_libev.h, it seems like it manages to include php.h, php_ini.h, php_streams.hand php_network.h, which means that it likely is the first alternative or that they have forgotten to bundle the ext/sockets/php_sockets.h header with the binary.

This is the reason to why it might be a good idea to compile PHP by yourself, because sometimes the available binaries do not include all the core extensions the extension needs to compile.

But I think I can add a condition so that php-libev can be compiled without sockets support, not sure how useful that would be though.


Reply to this email directly or view it on GitHub: https://github.com/m4rw3r/php-libev/issues/2#issuecomment-6531363

m4rw3r commented 12 years ago

I've made the PHP sockets extension optional in e450b4abea7b97c510aaad211bc47a774f160195, this will make php-libev only accept PHP streams if you have not enabled the sockets extension. It also removes the dependency on the header file ext/sockets/php_sockets.h.

If you have the sockets extension compiled in, php-libev will still accept PHP sockets as parameters to IOEvent objects.

Tell me if you can compile it without problem, and I'll close this issue if that is the case.

jonathaningram commented 12 years ago

@m4rw3r It has compiled and installed. Can you just clarify what the downside of having sockets disable is? E.g. does it completely take away from the point of using this library, for, say, asynchronicity? Maybe add a note to the readme?

Cheers!

m4rw3r commented 12 years ago

Nope, it does not really remove anything which is usable without the PHP sockets extension.

What the code I conditionally removed did was to convert PHP socket resources to usable file descriptors. This is only useful if PHP can create these in the first place, which is only possible if you have the PHP socket extension enabled.

So if you're wondering about what you're missing, look at: http://se2.php.net/manual/en/book.sockets.php