Hello everyone,

I'm running my little web server as a hobby project: http://neo.dyn-o-saur.com. Almost all coding is done my myself and right now I'm working on an admin panel to streamline some tasks.

What I want is to:
1) upload a file,
2) run a shell script on the file,
3) and then import the data in the file into a mysql database.

If I ssh into my server and run the scripts from a command line everything works fine. With my own webinterface 1) and 3) work, but 2) not. The snippet in script reads as follows:

<?php
$wswin2mysql=system('./convertWSwin.sed upload/data.txt > upload/data2.txt');
$data2data=system('mv upload/data2.txt upload/data.txt');
echo "Data is converted";
?>

Nothing happens when I run this. I checked the permissions of the uploaded file and they are 644 with owner www-data. I also used exec() instead of system(), but to no avail. I also played around with different quotes, and other scripts, but still no dice. Simple things like system('ls') do work, but why not my own inventions? Uptill now I've solved all of my problems with web searches, but this one has kept me busy for 6 days already. Can an expert give some hints? Thank you.

Hans

Recommended Answers

All 3 Replies

Thats right. You must allow it in your php.ini file. If you don't have access to this file you can try function ini_set().

or you can create a ruleset whit .htaccess file inside the directory of your app. In any server whit apache 2 is usefull

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.