howard-moore Posted December 17, 2007 Share Posted December 17, 2007 I have just bought a new hosting package with Heart Internet. Previously I was with 1and1 Internet. Unfortunately, my new website does not seem to be working with the new host. The problem I am having is that I have a news script in PERL, and I want to have the news results shown on the homepage (index.php). On my old host I used the following code with great success: <?php include ('http://www.twmdebtdirect.com/news/newssmall.pl'); ?> However, you can see the results of this in the new host at www.twmdebtdirect.com. Basically, it is not working at all. I have been told that it is something to do with the php.ini settings, but I am something of a novice, and I have no idea what to do next. Can anyone help please? Thanks, Neil Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 17, 2007 Share Posted December 17, 2007 includes follow internal paths not extneral so it is probably more like <?php include("news/newssmaill.pl"); ?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 17, 2007 Share Posted December 17, 2007 That probably won't work, since PHP will try to interpret the PERL code as PHP and get errors. When the OP is probably doing is using the output from the PERL script in the PHP script. The INI option that has to be set is "allow_url_include". See ini_set() Ken Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 17, 2007 Share Posted December 17, 2007 Check your web server log for errors. It is probably the allow_url_fopen and/or the allow_url_include settings (both must be on) not allowing http requests in the include statement. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 17, 2007 Share Posted December 17, 2007 Another thought is, sometimes hosts limit cgi scripts to the cgi-bin folder in your web root. Your PERL scripts might have to reside there to be parsed by PERL. PhREEEk Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks for the posts. This is pretty much what I thought the issue was (i.e. allow_url_open and allow_url_include settings). I am however a real novice when it comes to PHP. I have managed to create an info file to see the global php.ini settings, but I have no idea how to change these for my directory (I have a shared hosting account, and the host said that they would not change the global settings). Can anyone tell me how to change the php.ini settings (remember I am a complete newbie to PHP!). Thanks, Neil Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 18, 2007 Share Posted December 18, 2007 have you tried using ini_set() read more at http://php.net/ini_set mostly on a shared host you cannot change the settings with ini_set however you can give it a try you could also try htaccess Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks for the post. I don't suppose anyone knows of an idiots' guide to doing this? I really have no idea, and links to the PHP website are not too helpful for me! Thanks again, Neil Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 18, 2007 Share Posted December 18, 2007 your code should be ini_set("allow_url_include","On"); Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 That's great, thanks. However, where would I put this code? I really am a complete newbie! Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 18, 2007 Share Posted December 18, 2007 write on top with your session_start if you have one. Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 I put this at the top of my index.php file: <?php session_start(); ini_set("allow_url_include","On"); ?> However, I still got this when I opened the page: Warning: main(http://www.twmdebtdirect.com/news/newssmall.pl) [function.main]: failed to open stream: Connection refused in /home/sites/twmdebtdirect.com/public_html/index.php on line 130 Warning: main(http://www.twmdebtdirect.com/news/newssmall.pl) [function.main]: failed to open stream: Connection refused in /home/sites/twmdebtdirect.com/public_html/index.php on line 130 Warning: main() [function.include]: Failed opening 'http://www.twmdebtdirect.com/news/newssmall.pl' for inclusion (include_path='.:/usr/share/pear') in /home/sites/twmdebtdirect.com/public_html/index.php on line 130 Any more ideas? Thanks, Neil Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 18, 2007 Share Posted December 18, 2007 try file_get_contents instead of include... Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 Nope - still got this error message: Warning: file_get_contents(http://www.twmdebtdirect.com/news/newssmall.pl) [function.file-get-contents]: failed to open stream: Connection refused in /home/sites/twmdebtdirect.com/public_html/index.php on line 130 Anyone have any further ideas? Thanks, Neil Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 18, 2007 Share Posted December 18, 2007 Well that just means that your hosting provider has disabled the functionality and any means of turning it on. there could be other ways of getting it but since they disabled most of the functionality I don't think that too will work. Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 Is there not a way of creating a separate php.ini file for certain directories? I heard that this might be possible, but I have absolutely no idea how it is done. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 18, 2007 Share Posted December 18, 2007 The two settings mentioned are not settable in the script in php5 (please consult the php manual.) It is implied in the manual that they are settable in a script in PHP6. In php5 they are only settable in PHP_INI_SYSTEM, meaning a php.ini or httpd.conf file. If your host allows a local php.ini file and they have not specifically prohibited those settings from being changed, then you should be able to put the statements to set them into a file named php.ini and place it into your root document folder. Check with your web host to make sure. Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 I am pretty sure that they allow this, but I have no idea how to create a php.ini file, or indeed how to make sure that the server looks at this file for that domain. (once again - I am a complete newbie!) Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 18, 2007 Share Posted December 18, 2007 What does the PERL script do? Is it something you wrote? If we knew what it does, perhaps it can be re-written in PHP an put inline in your code. Ken Quote Link to comment Share on other sites More sharing options...
Lamez Posted December 18, 2007 Share Posted December 18, 2007 I am not trying to advertise or anything, but if you are looking for a better host, at a cheap cost you could try http://www.servage.net/?coupon=cust33591 they allow pretty much everything go for it, using that coupon code, you get 25gb more. take a look if you are thinking about switching Quote Link to comment Share on other sites More sharing options...
trq Posted December 18, 2007 Share Posted December 18, 2007 Actually, if the perl scripts are on your server, there may not be a need to call them via a url at all. <?php echo shell_exec('news/newssmall.pl'); ?> Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks for that. Unfortunately it is still not working. If I use the relative path it does not actually 'run' the PERL script, but rather calls the script as an HTML page (i.e. showing all the text). If I use the absolute path (i.e. including http://www.twmdebtdirect etc) it does not show anything at all! Quote Link to comment Share on other sites More sharing options...
trq Posted December 18, 2007 Share Posted December 18, 2007 Another thing to check is that your host actually supports mod_perl. If I use the absolute path (i.e. including http://www.twmdebtdirect etc) it does not show anything at all! Thats a url, not an absolute path. Your host should provide some documentation on setting up your own php.ini. They usually include an example file to use. Quote Link to comment Share on other sites More sharing options...
howard-moore Posted December 18, 2007 Author Share Posted December 18, 2007 Oops! I did mean URL - sorry! I asked the host, and they said that they could not advise on setting up a php.ini file! I think it may be time to look elsewhere for different host! Thanks again, Neil Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.