|
Subject
|
CGI in PHP
|
| | Posted by | retrograde (DH Familiar) | | Posted on | 07/07/04 05:56 PM |
|
|
I have a .php page and I want to call a CGI file. However, I am unable to use the function virtual because it says it doesn't exist.
Has this been disabled on Dreamhost? Is there another way for me to call a CGI file from within a PHP document?
I could call the CGI file via SSI if I were to use .shtml, but I need to use PHP.
I hope this makes sense. :)
|
|
|
|
|
|
the same problem for me
|
|
|
|
|
|
In reply to:
I have a .php page and I want to call a CGI file. However, I am unable to use the function virtual because it says it doesn't exist.
The virtual() function only works when PHP is installed as an Apache module. The default setting is for PHP running as a CGI application. If you are using PHP4, it may be possible to switch to using mod_php, but not with PHP5.
-------- Simon Jessey | Keystone Websites Save $97 on yearly plans with promo code SCJESSEY97
|
|
|
|
|
|
In my panel control PHP is configured on 4.4.2.
How i can switch mod_php ?
Thanks for support
|
|
|
|
|
|
You *may* not be able to... the "old" control panel *used* to have a checkbox for "Run PHP as CGI (recommended)", and you could "uncheck" that box to run as an apache module. That checkbox is no longer available on the control panel for any of my domains, even ones where it used to be present. :-( --rlparker
|
|
|
|
|
|
In reply to:
How i can switch mod_php ?
Add this to your .htaccess file, and you should be able to get mod_php working:
AddHandler application/x-httpd-php .php This will not work with PHP5.
-------- Simon Jessey | Keystone Websites Save $97 on yearly plans with promo code SCJESSEY97
|
|
|
|
Subject
|
Re: CGI in PHP
[re: nuwake]
|
| | Posted by | Vendetta (DH New User
) | | Posted on | 05/26/06 08:09 AM |
|
|
I ahev this on my root .htaccess
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
# END WordPress
Where i put your code ?
|
|
|
|
|
|
I have modified the .htaccess :
# BEGIN WordPress AddHandler application/x-httpd-php .php <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
# END WordPress
It's correct ?
Now i don't receive any error from virtual function, and the scripts seem to work.
But you can explain me what do the function AddHandler application/x-httpd-php .php ???
Many thanksss
|
|
|
|
|
|
In reply to:
But you can explain me what do the function AddHandler application/x-httpd-php .php ???
It instructs all files with the extension of .php to be interpreted by the mod_php Apache module, instead of the PHP CGI binary.
-------- Simon Jessey | Keystone Websites Save $97 on yearly plans with promo code SCJESSEY97
|
|
|
|
|
|
with your line i receive an error in other php application:
Warning: shell_exec() has been disabled for security reasons
|
|
|
|
|
|
In reply to:
with your line i receive an error in other php application:
Warning: shell_exec() has been disabled for security reasons
Well, that would be because shell_exec() has been disabled for security reasons!
Seriously though, DreamHost will not allow you to run external processes when using mod_php, because any that you execute run as Apache's user/group instead of your own.
-------- Simon Jessey | Keystone Websites Save $97 on yearly plans with promo code SCJESSEY97
|
|
|
|
|
|
The script with shell_exec is in another folder...i can setup a different .htaccess for working with PHP as CGI ?
|
|
|
|
|
|
I don't know - I've never tried it.
-------- Simon Jessey | Keystone Websites Save $97 on yearly plans with promo code SCJESSEY97
|
|
|
|
|
|
Have you any idea ? I don'k know what i must put in htaccess...i'm a total newbie :((
|
|
|
|
|
|
Is it possible use conditional function in htaccess to set php as CGI working only in a specific directory like this example ?
IfModule mod_fastcgi.c> FastCgiIpcDir /usr/local/www/fcgi_ipc/tmp AddHandler fastcgi-script .fcgi FastCgiSuexec /usr/local/sbin/suexec FastCgiConfig -singleThreshold 100 -killInterval 300 -autoUpdate -idle-timeout 240 -pass-header HTTP_AUTHORIZATION </IfModule>
|
|
|