LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to start/stop Squid service using PHP? (https://www.linuxquestions.org/questions/programming-9/how-to-start-stop-squid-service-using-php-763466/)

adnankhawer 10-21-2009 11:18 AM

how to start/stop Squid service using PHP?
 
Hi everyone,

Im using PHP and Sun Solaris to do something for Squid Proxy Server. im using......

- LAMP / SAMP
- Linux / Solaris 10
- Squid Server
- PHP

actually i need to know that someone knows about how to start/stop Squid Service using PHP code.


Regards.

Adnan Khawer.

jhcaiced 10-21-2009 02:49 PM

Hi, my first idea would be:

- Write an script to start/stop the squid service (probably you alread have one)
- Configure sudo to allow the httpd or apache user to execute your script
without asking for passwd.
- Create a php script, which uses system() or exec() to execute the start/stop squid
script.
- Make sure your php page is secure and only can be executed from a few places.

Why are you trying to start/stop your squid server from php ? is there any special
need for that ?

Best regards,

adnankhawer 10-22-2009 10:47 AM

Dear jhcaiced,

Thanks for ur response, actually im creating GUI for Squid configuration using PHP and my 1st version is to start/stop Squid using basic configuration on LOCAL HOST........

Script is OK bt what if i use exec() or system() directly e.g. system('service squid start', ......)

i have not tried bt i will try it...

in fact i have not used PHP for this type of programming i.e. other than Web/Database.

Regards.

Adnan Khawer.


All times are GMT -5. The time now is 12:45 PM.