LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-21-2009, 11:18 AM   #1
adnankhawer
LQ Newbie
 
Registered: Mar 2008
Location: Pakistan
Distribution: Red Hat, Kubuntu, Suse
Posts: 13

Rep: Reputation: 0
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.
 
Old 10-21-2009, 02:49 PM   #2
jhcaiced
Member
 
Registered: Mar 2009
Distribution: CentOS - Ubuntu - Debian
Posts: 83

Rep: Reputation: 27
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,
 
Old 10-22-2009, 10:47 AM   #3
adnankhawer
LQ Newbie
 
Registered: Mar 2008
Location: Pakistan
Distribution: Red Hat, Kubuntu, Suse
Posts: 13

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not use exec of php function to start/stop service nui Linux - Enterprise 3 04-25-2009 10:43 AM
installing squid : service squid start --> error jonaskellens Linux - Software 2 09-05-2008 03:06 AM
start/stop service on the fly zchoyt Linux - Software 3 04-14-2005 03:30 AM
service squid.init stop says [failed] Niceman2005 Linux - Software 2 11-16-2004 06:20 PM
squid service fails to stop farhan Linux - Networking 1 03-09-2003 08:12 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration