4

Final Update.

Problem Solved.

The way I solve the problem is re-install Apache and PHP entirely from source following the instruction by the following link.

http://dan.drydog.com/apache2php.html

Then do the extension by build the extension directly into PHP following the instruction by the link down below.

The only thing is that the binaries are all only in the specific path, which I think is a easy problem to solve though.

Thanks everyone, this is my first post in Stackoverflow and I spend one whole day to make my first php extension. Though a little bit tough, but I like it! :D

Original Question

I'm trying to build a php extension following the instruction by the following link:

http://docstore.mik.ua/orelly/webprog/php/ch14_03.htm

I build the extension of 'rot13' into the php using the following steps

./buildconf
./configure --enable-rot13
make
sudo make install

Then I tested the extension by the command line php. The output is exactly the same as the above article.

I suppose after I build the extension into php itself, I don't need to care about the php.ini file. Then I try to test the extension in the browser, I find out that the phpinfo() page doesn't show any thing about the new extension whereas php -m command shows my extension is loaded. I checked the apache2 log, there is no error.

I googled for nearly one day and got no clue. Some threads are similar in stackoverflow but no real working solutions.

My system is Ubuntu 11.10 and php 5.3.10 and apache2.2.20.

If you guys have clues, please help. Thanks!

Update:

I did put the extension=rot13.so in the php.ini file at the path of /etc/php5/apache2/php.ini but now whenever I restart the apache2 server, I got the following error.

PHP Warning:  PHP Startup: rot13: Unable to initialize module
Module compiled with build ID=API20090626,TS,debug
PHP compiled with build ID=API20090626,NTS

These options need to match in Unknown on line 0

Any one has any clue about what caused this fault?

BTW, when I compile the extension, I did use the ./configure --enable-rot13 --with-php-config=/usr/local/bin/php-config to make sure it uses the configuration file of php.

Update again:

I find out that the phpinfo() from the web page has different version of php -i I get from the command line... How strange is that? I'll try to google how to figure out this conflict.

1
  • 2
    In Ubuntu, there are two php.ini files. One for regular web based PHP and other for the CLI. Make sure extension is enabled in both. The path is probably something like '/etc/php5/apache2' and '/etc/php5/cli' Commented Mar 19, 2012 at 7:53

1 Answer 1

7

In Ubuntu, there are 2 php.ini files, one for CLI and one for apache.

By default, they are located at /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini.

In your case, you need to enable the extension in apache2 php.ini file too.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.