dbo Posted December 29, 2006 Share Posted December 29, 2006 I've got an external Perl script that makes a connection to a database based on command line arguments, makes a call to a webservice, does some XML parsing, and finally writes those results to a database. This script works perfectly when invoked from the command line.I'm attempting to call this script from a PHP web application (apache). Using system or exec functions I receive the following error:Service description 'http://mywebserviceurl' can't be loaded: 500 Can't connect to mywebserviceurl (Bad hostname)Any help with why I receive this error and a possible workaround are greatly appreciated.Thanks. Link to comment https://forums.phpfreaks.com/topic/32176-solved-php-exec-question/ Share on other sites More sharing options...
dbo Posted December 29, 2006 Author Share Posted December 29, 2006 ttt Link to comment https://forums.phpfreaks.com/topic/32176-solved-php-exec-question/#findComment-149361 Share on other sites More sharing options...
dbo Posted December 29, 2006 Author Share Posted December 29, 2006 any ideas? anyone? Link to comment https://forums.phpfreaks.com/topic/32176-solved-php-exec-question/#findComment-149435 Share on other sites More sharing options...
dbo Posted December 30, 2006 Author Share Posted December 30, 2006 wow, ive got no love here... Link to comment https://forums.phpfreaks.com/topic/32176-solved-php-exec-question/#findComment-149693 Share on other sites More sharing options...
Nhoj Posted December 30, 2006 Share Posted December 30, 2006 I'm going to assume that your perl script has a .pl extension here....Try doing...[code=php:0]exec('/path/to/your/script.pl');[/code] Link to comment https://forums.phpfreaks.com/topic/32176-solved-php-exec-question/#findComment-149733 Share on other sites More sharing options...
dbo Posted December 30, 2006 Author Share Posted December 30, 2006 That's essentially what I do and yes it has the .pl extension. I've been doing some reading elsewhere and am going to run into the office tomorrow and disable se linux.Read this at: http://www.php.net/manual/en/ref.exec.php[quote]Arjan van Bentem12-Jul-2006 12:38 When using Red Hat Fedora, beware of Security Enhanced Linux, SELinux. Quoted from Red Hat: "The security goal is to make sure that Apache HTTP is only reading the static Web content, and not doing anything else such as writing to the content, connecting to database sockets, reading user home directories, etc."These limitations include, among many other things, using exec to run external applications that happen to use sockets (or maybe access some files) such as HylaFAX "faxstat" as invoked from nweb2fax recvq.php and sendq.php.For debugging, one could try running such commands using PHP Shell (see http://mgeisler.net/php-shell/) which might fail while execution from the real command line (as Unix user apache or httpd) yields no problem whatsoever. See /var/log/messages for any denials due to the SELinux policy. To disable it:- System, Administration, Security Level and Firewall- open the SELinux tab- click the Transition tree- check Disable SELinux protection for Apache HTTP- execute /etc/init.d/httpd restartSee also http://fedora.redhat.com/docs/selinux-faq/ and http://php.net/results.php?q=selinux&p=wholesite [/quote]We'll see what happens. If you have any other suggestions I'm all ears Nhoj. Nonetheless I appreciate your response. Link to comment https://forums.phpfreaks.com/topic/32176-solved-php-exec-question/#findComment-149742 Share on other sites More sharing options...
dbo Posted December 30, 2006 Author Share Posted December 30, 2006 As it turns out it was just a configuration change through SELinux... for anyone that cares. Link to comment https://forums.phpfreaks.com/topic/32176-solved-php-exec-question/#findComment-150062 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.