Jump to content

[SOLVED] PHP Exec question


dbo

Recommended Posts

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

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 Bentem
12-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 restart

See 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.

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.