Execute Permission Problem with Php File

Execute Permission Problem with Php File

When I create a php file it have not permission execute so I can't run php file.

I need to set permissions of that file. I want that all created php files have execute permission.

new creation file type is

-rw-rw-r--  1 sohel sohel     0 Apr 11 15:43 test.php
3

1 Answer

You don't need to add execution permission on php files, install php5-cli:

sudo apt-get install php5-cli

And now to run your php file, just type:

php test.php

Alternatively to really make it executable, add the php shebang:

#!/usr/bin/php -q
<?php 
Print "Hello, World!";
?>

And add the execution permission on your file:

chmod +x ./test.php
2

Your Answer

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

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.