How to reliably determine paths of active apache .conf files from within php

Joined
Jun 15, 2022
Messages
101
Reaction score
0
I'm building a system for my business (Cinder - web design). It's (so far) written in php and goes as deep as the web server (currently apache in dev), which effectively means determining virtual hosts.

I've tried
Code:
apache2ctl -S
, which **does** give me the information I want (the paths to active .conf files in /etc/apache2/sites-available), so I just need a way to extract the paths from the output.

Basically I need to know where the source for apache2ctl is located, so I can match the format.


Thanks in advance
 
Joined
Jan 30, 2023
Messages
107
Reaction score
13
The source code for apache2ctl is part of the Apache HTTP Server project, which you can find on the Apache website at https://httpd.apache.org/. To extract the paths from the apache2ctl -S output, you can use a tool like grep or awk to filter the output and extract the relevant information. For example, you can use the following command to extract the paths:

Code:
apache2ctl -S | grep '^ *[^ ]' | awk '{print $NF}'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top