Jump to content

Packing a DEB using PHP5


mofolo

Recommended Posts

Hey Forum!

 

I need some help with my project.

 

I wish to create .deb files using PHP, but I can't seem to get it to work:

 

This is what I'm doing:

echo system("dpkg-deb --help",$c); 
echo $c;

 

Line 1 does not return anything,

and line 2 ($c) outputs "127";

 

Any Suggestions?

 

Thanks.

 

P.S: This is a good looking forum layout. Me likey!

Link to comment
https://forums.phpfreaks.com/topic/187028-packing-a-deb-using-php5/
Share on other sites

  • 2 weeks later...

The reason that why you're not getting any message displayed it's because you need to redirect where

the message will be outputted, by the default they're outputted to the Terminal.

 

Simply do something like this :

 

<?php

$command = "yum -y install squid";  //this is a testing command, it will install squid in the server.

exec($command);

?>

 

Replace the value for the correct one, and i can assure it'll work.

The reason that why you're not getting any message displayed it's because you need to redirect where

the message will be outputted, by the default they're outputted to the Terminal.

 

No. By default most Linux commands send there output to stdout, and this is exactly what system() returns.

To elaborate on Thorpe's answer, you apparently are getting the return value from your dpkg-deb command.  To capture the actual output of the command:

 

$output = `dpkg-deb --help`;
echo $output;

 

Note that these have to be backtics around the command, exactly as shown.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.