Hello,
I have windows and apache server installed in my computer. I want to execute command line code with php.
for instance, if I type this code in command line window shp2qgsql buildings.shp > bui.sql
it will convert shape file to sql table in certain file directory.Now I want to develope an application that do it automatically. It means I want to execute this code in php so whenever my webpage run it, it will generate a sql table. I found a exec() might be right function. My code look like this:
<?php
$result ="shp2pgsql buildings.shp > bui.sql";
exec('/usr/bin/top -b -n1, $result');
?>
but I didn´t get the sql table in the directory. Can anyone help me?
Many Thanks
write command line code in php
Moderator: General Moderators
Re: write command line code in php
I'm not sure exactly how exec() behaves in a Windows environment, but that code won't ever do what you want since you're calling top, which doesn't exist in Windows. Maybe try exec($result)?