Jump to content

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


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

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.

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 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!)

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.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.