1

I'm trying to do a small php project using openserver. I'm new to web development and am having some trouble. All of my files are located in the test.ru folder

D:\OpenServ\OpenServer\domains\test.ru\Log.php is the main file I'm launching.

<?php
   chmod (  "D:\OpenServ\OpenServer\domains\test.ru" , 0777 );
     if(include 'Lang.en' == 'OK');
        echo 'OK';
 ?>

I receive the following error. Warning: include(D:\OpenServ\OpenServer\domains\test.ru) [function.include]: failed to open stream: Permission denied in D:\OpenServ\OpenServer\domains\test.ru\Log.php on line 61

How do I solve this? I've tried setting the access to public via local controls(right click menu) and launching openserver with admin rights. but it was of no use.

Please advise.

Greenmachine
  • 292
  • 1
  • 15
  • 1
    The problem is the include... not sure what you're trying to do with `include 'Lang.en'`. – Digital Chris Dec 02 '15 at 21:43
  • 1
    Maybe tell us what it is you're trying to accomplish. Why would a log script chmod a different file? Why are you attempting to include a file called 'Lang.en' (if that' is what you're doing). – Digital Chris Dec 02 '15 at 21:56
  • Thank you. I forgot to specify the file format. It's been a busy day and I've been working on my php project in late hours. I'm sorry for the unnecessary post and I've upvoted everyone who answered. I've added .php5 to the file name and it's alright. Thank you. – Greenmachine Dec 02 '15 at 21:57

2 Answers2

1

You can remove ; to end :

 if(include 'Lang.en' == 'OK');

Reviewer the permission the directories D:\OpenServ\OpenServer\domains\.

See the note on the chmod() manual

And reviewer what's owner that your localserver web are permit.

1
if ((include 'Lang.en') == 'OK'){
echo 'OK';
}
  • What? The only way the return value of an include is going to be `'OK'` is if the include is actually a php file (where is the extension) and it's crafted to have that return value. – Digital Chris Dec 02 '15 at 21:52