Problems when compiling Apache and PHP

Here are three of the problems readers faced when they tried to compile some versions of Apache 2 and PHP

  1. Apache 2.0.48 and PHP 4.3.4
  2. Apache 2.0.39 and PHP 4.2.2
  3. Apache 2.0.39 and PHP 4.2.3 / 4.2.2

Apache 2.0.48 and PHP 4.3.4

Mr. Thomas Hansen faced this problem when compiling Php 4.3.4 and Apache 2.0.48. Here is what he has to say about it:

"Thanks a lot for your php + apache tutorial, it really helped me. I just finished compiling and installing them under kernel 2.6 (php 4.3.4 and apache 2.0.48), and both are working great.

During compilation, I had a problem with the configure options: there are 2 directives, --with-apxs2 and --with-apxs2filter, which can't be used together: if you use one, you must not use the other, otherwise you'll get a lot of duplicate symbols while linking libphp4.

Unfortunatelly, it took me about 2 hours to discover that :#). After thinking on this problem, I believe that php4.3.4 will act as a filter (and thus work with the <file> directive, on httpd.conf) if you use the --with-apxs2filter. Maybe this directive was created after 4.3.0 release, so that the other one (--with-apxs2) could be used to implement the traditional way of invoking the php parser."

Apache 2.0.39 and PHP 4.2.2

One reader Mr. Wolfgang Seemann wrote to me about the problem he faced when compiling Php 4.2.2 and Apache 2.0.39 on sparc/solaris 9. Many other readers using Linux also wrote to me that they too faced this problem and they were able to compile PHP after making this change but I have not checked it myself. If compile fails with some problem in php_functions.c then you have to change line 93 in php_functions.c like this:

change

#if !MODULE_MAGIC_AT_LEAST(20020506,0)

to

#if !AP_MODULE_MAGIC_AT_LEAST(20020506,0)

Apache 2.0.39 and PHP 4.2.3 / 4.2.2

Another reader Mr. Himanshu Soni wrote that he received this error when using php 4.2.3 and apache 2.0.39 on Linux:

....
sapi_apache2.c: In function `php_register_hook':
sapi_apache2.c:567: incompatible type for argument 3 of
`ap_register_output_filter'
sapi_apache2.c:567: too many arguments to function
`ap_register_output_filter'
sapi_apache2.c:568: incompatible type for argument 3 of
`ap_register_input_filter'
sapi_apache2.c:568: too many arguments to function
`ap_register_input_filter'
make[3]: *** [sapi_apache2.lo] Error 1
....

Some readers using PHP 4.2.2 and Apache 2.0.39 also said that they are receiving the same errors. To solve this problem he changed two lines in function php_register_hook(apr_pool_t *p) in sapi_apache2.c near line 567 (this function may be near line 534 if using php 4.2.2):

from

ap_register_output_filter("PHP", php_output_filter, NULL, AP_FTYPE_RESOURCE);
ap_register_input_filter("PHP", php_input_filter, NULL, AP_FTYPE_RESOURCE);

to

ap_register_output_filter("PHP", php_output_filter, AP_FTYPE_RESOURCE);
ap_register_input_filter("PHP", php_input_filter, AP_FTYPE_RESOURCE);

Here function call was made with four arguments when only three were required. These problems normally arise when using incompatible versions of PHP and Apache.

Back to Top | Freelance Web Developer | Web Designing and development | JSP Chat Application Code | Freelance PHP Programmer | Compiling PHP Article
14/11/2024 06:36