semkius semkius - 1 year ago 115
Bash Question

Run BASH script from .PHP file

Bash file:

mkdir /var/www/html/bash

PHP file:


After I enter
directory Is not created. I tried
command no results as well. What I'm doing wrong?

Answer Source

It's likely failing because Apache does not have write permissions within your ./var/www/html directory. To give Apache the necessary permissions, try this...

First find the user for Apache sudo ps aux |grep apache or sudo ps aux |grep httpd

On my server I get www-data So, to allow it to create directories, I chmod the parent folder 775, sudo chmod 775 /var/www/html

Then, change the group owner to the user that runs apache (www-data in my case)

sudo chgrp www-data /var/www/html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download