This is the context: I've got to write a source for an intranet site which allows users to import a csv file into MySql database.
This import is very massive that's why I wrote a c# program.
This program creates some thread which reads some lines of my csv file.
These thread control, change type and insert my data into MySql database with sql like this:
insert into table1 (fields) values (dataline 1 ), (data line 25),...,(data line n);
This request exists for 9 tables.
This program can be used by everyone because the source code is dynamic : example to insert data I write a dictionary which contain my 9 tables with all fields, types and the CSV header of the import file (which contains some accent and symbol, I've to change it because I can't put them into fieldname in my database).
This dictionary can be create only with a file called MAP.csv
Example:
table / field / type / header
table 1 / field1_table1 /string / hêàder
table 1 / field2_table1/ int / header1
table 2 / field1_table2/ date / hêàder2
table 1 / field3_table1/ string / hêàder3
My c# program works very well when I execute the program.exe
But when I call it with php with exec("programpath.exe parameter1 parameter2",return,otherreturn)
function this program can't work.
In fact when I try to access to externfile like config.xml , MAP.csv, otherfile.txt/csv/.. with my c# program. The execution stop and there is a windows error which says "program.exe stop its work" ( program.exe à cessé de fonctionner
in French).
So I try to write my problem simply: when I try to access into a file with my c# program called by php, there is a window problem which stop the traitment.
EDIT : I found the solution, i just have to do a cd c:/path_program/ In fact when I start my website the current folder is not c:/ but the folder in wich symfony starts... Was just a beginner error. Thanks everybody for your help ! cia