PHP Module Writing Help [message #173118] |
Tue, 22 March 2011 11:04 |
Lee
Messages: 1 Registered: March 2011
Karma: 0
|
Junior Member |
|
|
I am new to PHP modules, and trying to follow the tutorial at:
http://devzone.zend.com/article/1021#Heading5
All configures and makes well, but I am getting the following message:
Lee:hello $ cd modules/
Lee:modules $ php -r 'echo hello_world();'
PHP Fatal error: Call to undefined function hello_world() in Command
line code on line 1
My include path in php.ini is the default, so includes the current
directory, which includes the hello.so from the tutorial.
And help would be appreciated.
TIA
Lee
|
|
|
Re: PHP Module Writing Help [message #173119 is a reply to message #173118] |
Tue, 22 March 2011 11:20 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
Lee wrote:
> I am new to PHP modules, and trying to follow the tutorial at:
>
> http://devzone.zend.com/article/1021#Heading5
>
> All configures and makes well, but I am getting the following message:
>
> Lee:hello $ cd modules/
> Lee:modules $ php -r 'echo hello_world();'
Try php -r echo 'hello world'
> PHP Fatal error: Call to undefined function hello_world() in Command
> line code on line 1
>
>
> My include path in php.ini is the default, so includes the current
> directory, which includes the hello.so from the tutorial.
>
> And help would be appreciated.
>
> TIA
> Lee
|
|
|
|
Re: PHP Module Writing Help [message #173121 is a reply to message #173118] |
Tue, 22 March 2011 12:03 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
El 22/03/2011 12:04, Lee escribió/wrote:
> I am new to PHP modules, and trying to follow the tutorial at:
>
> http://devzone.zend.com/article/1021#Heading5
>
> All configures and makes well, but I am getting the following message:
>
> Lee:hello $ cd modules/
> Lee:modules $ php -r 'echo hello_world();'
> PHP Fatal error: Call to undefined function hello_world() in Command
> line code on line 1
>
>
> My include path in php.ini is the default, so includes the current
> directory, which includes the hello.so from the tutorial.
>
> And help would be appreciated.
Your extension is obviously not loaded. Your vague description suggests
that you've put the hello.so file in the same directory as your PHP code
and you're expecting that PHP will automatically load it. Read the
article again: you need to copy the file into your extensions directory
and add extension=hello.so to php.ini.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|
Re: PHP Module Writing Help [message #173122 is a reply to message #173118] |
Tue, 22 March 2011 12:04 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 3/22/2011 7:04 AM, Lee wrote:
> I am new to PHP modules, and trying to follow the tutorial at:
>
> http://devzone.zend.com/article/1021#Heading5
>
> All configures and makes well, but I am getting the following message:
>
> Lee:hello $ cd modules/
> Lee:modules $ php -r 'echo hello_world();'
> PHP Fatal error: Call to undefined function hello_world() in Command
> line code on line 1
>
>
> My include path in php.ini is the default, so includes the current
> directory, which includes the hello.so from the tutorial.
>
> And help would be appreciated.
>
> TIA
> Lee
No, the include_path is different from the extension_directory.
Include_path is for PHP source files. Extensions must be specifically
loaded in your php.ini file, and they generally go in a xxx/ext/ directory.
This is detailed in the "Building Your Extension" section (although it
is only a couple of lines on a long page).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: PHP Module Writing Help [message #173123 is a reply to message #173119] |
Tue, 22 March 2011 12:05 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 3/22/2011 7:20 AM, The Natural Philosopher wrote:
> Lee wrote:
>> I am new to PHP modules, and trying to follow the tutorial at:
>>
>> http://devzone.zend.com/article/1021#Heading5
>>
>> All configures and makes well, but I am getting the following message:
>>
>> Lee:hello $ cd modules/
>> Lee:modules $ php -r 'echo hello_world();'
>
> Try php -r echo 'hello world'
>
Try not opening your trap when you have no idea what you're talking about.
Oh - you wouldn't be able to say anything, would you?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|