1

Is there a way to get current Apache settings from a PHP script? All happens on the same server.

I have tried running apache2ctl -DDUMP_CONFIG | grep LimitRequestLine from within PHP. It kind of works but also wants to start Apache, bind it to a port. It sometimes fails very slowly. Also, it requires enabling the mod_info module.

Background: The JS library DataTables sends very long URLs as GET requests. They are longer than the default for LimitRequestLine. Setting LimitRequestLine to a large enough value fixes this. I'd like to provide an install verification checklist that warns about potential issues after installing our PHP application.

1
1

You shouldn't be allowing PHP to access the Apache config settings. What you can do, is have a PHP test script that will try your largest possible url length from your application. Wrap that in a try/catch and report back if it errors out, instructing how to increase this limit. This way it will work with other webservers, such as NGINX if that gets introduced into the mix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.