New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #31530 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

php5, php5-devel: Fatal error: Call to undefined function time_nanosleep()

Reported by: sonniesedge@… Owned by: ryandesign@…
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: Cc:
Port: php5, php5-devel

Description

The function time_nanosleep() is not available in the PHP5 port.

Trying to use this function results in "Fatal error: Call to undefined function time_nanosleep()"

See: http://php.net/manual/en/function.time-nanosleep.php

Change History

comment:1 Changed 3 years ago by sonniesedge@…

  • Cc sonniesedge@… added

Cc Me!

comment:2 Changed 3 years ago by ryandesign@…

  • Owner changed from macports-tickets@… to ryandesign@…
  • Cc sonniesedge@… removed
  • Keywords php removed
  • Summary changed from time_nanosleep() in PHP to php5: Fatal error: Call to undefined function time_nanosleep()

I see this was also asked on Stack Overflow (about MacPorts).

comment:3 Changed 3 years ago by sonniesedge@…

I'm pretty new to MacPorts. Are there any options that I can set during the php5 port install to force this function to be built? Or is this something more fundamental?

comment:4 Changed 3 years ago by ryandesign@…

If I knew how to make our php5 include that function, I'd change the port to do that. :) I have a feeling it's because we use --disable-all and then just enable what we want; I just need to find what switch will re-enable that function.

comment:5 follow-up: ↓ 6 Changed 3 years ago by ryandesign@…

  • Status changed from new to assigned

Never mind, it looks like this is something the developers of PHP broke between versions 5.3.3 and 5.3.4:

$ php -v
PHP 5.3.3 (cli) (built: Oct  8 2011 17:52:07) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
$ php -r 'echo (int)function_exists("time_nanosleep")."\n";'
1
$ php -v
PHP 5.3.4 (cli) (built: Oct  8 2011 17:59:33) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
$ php -r 'echo (int)function_exists("time_nanosleep")."\n";'
0

PHP is looking for the nanosleep C function in the "rt" (realtime) library, but there is no such library on Mac OS X, leading to this error in the config.log and the test for existence of the nanosleep C function failing, and therefore php5 being built without the time_nanosleep PHP function:

ld: library not found for -lrt

The fix for PHP bug 50345 might be the culprit. I'll see if I can fix it by reversing the change, and I'll report the problem to the developers of PHP.

comment:6 in reply to: ↑ 5 Changed 3 years ago by ryandesign@…

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Port changed from php5 to php5, php5-devel
  • Summary changed from php5: Fatal error: Call to undefined function time_nanosleep() to php5, php5-devel: Fatal error: Call to undefined function time_nanosleep()

Replying to ryandesign@…:

I'll see if I can fix it by reversing the change,

and I'll report the problem to the developers of PHP.

https://bugs.php.net/bug.php?id=71672

Note: See TracTickets for help on using tickets.