Jump to content

Chmod function is not working in php code


kkrishieee143

Recommended Posts

HI Friends,

 

Goal:

My website has forms and when the user fills and submits the form with the data.Then the data collected from the forms are getting saved in a new file "data.html". This file is created dynamically on fly and then we are creating a pdf file (html - > pdf) and this pdf generated will be attached to an email which will be sent to administrator or owner of the website.

 

Problem:

We are able to create the "data.html" and for generating the pdf file we need to retrieve the data from the "data.html". For this "data.html" need the 777 permissions.

For assigning the permissions, we are using chmod function.

Problem is that the chmod function is not working.

Is there any other alternative to tackle this issue.

 

 

(Note: Chmod function is working in shared hosted server but not working in dedicated hosted servers. Tried in many servers.)

 

 

Thanks,

Saikrishna.

  • 2 months later...

you can use php to send a chmod over SSH.

 

ex:

<?php 

    $chmod = shell_exec('chmod 755 public_html/folder/file.html');

    //if it works
    if($chmod){
         //Do something...
    } 
    //if it doesn't work
    else{
        //Do something else...
    }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.