PDA

View Full Version : Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not inclu


Pasco
10th July 2008, 17:22
I followed the following Tutorial to enable a "switch" on my ISPConfig for PHP4 and PHP5: [URL="http://www.howtoforge.com/apache2_suphp_php4_php5"].

On the first site it says:

2 Disable the Apache PHP Module

If you already had Apache2 installed with PHP4 as a module, you must disable that module now because suPHP uses the CGI version of PHP to work (if you don't know if you have PHP4 installed as module, you can also run this command - it doesn't hurt):

a2dismod php4

Do the same for PHP5 if you have the PHP5 module installed (the official Debian Sarge repositories don't have PHP5 packages, however it's possible that you installed third-party PHP5 packages like those from http://www.dotdeb.org):

a2dismod php5

Then restart Apache:

/etc/init.d/apache2 restart

As soon as I want to restart apache2 it says:

Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not included in the server configuration

I earased all php_admin commands in the vhost-file and started again. Apache can be started now of course, but my websites don't work anymore... I guess I get this error because of the disabled php4 module?

But how can I work around?

Another thing is, that I followed the tutorial altough, at the end the ISPConfig-vhost-file isn't rewrite automatically anymore... :-( What did I wrong?

falko
11th July 2008, 14:41
Apache doesn't start because you already have PHP-enabled web sites, but you've disabled PHP. That's also the reason why ISPConfig doesn't rewrite the Vhosts_ispconfig.conf file anymore.

I recommend to follow the tutorial to the end and ignore the failed Apache restarts during the tutorial.

Pasco
11th July 2008, 19:31
I've already tried that. The problem is, that I can't start apache2. So I tried to clear all the php_admin_flags in Vhosts_ispconfig.conf and restarted apache2. But the problem that Vhosts_ispconfig.conf still doesn't get rewrite with the appropriate suPHP commands (Engine on etc.) persists...strange, isn't it?

I thought I could set / let ISPConfig set the php_admin_flags correspondending suPHP-commands, but it doesn't work...But it should, doesn't it?

This is an Debian 3.1 Server which I upgraded to Etch.

I tried the whole thing on another box, which was Debian Etch installed (without any web and so no php_admin_flags yet) and it all worked flawlessly...

falko
12th July 2008, 13:14
I guess you have now some Vhosts_ispconfig.conf files with a date in the filename in /etc/apache2/vhosts. Does any one of them contain the new suPHP directives? If so, rename it to Vhosts_ispconfig.conf and run
httpd -t
Does it show syntax errors?

Pasco
13th July 2008, 13:16
Yes, there a some of these Vhosts_ispconfig.conf files...but none of them contains any suPHP directives, only suExec. Does suExec conflict with suPHP? I've previously installed suExec.

I also tried to redo all the suPHP Tutorial, several times. With php_admin_flags and without. It seems, the suPHP directives just don't get into Vhosts_ispconfig.conf, even though Vhosts_ispconfig.conf gets now rewrite. :confused:

till
13th July 2008, 13:30
You can not use php_admin_flags with suphp. php_admin_flags is only for mod_php.

If you want to use suphp with ISPConfig, you must switch to suphp in the file config.inc.php, then change a setting in one of your sites so that ispconfig updates the Vhost_ispconfig.conf file. ISPConfig will remove all php_admin_flags that were added by ISPConfig, but if you added php_admin_flags manuually in the apache directievs field or a .htaccess file, you will have to remove them first.

Pasco
13th July 2008, 16:08
Thanks till! Works perfectly! VHost_ispconfig.conf gets now rewrite with the suphp directives and works! :D (at my other server, config.inc.php got rewrite with the value "suphp" automatically? Why had I to switch manually? Does it depend on the distro?)

I still got two questions left:

1. If I got it right, I have to switch the php-Version with editing VHost_ispconfig.conf manually, right? So far ok. But if I (or a reseller/client) do 1 change in my/their ISPConfig Panel, the whole file VHost_ispconfig.conf gets rewrite, so it overwrites my manually edited change to the other php-version (in my case php5, because standart is php4 on my Debian System).
Can I prevent automatic overwriting somehow? Perhaps I have to place my manually added apache directive on a special place in the VHost_ispconfig.conf? So that only this directives got read from apache2 and it won't get overwritten?

2. Can I still use the "apache directives" field in ISPConfig Panel for adding my php_admin_flags and php_admin_values? Or how can I set these values with suphp? I tried adding it manually with "setEnv php_admin_flags" but I got errors, actually..

Thanks so much.

till
13th July 2008, 16:41
1) Thats not correct. The Vhsot_ispconfig.conf has never to be edited and can not be edited. If you want t change the php version, install php5 as cgo and edit the suphp configuration in /etc/

2) No, php_admin_flag and php_admin_values are not supported by suphp, they are mod_php specific.

Pasco
13th July 2008, 16:43
I just noticed that if I switch to php5 there are no modules installed like gd or mysql. So I get following errors if I want to access a site:

Database Error: Unable to connect to the database:The MySQL adapter "mysql" is not available.

Do I have to install and enable all modules for php5? How do I do that?

till
13th July 2008, 17:01
Do I have to install and enable all modules for php5?

Yes.

How do I do that?

Install them with the package management tool of the linux distribution.

Pasco
13th July 2008, 17:11
1) Thats not correct. The Vhsot_ispconfig.conf has never to be edited and can not be edited. If you want t change the php version, install php5 as cgo and edit the suphp configuration in /etc/

2) No, php_admin_flag and php_admin_values are not supported by suphp, they are mod_php specific.

1) But in the mentioned how to (How To Set Up suPHP with PH4 and PHP5) on the third an last page it says:

If you want to use PHP5, use the x-httpd-php5 handler:

<VirtualHost 1.2.3.4>
ServerName www.example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www

suPHP_Engine on
suPHP_UserGroup testuser test
AddHandler x-httpd-php5 .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php5
</VirtualHost>

2) Does this mean, that I can't set any of these variables for php with a suPHP-Installation? Or are just the directives a different syntax?


3) Install them with the package management tool of the linux distribution.

So it's apt-get install xy for Debian Etch I guess. Thanks.

till
13th July 2008, 17:21
1) This nis not a howto for ISPConfig.

2) Yes, and this has nothing to do with ISPConfig.

Or are just the directives a different syntax?

No. But instead you can have a complete custom php.ini file for every website. For details you should have a look at the suphp homepage: http://www.suphp.org/Home.html

The installation guide for ISPConfig would have been this one:

http://www.howtoforge.com/install-suphp-on-various-linux-distributions-for-use-with-ispconfig-2.2.20-and-above

Pasco
13th July 2008, 17:34
The installation guide for ISPConfig would have been this one:

http://www.howtoforge.com/install-su...2.20-and-above

Ups...:o Thanks till! Now I got it... :)


No. But instead you can have a complete custom php.ini file for every website. For details you should have a look at the suphp homepage: http://www.suphp.org/Home.html

Great! That sounds pretty cool, exactly what I was looking for! 2 in 1 : )

Pasco
13th July 2008, 18:07
1) Thats not correct. The Vhsot_ispconfig.conf has never to be edited and can not be edited. If you want t change the php version, install php5 as cgo and edit the suphp configuration in /etc/


Still have one question left: I want to be able to switch between PHP4 and PHP5 for each single vhost. So how can I achieve this if not editing VHost_ispconfig.conf? I have configured PHP4 and PHP5 in /etc/suphp.conf like that:

[handlers]
;Handler for php-scripts
x-httpd-php=php:/usr/bin/php4-cgi
x-httpd-php5=php:/usr/bin/php5-cgi

falko
14th July 2008, 15:58
You can use the Apache Directives field in ISPConfig to insert custom directives.

Pasco
14th July 2008, 17:25
I've installed php4 as CGI, php5 as CGI and suPHP. What kind of apache directives let me switch to php5 (as php4 is standart)?

I don't get it. If I put a apache directive in the ISPConfig Panel, it will be placed on top of the web's virtual host.

So if I'd like to switch to php5 for a certain web, I would place following apache directive:

AddHandler x-httpd-php5 .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php5?

But further down there will still be following in the Vhost_ispconfig.conf File:

<VirtualHost 192.168.1.100:80>
suPHP_ConfigPath /var/www/suphp_conf/test.com
AddHandler x-httpd-php5 .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php5
SuexecUserGroup testuser testgroup
ServerName www.test.com:80
ServerAdmin webmaster@test.com
DocumentRoot /var/www/web6/web

AddType application/x-httpd-php .php .php3 .php4 .php5
<Directory /var/www/web6/web>
suPHP_Engine on
suPHP_UserGroup test.com web6
AddHandler x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php
SetEnv php_safe_mode On
</Directory>


So it's still php4 on that vhost? :confused:

I'm sorry, but I can't see how to override this automatically setting in VHost_ispconfig.conf File...

Can you help me one more please? Thanks so much.

falko
15th July 2008, 17:16
You should disable suPHP in ISPConfig so that the second set of PHP directives uses mod_php instead of suPHP.

Pasco
15th July 2008, 18:16
You mean disable suPHP globally on ISPConfig? And then insert the mentioned directives?

falko
16th July 2008, 18:26
Yes, that's right.