0

I've uploaded some php scripts to my server under /php directory and sub directories.

When using my root user in terminal and running php file.php it execute it perfectly, but when trying to reach the same file through the browser - nothing happens...

I guess it something to do with permissions.

I've tried chmod 755 phpdirectory but it doesn't work..

what else should i do in order to give the browser user the ability to run php scripts ?

Update I'm using FreeBsd system with apache and Direct Admin on it. Can some one please guide me to where to check the settings ?

8
  • 2
    If you're using the apache server, then it will run under the user the apache server uses. If you run it yourself, then it will run under your user. Commented Oct 6, 2013 at 9:00
  • see this:: stackoverflow.com/questions/15341713/… Commented Oct 6, 2013 at 9:04
  • There is no such thing as "nothing happens". You should get at least an error code or a timeout. Commented Oct 6, 2013 at 9:04
  • @Sumurai8 no i get just a blank screen Commented Oct 6, 2013 at 9:16
  • 1
    @AsafNevo Even that is not "nothing happens". Open the developer console and look under the network tab, then reload the page. It will tell you the status code and the exact response you get. Commented Oct 6, 2013 at 9:23

3 Answers 3

0

Usualy All webb access to a file is done through a specific user (eg. www-data) in order for the file to be reachable through web www-data needs permission to reach the code. How you setup that depends on what system the server is running.

Also the server document_root needs to be setup correctly. Where you do this also depends on what server you are runnning.

EDIT after update question.

In apache this is normally done through the file /etc/apache/sites-avalible/your_site If the server only serves one page you can do this in http.conf

Sign up to request clarification or add additional context in comments.

1 Comment

my point was that it's not the same user, but i'll add the input.
0

Check whether the User directive inside httpd.conf file is same as the user you used to ran the PHP script.

Comments

0

You need to make sure your PHP scripts have same user and group as you configured in Apache configuration(/etc/httpd/httpd.conf in CentOS 6.4).

# User/Group: The name (or #number) of the user/group to run httpd as.
User apache
Group apache

Check the owner and group of your PHP directory and files. In this case owner and group (root/root) are not same as Apache User and Group.

# ls -alh
total 516K
drwxr-xr-x.  5 root root 4.0K Aug 29 17:57 .
drwx------.  5 root root 4.0K Jun 24 12:06 ..
-rwxr--r--.  1 root root 356K Jul  7  2012 index.php

To change the owner and group of your PHP directory. Use the following command.

# chown -R apache:apache www

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.