Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.