473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Calling "php -f [file]" from within Perl seems broken

I've recently decided to switch from compiled Apache/PHP to RPM's of
both and I'm having a problem I can't seem to solve. I have a Perl
script called php_include.cgi that parses a PHP file for inclusion. It
does this by running "php -f [php include file]" but unfortunately it
no longer works with the RPM:

----------

Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual
page for CGI security.

For more information about changing this behaviour or re-enabling this
webserver, consult the installation file that came with this
distribution, or visit the manual page.

----------

The RPM for PHP obviously compiles with --enable-force-cgi-redirect.
If I either set cgi.force_redirect = 0 in php.ini or set
$ENV{REDIRECT_STATUS}="200"; in my Perl script, this error goes away,
as expected.

The weird part is that I do something like this in my Perl:

print `/usr/bin/php -f /var/www/html/includes/footer.php`;

Which you would expect to parse and output footer.php. Oddly, it
prints the contents of php_include.cgi (the calling Perl script)
instead! If I run the exact same command in a shell (even as my apache
user) it works correctly. When called from the web, it displays the
Perl script, not the php.

I've confirmed this a bunch of different ways.

Yes, I know I could blame this on the RPM, but I'd like to move to a
"standardized" load if possible... Makes updates easier... Also, this
one's got my curiosity...

Any help or insight would be appreciated.
Thanks
Mike
Jul 17 '05 #1
0 2150

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Horst Haas | last post by:
Hallo NG, I'm calling PHP from a windowsprocess in a simple Webserver application. I'm using the createprocess Windows API command.... C:\Php\PHP Filename.php In this file I will open a...
4
by: David Van Horn | last post by:
As a shell script, the following program works as expected. --------------------------------------- #! /usr/bin/sh echo '<html><? print 1 ?></html>' | php...
12
by: bhennon | last post by:
Hey all, I have a small php script that calls a random image at the following page. http://www.2006ymcanationals.com/random.php IT WORKS IF I go directly to the above link. I am trying to...
3
by: Hugz | last post by:
Hello, And Thank you for taking time to help me.Myself Hugz.I am new to perl and want to write my own Scripts.But i can't understand how perl "rename" function and "file locking" works. ...
3
by: Acrobatic | last post by:
Hello I've got a simple Perl script that works fine from the command line but not from PHP via the browser. It's a conversion program that converts an image to a different format, and writes the...
19
by: hansBKK | last post by:
Upfront disclaimer - I am a relative newbie, just starting out learning about PHP, mostly by researching, installing and playing with different scripts. I am looking for a host that will provide...
1
by: rahulthathoo | last post by:
Hi, After i finish some amount of computation using a perl script, i need to send out an email to a receipient which can change and is known to the Perl script. Is there a way to call the...
7
by: =?Utf-8?B?R2F1cmF2?= | last post by:
Hi...I have a requirement to find the first file within a directory. I know we can use the GetFiles() method of Directory class, but am a little stuck up with the syntax. Can somebody plz let me...
3
by: jeremy.gehring | last post by:
Hey all, OK I'm not much of a PHP programmer; but needs must as they say. I have written AJAX file upload system that uses a PERL CGI script so that a PHP script can get the progress (nifty...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.