Apache Worker MPM, mod_fcgid and ISPManager issues

May 2, 2010 – 8:04 AM

Tonight I changed over from Apache MPM Prefork to Worker MPM, after learning this is generally supported by ISPManager that I run, I had already changed to using mod_fcgid for PHP, but hadn’t removed mod_php as this was going to do as I run Debian and it has to be one or the other, installation was fairly simple until I was greeted by an apache error upon first run:

Starting web server: apache2Syntax error on line 6 of /etc/apache2/conf.d/phpmyadmin.conf:
Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration
 failed!

I quickly learned that this is because fcgi doesn’t support the php_admin_value command, so I went into phpmyadmin.conf and commented out those lines, I was then shown the same error by squirrelmail.conf, so I did the same and the server was able to start.

After this I tried PHPMyAdmin and Squirrelmail finding that there’s no handler for them and then I realised that they are running on the ssl server with ISPManager, so here is the solution (or atleast workaround) to get PHPMyAdmin and Squirrelmail to work again with ISPManager and fcgi.

First going back to /etc/apache2/conf.d/phpmyadmin.conf I edited in the initial commands to spawn fast cgi, you’ll notice I basically just copied from ISPManager’s user apache sections:


Alias /myadmin /usr/share/phpmyadmin/
<Directory /usr/share/phpmyadmin>
        FCGIWrapper /usr/share/phpmyadmin-php-bin/php .php
        FCGIWrapper /usr/share/phpmyadmin-php-bin/php .php3
        FCGIWrapper /usr/share/phpmyadmin-php-bin/php .php4
        FCGIWrapper /usr/share/phpmyadmin-php-bin/php .php5
        FCGIWrapper /usr/share/phpmyadmin-php-bin/php .phtml
	 AllowOverride All
	#RemoveHandler .php
	#AddType application/x-httpd-php .php
	#php_admin_value open_basedir /usr/share/phpmyadmin:/etc/phpmyadmin:/etc/phpMyAdmin:/tmp:.:..:./:../
	#php_admin_value upload_tmp_dir /tmp
	#php_admin_value include_path /etc/phpmyadmin:/etc/phpMyAdmin:.:..
	#php_admin_value session.save_path /tmp
	#php_admin_value safe_mode off
	DirectoryIndex index.php
	Order allow,deny
	Allow from all
</Directory>

and /etc/apache2/conf.d/squirrelmail.conf:


Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
        FCGIWrapper /usr/share/squirrelmail-php-bin/php .php
        FCGIWrapper /usr/share/squirrelmail-php-bin/php .php3
        FCGIWrapper /usr/share/squirrelmail-php-bin/php .php4
        FCGIWrapper /usr/share/squirrelmail-php-bin/php .php5
        FCGIWrapper /usr/share/squirrelmail-php-bin/php .phtml
	#RemoveHandler .php  .php3 .php4 .phtml
	#AddType application/x-httpd-php .php  .php3 .php4 .phtml
	#php_admin_value open_basedir none
	#php_admin_value upload_tmp_dir /tmp
	#php_admin_value session.save_path "/tmp"
	#php_admin_value include_path .:..
	#php_admin_value safe_mode off
	DirectoryIndex index.php
	Order allow,deny
	Allow from all
</Directory>

Now to create the respective php-bin directories:
Create a file called php in a new folder /user/share/phpmyadmin-php-bin/ and in /user/share/squirrelmail-php-bin/ with the contents:

#!/usr/bin/php5-cgi

Make sure it has execute permissions for apache, perhaps changing the owner to apache’s user/group would work, but apache must have execute permissions for this file or you will get a server error.

Lastly put the values for php_admin_value for PHPMyAdmin and Squirrelmail into a php.ini file in their own respective php-bin folders and you should be good to go, restart apache and they both should work fine again.

Comments:
  1. Comment #1

    We’ve been running ISPmanager using Apache Prefork and PHP via mod_fcgid for about a year. We recently tried to switch over to Worker MPM and found that almost all PHP apps failed (webmail, phpMyAdmin, etc.).

    Based on this article it sounds the most likely cause of the failures is the php_admin_value directives (though phpMyAdmin threw a “Cannot load mysqli extension. Please check your PHP configuration.” error.

    We noticed there is no /usr/sbin/php5-cgi binary on our server. Thoughts?

    Also, can you expand upon “Lastly put the values for php_admin_value for PHPMyAdmin and Squirrelmail into a php.ini file in their own respective php-bin folders”? What would the directives look like?

  2. Comment #2

    I’m trying to remember back to my ISPManager setup as I have since stopped using it so i’m sorry if the details are vague.

    Firstly you should probably install the mysqli extension if it’s missing and being requested, though I don’t remember it happening to me, or any of my apps requesting mysqli specifically, it may have been removed automatically when you changed to worker MPM.

    As well make sure mod_fcgid is installed as well as php5-cgi.

    You should remove the lines containing php_admin_value from the phpmyadmin and squirrelmail config files, I believe they are in the /etc/apache2/conf.d folder, so that it doesn’t try (and fail) to start apache, then copy the directives that were in the config files to a php.ini file in the newly created /usr/share/phpmyadmin-php-bin and /usr/share/squirrelmail-php-bin folders.

  3. Comment #3

    Hi Ben,

    I’m sorry for the off-topic, but could you please share with us the reason why you stopped using ISPmanager control panel?

    Thank you very much!

  4. Comment #4

    Hi Jaime,

    I like using ISPManager, no other control panel has come close in my opinion, the only problem I had that wasn’t my own fault was one update that didn’t go smoothly but the answer was found on the first page of the forums and easily fixed.

    I recently moved from VPS.net that provides free ISPManager Pro licenses to Linode and I used the opportunity as well as the guides on their website to see if I could manually set up all the services I need on my server without needing a control panel. So far it has gone well for me, the extra user features of control panels aren’t needed with this server as it only hosts a few different domains and users.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <p> <q cite=""> <strike> <strong>

Please leave these two fields as-is: