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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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........ |
|
|||
|
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 |
|
|||
|
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/ |
|
|||
|
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" |
|
|||
|
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 |