Sopheakdey Moeun
Sopheakdey Moeun

Reputation: 121

PHP Apache Config on linux

I'm using Apache 2 in Linux mint and I don't know where to store my files and projects. if I store it in var/www it is not accessible for me, I have to use command as super user. Are there any way to solve my problem? - If I want to store in my home folder, what should I type in the address bar if I want to run my file? - Are there any other good solution than these? (such as change the accessible to folder /var, or change the Root_Url of apache ...)

Upvotes: 0

Views: 3652

Answers (6)

Satyam Singh
Satyam Singh

Reputation: 1140

The easiest way to solve this provlem is by typing the following line in terminal:

sudo chmod -R 777 /var/www

and then enter your password. And now you are done. You can store all the PHP files in /var/www

Upvotes: 4

Dave
Dave

Reputation: 1

One way to accomplish this is to edit the default virtualhost supplied with Apache 2. In Linux Mint 14 its configuration file is located at:

/etc/apache2/sites-enabled/

This directory should hold symlinks for all active sites, for me the default is named 000-default.

Change the lines with "DocumentRoot" and "Directory" to point wherever you like. The server should have read only privileges by default. If you are working on file manipulation then it will need permission to read and write files.

Once this is set, restart the server ("sudo service apache2 restart") and type localhost in your browser to access the directory you've set above.

For more advanced configs have a look at:

http://community.linuxmint.com/tutorial/view/853

http://community.linuxmint.com/tutorial/view/527

Upvotes: 0

Code-Source
Code-Source

Reputation: 2245

Everything depends on the use.

If you are looking for a configuration for a development server that is accessible only from limited host (such as localhost):

  1. You can configure Apache (/etc/apache2/apache2.conf) to run with your user/group.

User myuser

Group mygroup

  1. Store all your project in your user_dir (/home/myuser/projects/...)

  2. Create a virtual host for any of your projects

All files generated by your server will be accessible to you and vice versa

Upvotes: 0

phpalix
phpalix

Reputation: 689

You need to active the user_dir mod of apache and then run the content from your home folder.

To run a file in your hole directory you should go to localhost/~youruser/script.php of course after enabling user_dir

Upvotes: 0

krampstudio
krampstudio

Reputation: 3611

There is different solutions:

in both cases your project must have gives permissions to the apache user (www-data?) to read/execute you project

Upvotes: 0

Filippo Savi
Filippo Savi

Reputation: 397

You have to do a chmod, you can have more information in your terminal with comand man chmod to set the rights to write in that folder or else point the web-server elsewhere (the setting is in the https.conf file)

Upvotes: 0

Related Questions