Get file out of www directory with php

I am working on a control panel for a game server and hence keeping config files in the www directory is the worst thing I could probably do.

I need to access a file called latest.tx in /srv/

So, how do I do it?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Try reading <code>/srv/latest.tx</code>, e.g. <code>file_get_contents(‘/srv/latest.tx’);</code>Assuming the user apache is running as (most likely www-data) has access to read the file, it should work.

to answer to this question requires more details. <br>Do you have Su-Exec ? Does PHP run under mod_php or PHP-FPM? <br>also what chroot uses (if it uses) Apache as well as PHP. <br> <br> <br>BTW: <br>and please do not post again as an answer to “” if you do not understand what I’m talking about.