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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like