otuatail Posted January 16, 2010 Share Posted January 16, 2010 Sorry guys but need a tech input here. I use a windows based PC to write my php website. I believe that there are several types of php website. I can have a proper unix based website or I can have a dreaded MICROSOFT website with apache webserver running on it. I had a website some time ago and it was running slow. I noticed that it had a strange folder in it .NET. I challenged the company over this. They admitted that my website was actually running on windows server. I find myself in the same situation again. I am told that this website is realty on a Unix box. Problem is, some code that works on a genuine Unix server, does NOT work when transferred to the new website. Can any of you guys shed some light on this or tell me if I am going insane. <?php $fp = fopen('desmond.txt', 'a'); fwrite($fp, 'Top o the morning to ya'); fclose($fp); echo ("Hi Guys"); ?> This does not work on the new website. I used to write old style C code and fopen() and used the Brian Kernighan and Dennis Ritchie code. Is this something that does not work on a windows based system. Can I find out what is going on. Desmond. Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/ Share on other sites More sharing options...
MadTechie Posted January 16, 2010 Share Posted January 16, 2010 does NOT work Doesn't help too much, I'll have to assume the its a permissions problem, check the folder/file has write access, (this doesn't affect Windows, so that's probably the problem. Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996279 Share on other sites More sharing options...
otuatail Posted January 16, 2010 Author Share Posted January 16, 2010 permissions httpdocs = drwxr-x--- Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996282 Share on other sites More sharing options...
MadTechie Posted January 17, 2010 Share Posted January 17, 2010 does it work on 0755 or 0777 ? Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996283 Share on other sites More sharing options...
otuatail Posted January 17, 2010 Author Share Posted January 17, 2010 note sure what does it work on 0755 or 0777 ? is have changed httpdocs to d rwx rwx -wx Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996284 Share on other sites More sharing options...
salathe Posted January 17, 2010 Share Posted January 17, 2010 If you want to find out which OS the script is running on, examine the PHP_OS constant or call php_uname. Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996286 Share on other sites More sharing options...
otuatail Posted January 17, 2010 Author Share Posted January 17, 2010 returns Linux ns.rockhost5.co.uk 2.6.18-164.9.1.el5 #1 SMP Wed Dec 9 03:27:37 EST 2009 x86_64 I know what you are going to say next but fopen() is not working on the new website The file permissions haver been set to: httpdocs = drwxrwxrwx which is probably the same as your 1777 the one being I am a directory as aposed to 0 I am a file. Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996289 Share on other sites More sharing options...
MadTechie Posted January 17, 2010 Share Posted January 17, 2010 Again, but fopen() is not working Whats the error ? Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996304 Share on other sites More sharing options...
salathe Posted January 17, 2010 Share Posted January 17, 2010 What permissions are on the file (desmond.txt) and the directory containing it (if that's not just httpdocs) and to which user and group do they belong? Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-996305 Share on other sites More sharing options...
otuatail Posted January 18, 2010 Author Share Posted January 18, 2010 there are no file permissions on desmond.txt this file is never created. I have all permissions set for the main folder httpdocs. $fp = fopen('desmond.txt', 'a'); // create file if not exsist. this is not even created. Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-997352 Share on other sites More sharing options...
MadTechie Posted January 18, 2010 Share Posted January 18, 2010 if PHP fails to do something it will report and error assuming error reporting is on. try error_reporting(E_ALL); ini_set('error_reporting', E_ALL); $fp = fopen('desmond.txt', 'a'); fwrite($fp, 'Top o the morning to ya'); fclose($fp); echo ("Hi Guys"); Whats the error ? Quote Link to comment https://forums.phpfreaks.com/topic/188728-to-be-or-not-to-be-unix/#findComment-997370 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.