web analytics
Skip to main content

Error when running Apache with PHP in Windows

A possible problem after you install and configure Apache 2.2 and PHP  5 in Windows XP: Apache does not start, and you get the following error message in Apache error log:

[crit] (OS 6)The handle is invalid.  : master_main: create child process failed. Exiting.
[notice] Parent: Forcing termination of child process 36

or, in a spanish installation:

[crit] (OS 6)Controlador no válido.  : master_main: create child process failed. Exiting.
[notice] Parent: Forcing termination of child process 36

The cause of this error is probably the fact that you have some improperly installed PHP extension in your configuration. Some PHP extensions have dependencies that are not automatically installed in Windows.

So, check PHP.INI file for all the extensions that are set, and try to comment them one-by-one, to find out which one (or ones) is causing the problem. Of of the main suspects is the openSSL extension. If this is the case, just comment the following lines in PHP.INI:

[PHP_OPENSSL]
extension=php_openssl.dll

comment them like that:

;[PHP_OPENSSL]
;extension=php_openssl.dll

Another solution, in this case, if you really need openSSL is just to install it. Check it here:

http://www.slproweb.com/products/Win32OpenSSL.html

Take also a closer look in the database extensions, because they all need that the proper database clients are installed:

For example, MySql, PostgreSQL and Oracle extensions:

[PHP_MYSQL]
extension=php_mysql.dll

[PHP_PGSQL]
extension=php_pgsql.dll

[PHP_OCI8]
extension=php_oci8.dll

Again, do the same: comment them or, in case you need them, install the proper database drivers.

I hope this helps!

Problem: Lucene demo Web application does not work

After installing Lucene 3 with Tomcat 6 in Ubuntu Linux, I’ve spent some hours trying to put Lucene’s demo Web application to work. Lucene console demo was working nice, but when I tried to run any query in the demo Web application, it returned this error:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.lucene.store.FSDirector

(Note: The demo Web application home page worked fine. The problem ocurred when I tried to run a query).

This was very strange, because everything seemed to be correct, I had followed all the instructions found in the “Apache Lucene – Building and Installing the Basic Demo” document.

I googled it in many forums, but I found no trace of a decent answer that was fit to my problem.

It seemed that the problem was somehow related to some security configuration, maybe file permissions, because sometimes I also got this message in the log:

java.security.AccessControlException: access denied (java.util.PropertyPermission sun.arch.data.model read)

But even after giving all possible permissions to the Tomcat user in the directory where my Lucene index was, it did not work. I kept receiving the same messages.

Finally, after hours struggling, looking at the tomcat6 initialization script (located in /etc/init.d), I noticed that there was this option:

# Use the Java security manager? (yes/no)
TOMCAT6_SECURITY=yes

Well, why not give a try? Let’s change this to “no”:

TOMCAT6_SECURITY=no

Now let’s test it: restart Tomcat6… Run a query… BINGO! It worked!!!

Why is this? I didn’t have time to investigate, but it seems that it’s a Tomcat 6 security directive that forces applications to adhere to some security scheme. Obviously, that wasn’t the case with Lucene demo Web application.  :)

After making some more googling, I’ve found that this bizarre problem affects a lot of other programs, and sometimes even database connections started from Tomcat do not work when this option is on.

In fact, there’s a whole bunch of forum discussions and applications’ installation pages telling people to disable this directive in order to work. But nobody gives a clue about the reason behind this…

Anyway, at least we have the solution.