semkius semkius - 5 months ago 54
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?


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