php running perl command

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pharrell84
Forum Newbie
Posts: 1
Joined: Mon Jul 25, 2005 2:53 pm

php running perl command

Post by pharrell84 »

Hello,

I am currently working on a php page which allows users to add/delete/view extensions from a PBX (Asterisk) by changing the .conf files. The process for adding one involves adding values to a mysql database in the php code, then running a .PL file with perl to look at the database, and create the appropriate code in the .conf files for Asterisk to read...

Well I have written the code and the database is loading up fine, and I can even type the command "perl -T ~/Desktop/.../retrieve_sip_conf_from_mysql.pl" manually and it churns out the .conf files just perfectly. The problem comes in when I want the php page to run this PL file at the end of an added extension. I have tried a few functions and currently have it as

Code: Select all

system(&quote;perl -T ~/Desktop/.../retrieve_sip_conf_from_mysql.pl&quote;);
but none (including this one) seems to work, the conf files are not created. I have a feeling it may be related to permissions somewhere? I have made them as flexible as possible on perl and all conf files involved but still nothing.

Is there perhaps another command to use when running perl in this manner?

Thanks for any help.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You need to consider the rights of the user running the script. It may work fine when running it as your user, but what can the 'apache' user do?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply