Opened 12 years ago

Closed 12 years ago

#31530 closed defect (fixed)

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

Reported by: sonniesedge@… Owned by: ryandesign (Ryan Carsten Schmidt)
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 (6)

comment:1 Changed 12 years ago by sonniesedge@…

Cc: sonniesedge@… added

Cc Me!

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

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

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

comment:3 Changed 12 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 12 years ago by ryandesign (Ryan Carsten Schmidt)

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 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Status: newassigned

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 12 years ago by ryandesign (Ryan Carsten Schmidt)

Port: php5-devel added
Resolution: fixed
Status: assignedclosed
Summary: php5: Fatal error: Call to undefined function time_nanosleep()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.