heavyJ Posted December 6, 2009 Share Posted December 6, 2009 Alright guys, so in the project I'm working on, we have a number of C++ programs that do read/write to some data files that we created, and I need to call these from a PHP page. Now, I can read and write to the files just fine through PHP, but when I call exec("cpp_program") , the C++ program cannot access the file at all. It runs and prints, but it cannot open a filestream. I believe the permissions on the files that are being read/written are set correctly, so I 'm not sure what's wrong. It's a little urgent, so any help would be very much appreciated. Link to comment https://forums.phpfreaks.com/topic/184151-php-exec-file-write-problem/ Share on other sites More sharing options...
heavyJ Posted December 6, 2009 Author Share Posted December 6, 2009 Well, it turns out that it was a stupid mistake. The C++ executable and the data files were in one directory and I called them in PHP with exec('bin/cpp_progam'), assuming that the C++ program would look in bin for the data files. Instead, it was looking in the current directory above bin, and couldn't find anything. So I did a chdir() and it worked fine. Thanks anyways everyone. Link to comment https://forums.phpfreaks.com/topic/184151-php-exec-file-write-problem/#findComment-972249 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.