My problem is that when I send my php file as root to the htdocs directory it appears as this.

root mustafa # sudo cp programa.php /opt/lampp/htdocs/archivos

The php file appears with a big X on top, and when I try to execute it from XAMPP it says:

Warning: Unknown: failed to open stream: Permiso denegado in Unknown on line 0

Fatal error: Unknown: Failed opening required '/opt/lampp/htdocs/Examen/registro.php' (include_path='.:/opt/lampp/lib/php') in Unknown on line 0

1 Answer 1


I bet that it is the issue with permissions. Since you are using sudo to copy, i will assume that it is your home directory that you are copying it from and you've created the file with your user.

There are several ways to resolve this, the quickest would be to make the file world readable. You can do that by running

chmod a+r progma.php

A better way would be to find out what group does the server run under, often that would be group 'web', and then you would do:

chgrp web progma.php && chmod g+r progma.php
  • your answer is fantasti, I already solve the problem. I just type chmod 755 programa.php from the htdocs directory and it works!! but.. thanks!! a lot anyway :) I dont understand that chmod a+r and chmod g+r and chgrp web, could you share to me a tutorial or something??
    – musta
    Dec 4, 2013 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.