php5 include() problem

This is a discussion on php5 include() problem within the PHP General forums, part of the PHP Programming Forums category; I've got a cgi file in my cgi-bin folder that I'm calling with include(). It worked with ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-13-2007
Al
 
Posts: n/a
Default php5 include() problem

I've got a cgi file in my cgi-bin folder that I'm calling with include(). It worked with php4.

My shared host just upgraded to my server to php5.2.0 and the function doesn't work. I can't tell if the problem is a
php5 or server configuration [which may have changed during the upgrade] issue.

If I call the file as a URL directly, it works.
http://www.foo.org/cgi-bin/file.cgi?...est&perms=0755

file.cgi chmods the designated directory's permissions. It's a cgi with a php shebang #!/usr/bin/php

A simple file_exists() shows the file exists OK, TRUE.

I've tried using both syntaxes.

include("/home/foo/public_html/cgi-bin/file.cgi?dir=test&perms=0755");

include("www.foo.org/cgi-bin/file.cgi?dir=test&perms=0755");

Here is the error msg:
> Warning: include(/home/foo/public_html/cgi-bin/file.cgi?dir=/test&perms=0755)

[function.include]: failed to open stream: No such file or directory in /home/foo/public_html/EditPage/cgi_file_test.php
on line 15

Bottom line: It appears include() is not working right, for whatever reason.

Anyone have any ideas?

Thanks, Al........
Reply With Quote
  #2 (permalink)  
Old 05-13-2007
Tijnema !
 
Posts: n/a
Default Re: [PHP] php5 include() problem

On 5/13/07, Al <news@ridersite.org> wrote:
> I've got a cgi file in my cgi-bin folder that I'm calling with include(). It worked with php4.
>
> My shared host just upgraded to my server to php5.2.0 and the function doesn't work. I can't tell if the problem is a
> php5 or server configuration [which may have changed during the upgrade] issue.
>
> If I call the file as a URL directly, it works.
> http://www.foo.org/cgi-bin/file.cgi?...est&perms=0755
>
> file.cgi chmods the designated directory's permissions. It's a cgi with a php shebang #!/usr/bin/php
>
> A simple file_exists() shows the file exists OK, TRUE.
>
> I've tried using both syntaxes.
>
> include("/home/foo/public_html/cgi-bin/file.cgi?dir=test&perms=0755");
>
> include("www.foo.org/cgi-bin/file.cgi?dir=test&perms=0755");
>
> Here is the error msg:
> > Warning: include(/home/foo/public_html/cgi-bin/file.cgi?dir=/test&perms=0755)

> [function.include]: failed to open stream: No such file or directory in /home/foo/public_html/EditPage/cgi_file_test.php
> on line 15
>
> Bottom line: It appears include() is not working right, for whatever reason.
>
> Anyone have any ideas?
>
> Thanks, Al........
>


What the heck are you trying to do?
You want the cgi file to be executed? Or is there PHP code in the cgi file?
If you want the first, you should look at exec() or system() or such.
If there's PHP code, there's no sense in passing variables to the CGI
script, and if you remove the variables it will work.

Tijnema
Reply With Quote
  #3 (permalink)  
Old 05-13-2007
Myron Turner
 
Posts: n/a
Default Re: [PHP] php5 include() problem

Tijnema ! wrote:
> On 5/13/07, Al <news@ridersite.org> wrote:
>> I've got a cgi file in my cgi-bin folder that I'm calling with
>> include(). It worked with php4.
>>
>> My shared host just upgraded to my server to php5.2.0 and the
>> function doesn't work. I can't tell if the problem is a
>> php5 or server configuration [which may have changed during the
>> upgrade] issue.
>>
>> If I call the file as a URL directly, it works.
>> http://www.foo.org/cgi-bin/file.cgi?...est&perms=0755
>>
>> file.cgi chmods the designated directory's permissions. It's a cgi
>> with a php shebang #!/usr/bin/php
>>
>> A simple file_exists() shows the file exists OK, TRUE.
>>
>> I've tried using both syntaxes.
>>
>> include("/home/foo/public_html/cgi-bin/file.cgi?dir=test&perms=0755");
>>
>> include("www.foo.org/cgi-bin/file.cgi?dir=test&perms=0755");
>>
>> Here is the error msg:
>> > Warning:

>> include(/home/foo/public_html/cgi-bin/file.cgi?dir=/test&perms=0755)
>> [function.include]: failed to open stream: No such file or directory
>> in /home/foo/public_html/EditPage/cgi_file_test.php
>> on line 15
>>
>> Bottom line: It appears include() is not working right, for whatever
>> reason.
>>
>> Anyone have any ideas?
>>
>> Thanks, Al........
>>

>
> What the heck are you trying to do?
> You want the cgi file to be executed? Or is there PHP code in the cgi
> file?
> If you want the first, you should look at exec() or system() or such.
> If there's PHP code, there's no sense in passing variables to the CGI
> script, and if you remove the variables it will work.
>
> Tijnema
>

See the examples on this page: http://ca.php.net/include/
What you probably want to do is to change the cgi script to php and then
give the full url, incuding http.

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
Reply With Quote
  #4 (permalink)  
Old 05-13-2007
Richard Davey
 
Posts: n/a
Default Re: [PHP] php5 include() problem

Al wrote:

> I've got a cgi file in my cgi-bin folder that I'm calling with
> include(). It worked with php4.
>
> My shared host just upgraded to my server to php5.2.0 and the function
> doesn't work. I can't tell if the problem is a php5 or server
> configuration [which may have changed during the upgrade] issue.
>
> If I call the file as a URL directly, it works.
> http://www.foo.org/cgi-bin/file.cgi?...est&perms=0755


Check if the new configuration of PHP allows HTTP calls. Include,
require, fopen, etc are traditionally for local file-system files.
Obviously you're calling it via HTTP so you get the parsed output and
not the source code of the CGI script, but if your host has disabled URL
opens with PHP 5 then it would explain why it no longer works.

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"
Reply With Quote
  #5 (permalink)  
Old 05-14-2007
Al
 
Posts: n/a
Default Re: [PHP] php5 include() problem

Is there an alternate way to execute a php in cgi-bin so it can do a chmod() on site directories as the "owner"?

My approach was the only way I could think of. Given the obvious problem(s), it appears that it may not be a good choice.


Richard Davey wrote:
> Al wrote:
>
>> I've got a cgi file in my cgi-bin folder that I'm calling with
>> include(). It worked with php4.
>>
>> My shared host just upgraded to my server to php5.2.0 and the function
>> doesn't work. I can't tell if the problem is a php5 or server
>> configuration [which may have changed during the upgrade] issue.
>>
>> If I call the file as a URL directly, it works.
>> http://www.foo.org/cgi-bin/file.cgi?...est&perms=0755

>
> Check if the new configuration of PHP allows HTTP calls. Include,
> require, fopen, etc are traditionally for local file-system files.
> Obviously you're calling it via HTTP so you get the parsed output and
> not the source code of the CGI script, but if your host has disabled URL
> opens with PHP 5 then it would explain why it no longer works.
>
> Cheers,
>
> Rich

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:54 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0