Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: DavidCT - helmikuu 09, 2008, 01:19:39 IP

Otsikko: Problems with PHPsuexec (or suphp or something, PHP running as CGI)
Kirjoitti: DavidCT - helmikuu 09, 2008, 01:19:39 IP
Problem 1) auto_prepend_file and auto_append_file, moved from .htaccess to php.ini file, does not work.  Tried:

auto_prepend_file /home/name/public_html/file.php
auto_prepend_file "/home/name/public_html/file.php"
auto_prepend_file file.php
auto_prepend_file "file.php"

Doesn't seem to include it at all.  Error log shows an error with that line in the php.ini

---

Problem 2) Calling CGI from PHP.  I could never get a call to a Perl script from a PHP script to work, but made a work-around by calling a HTML file that SSI'd the CGI script, but that no longer works.

example:

phpscript.php...

include('file.html');

file.html...

<!--#include virtual="../cgi-bin/program.cgi"-->

---

If anyone has any ideas, let me know.  I've been googling, but no help so far.  Thanks.
Otsikko: Re: Problems with PHPsuexec (or suphp or something, PHP running as CGI)
Kirjoitti: cafewbmaster - helmikuu 09, 2008, 05:38:03 IP
It seems that you defined auto_prepend_file two times. Maybe its one of the reasons. The other one if you run suexec, mod_userdir etc users have noc access to directories outer their /home/username. In your example is not for multiuser system never mind. Try to put that code between virtual host place in httpd.conf.
Otsikko: Re: Problems with PHPsuexec (or suphp or something, PHP running as CGI)
Kirjoitti: CmptrWz - helmikuu 09, 2008, 06:10:43 IP
For CGI from PHP you probably want to look into the execution commands, such as the backtick operator, shell_exec, exec, system, passthru, etc.
Otsikko: Re: Problems with PHPsuexec (or suphp or something, PHP running as CGI)
Kirjoitti: DavidCT - helmikuu 10, 2008, 09:34:48 AP
Lainaus käyttäjältä: cafewbmaster - helmikuu 09, 2008, 05:38:03 IP
It seems that you defined auto_prepend_file two times. Maybe its one of the reasons.

No, those were the 4 methods I tried.  I only had 1 entry each attempt.

Lainaa
The other one if you run suexec, mod_userdir etc users have noc access to directories outer their /home/username. In your example is not for multiuser system never mind. Try to put that code between virtual host place in httpd.conf.

This I don't understand.  It is shared hosting.  All scripts run from public_html and beyond, nothing trying to access below that.
Otsikko: Re: Problems with PHPsuexec (or suphp or something, PHP running as CGI)
Kirjoitti: DavidCT - helmikuu 10, 2008, 09:37:38 AP
Lainaus käyttäjältä: CmptrWz - helmikuu 09, 2008, 06:10:43 IP
For CGI from PHP you probably want to look into the execution commands, such as the backtick operator, shell_exec, exec, system, passthru, etc.

I tried "passthru", didn't work.  Googling suggests the admin may block those types of things for security.  I'm just ticked that I have to rewrite my script in PHP from Perl and then have to redo several dozen pages for it.  In the long run it's better - all php, it's just a pain.  I was looking for a quick fix until I feel like coding.

I understand the suphp and phpsuexec reasonings, but I wouldn't run it if it were my server :)

---

Not officially solved, but I recoded my script to PHP so it's now moot ;)  Thanks anyway.