Jump to content

HELP! New host is not allowing me to include PERL scripts in PHP pages


howard-moore

Recommended Posts

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

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

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

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

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

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

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.

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.

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

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!

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.