Link to home
Start Free TrialLog in
Avatar of R7AF
R7AFFlag for Netherlands

asked on

Invalid command 'php_flag'

I'm trying to get the Zend Framework configured correctly locally with Postgresql. I use PHP 5.2.6, Zend Core, Apache httpd on Windows Vista. I get the following error (500 Internal Server Error):

.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration

Below is the .htaccess code. I can't figure out how to fix this php_flag.
# Rewrite rules for Zend Framework
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
# Security: Don't allow browsing of directories
Options -Indexes
# PHP settings
php_flag magic_quotes_gpc off
php_flag register_globals off
php_flag short_open_tag on

Open in new window

Avatar of hernst42
hernst42
Flag of Germany image

have you configured php als cgi in that apache or as apache module?
php_ directives in apache are only available if mod_php is available for apache.

what does a phpinfo() page show (where no .htaccess is palced so php works)
Avatar of R7AF

ASKER

I can't find mod_php in httpd.conf nor in the apache modules folder. In phpinfo mod_php is not mentioned. I tried to download mod_php, but couldn't find it. (I don't know if it makes a difference, but I work on Windows!)
What do you get in your phpinfo for "Server API"?
Should be "Apache 2.0 Handler". Don't know if its calle mod_php might also be libphp or something like that.
Avatar of R7AF

ASKER

Server API: CGI/FastCGI

I'm using Zend Framework and Apache/2.2.10 (Win32). I've searched httpd.conf for "php5_module", "php5apache2.dll" and for "scriptalias". I could only find the last one.

ScriptAlias /cgi-bin/ "C:/Program Files/Zend/Apache2/cgi-bin/"

In the Zend folder, I can only find files like zend_fcgi.dll, so it seems to depend on that. Another possible problem might be that php5apache2.dll does not work with Apache 2.2.10. (See last post of http://forums.devshed.com/apache-development-15/apache-error-can-t-load-find-php5apache2-dll-349394.html ).
Avatar of R7AF

ASKER

In the httpd.conf I find the following code:
LoadModule zend_enabler_module "C:/Program Files/Zend/Core/modules/apache2.2/zend_fcgi.dll"
FastCgiConfig "C:/Program Files/Zend/Core/etc/fastcgi.conf"
AddHandler fastcgi-script .php .phtml 
AddType application/x-httpd-php .php .phtml 
<Location /ZendCore>
  Order deny,allow
  Allow from all
</Location>
Alias /ZendCore "C:/Program Files/Zend/Core/GUI"

Open in new window

php_flag does not work with fast-cgi. So with that configuration you can't use php_flag.

That article is completly outdated. The latest PHP5 works with apche 2.2.x
Avatar of R7AF

ASKER

So do you have any ideas how I can get this working? Is there an alternative for php_flag? Can I install an apache php-module?
SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial