?
Solved

Invalid command 'php_flag'

Posted on 2009-04-08
9
Medium Priority
?
3,039 Views
Last Modified: 2013-11-10
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

0
Comment
Question by:R7AF
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 24097321
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)
0
 
LVL 13

Author Comment

by:R7AF
ID: 24098066
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!)
0
 
LVL 48

Expert Comment

by:hernst42
ID: 24099348
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Author Comment

by:R7AF
ID: 24104973
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 ).
0
 
LVL 13

Author Comment

by:R7AF
ID: 24105010
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

0
 
LVL 48

Expert Comment

by:hernst42
ID: 24105694
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
0
 
LVL 13

Author Comment

by:R7AF
ID: 24135724
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?
0
 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 2000 total points
ID: 24135740
> Is there an alternative for php_flag?
Read carefully http://www.php.net/manual/en/configuration.changes.php

> Can I install an apache php-module?
yes http://www.php.net/manual/en/install.windows.apache2.php
0
 
LVL 13

Accepted Solution

by:
R7AF earned 0 total points
ID: 24168476
I found the solution:
https://www.hostingclientsupport.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=34

I can add these parameters to php.ini.
0

Featured Post

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question