LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-21-2010, 05:08 AM   #1
jayasekar
Member
 
Registered: May 2008
Posts: 39

Rep: Reputation: 16
Lightbulb permission denied error in php socket programming


hi friends,
1. I hv done a simple client application in php to send "hello world" to the port 1234 in 127.0.0.1 (localhost).
(google in net for php client program)
2. opened terminal and
$nc -l 1234

so that whatever comes in port 1234 i will get it from the terminal.

1. socket successfully created.
2. Attempting to connect to '127.0.0.1' on port '1234'...socket_connect() failed. Reason: () Permission denied
3. if i run in terminal,
$php client.php
No issues, it is communicating.
if i access the same with browser (firefox) it is giving problem.

Error in :
echo "Attempting to connect to '$address' on port '$port'...";
$result = socket_connect($socket, $address, $port);
if ($result === false) {
echo "socket_connect() failed.\nReason: ($result) ";
echo "\n". socket_strerror(socket_last_error($socket)) . "\n";
} else {
echo "successfully connected to $address.\n";
}

can some one help me to resolve the issue

Last edited by jayasekar; 01-21-2010 at 05:33 AM.
 
Old 01-21-2010, 06:04 AM   #2
jayasekar
Member
 
Registered: May 2008
Posts: 39

Original Poster
Rep: Reputation: 16
Lightbulb

Problem solved:
type
$/usr/sbin/setsebool httpd_can_network_connect=1
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsh connections : rcmd: socket: Permission denied tiuz Linux - Networking 8 08-21-2009 08:21 AM
php failed: Permission denied (13) in rino.caldelli Linux - Software 2 03-18-2006 11:25 AM
Couldn't create socket: Permission denied piforever Fedora 9 12-22-2005 04:52 PM
Uploading files using PHP giving Permission Denied error MatthewG Programming 4 05-27-2004 03:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration