gple Posted October 29, 2011 Share Posted October 29, 2011 i just moved hosts and it seems that one of my codes does not work. When I try to open a file via fopen (), i constantly get the message 401-unauthorized. Thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/ Share on other sites More sharing options...
jcbones Posted October 29, 2011 Share Posted October 29, 2011 Are you opening a file, or a URL? If it is a file, set the file permissions. IF it is a URL, the fopen wrappers may be disabled in the php.ini file Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/#findComment-1283279 Share on other sites More sharing options...
gple Posted October 29, 2011 Author Share Posted October 29, 2011 the file permission is set to 777 Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/#findComment-1283299 Share on other sites More sharing options...
jcbones Posted October 29, 2011 Share Posted October 29, 2011 401 unauthorized is a HTTP return, so you must be opening the file with a URL. Is this correct? This post could be taken care of faster, if there was code interjected. Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/#findComment-1283301 Share on other sites More sharing options...
gple Posted October 29, 2011 Author Share Posted October 29, 2011 $get_lcat=mysql_query("select * from files where type='Cat' order by id desc"); $category=mysql_result($get_lcat,0,'file'); $fd = fopen ($category, "r"); Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/#findComment-1283312 Share on other sites More sharing options...
jcbones Posted October 29, 2011 Share Posted October 29, 2011 What is the contents of $category? Just one example will do. Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/#findComment-1283323 Share on other sites More sharing options...
gple Posted October 29, 2011 Author Share Posted October 29, 2011 1 formats.csv Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/#findComment-1283327 Share on other sites More sharing options...
jcbones Posted October 29, 2011 Share Posted October 29, 2011 This is the only thing I can find for you at the moment: Fixing 401 errors - general Each Web Server manages user authentication in its own way. A security officer (e.g. a Web Master) at the site typically decides which users are allowed to access the URL. This person then uses Web server software to set up those users and their passwords. So if you need to access the URL (or you forgot your user ID or password), only the security officer at that site can help you. Refer any security issues direct to them. If you think that the URL Web page *should* be accessible to all and sundry on the Internet, then a 401 message indicates a deeper problem. The first thing you can do is check your URL via a Web browser. This browser should be running on a computer to which you have never previously identified yourself in any way, and you should avoid authentication (passwords etc.) that you have used previously. Ideally all this should be done over a completely different Internet connection to any you have used before (e.g. a different ISP dial-up connection). In short, you are trying to get the same behaviour a total stranger would get if they surfed the Internet to the Web page. If this type of browser check indicates no authority problems, then it is possible that the Web server (or surrounding systems) have been configured to disallow certain patterns of HTTP traffic. In other words, HTTP communication from a well-known Web browser is allowed, but automated communication from other systems is rejected with an 401 error code. This is unusual, but may indicate a very defensive security policy around the Web server. What this means is, you must take it up with your host. Quote Link to comment https://forums.phpfreaks.com/topic/250058-401-unauthorized/#findComment-1283331 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.