2

I have using shared hosting Go-daddy server I'm unable to run this command line on server

Warning: system() [function.system]: Unable to fork [ls -lart]

give me idea to run the script.

Thanks in advance.

Rutunj sheladiya
  • 629
  • 7
  • 21
  • possible duplicate of http://stackoverflow.com/questions/20648949/php-warning-exec-unable-to-fork – Avinash Babu Nov 29 '14 at 05:29
  • i am working on shared hosting server so that is not working on my server i also tried echo system("ulimit -a"); accepted answer but not working on server – Rutunj sheladiya Nov 29 '14 at 05:31

1 Answers1

2

shared hosting systems disable some commands for security reasons , you need to work around that , use native php for what you want to do, open the directory and read its content using php itself.

system and exec are usually completely disabled or partially limited.

if you are interested here is a simple code to get directory content :

if (is_dir($base) && is_readable($base)) {

    if ($handle = opendir($base)) {
        $base .= '/';
        while (false !== ($entry = readdir($handle))) {
            //$entry is a file or directory including `.` and `..`
        }
        closedir($handle);
    }

}
Exlord
  • 5,009
  • 4
  • 31
  • 51
  • I'm working on to merging PDF files so you have any idea about this – Rutunj sheladiya Nov 29 '14 at 05:42
  • 1
    that is a hole new question, get the list of pdf files with the code i have provided and then do what ever you want with them. pdfmerger for php https://pdfmerger.codeplex.com/ or one of these : http://stackoverflow.com/questions/4794435/merge-pdf-files-with-php http://stackoverflow.com/questions/22404601/merging-pdf-files-with-php-fpdi – Exlord Nov 29 '14 at 06:13