11-10-2007, 12:50 PM
Ive been using this code on a linux / cpanel server to include a perl file within a php page
I noticed that it only worked when I used the absolute url rather than a relative url
Anyway, I changed webservers to another cpanel package with a different host and the above code does not work anymore.
Does anyone have any suggestions?
11-10-2007, 03:13 PM
Anything more informative than "doesn't work"? Have you tried to load the perl page in your browser to see the output? It's possible that your new host has fopen wrappers disabled. There's nothing wrong with the code itself as long as the path is correct.
Edit: Put this code in a php page to see if your host allows fopen wrappers and including from them:
echo 'allow_url_fopen: ' . ini_get('allow_url_fopen') . '<br />allow_url_include: ' . ini_get('allow_url_include');
11-11-2007, 03:38 AM
Sorry, I forgot I had error messaging disabled.
Here are the error messages...
Warning: require() [function.require]: URL file-access is disabled in the server configuration
Warning: [function.require]: failed to open stream: no suitable wrapper could be found in.
I used your code...
allow_url_fopen is enabled
allow_url_include is disabled,
My host informed me that they would not enable allow_url_include
11-11-2007, 04:24 AM
Yeah, you won't be able to use that code like that. You should be able to use something like this though, since url_fopen is enabled:
11-11-2007, 12:55 PM
However, file_get_contents just displays the contents of the perl file - it does not interpret it. (it also can't handle any query string e.g. file.pl?display=today)
I'll keep playing around with it... I'm open to any other suggestions you or anyone else has.
11-11-2007, 05:26 PM
If you use a URL for the path it should be interpreted by the server before it's sent to your PHP script.
11-12-2007, 08:46 AM
Ok, all sorted now.
Really appreciated your help with this Inigoesdr.
I also sorted out the query string issue-I had variables in the string (example below)
echo file_get_contents('http://www.mysite.com/cgi-bin/file.pl?display=' . $today . '&time=' . $time);