PHP Files Security in webserver

I done a a project in PHP and MySQL.

I would like to upload that into the webserver. but how to secure those files to direct download or see the source code of those php files.

how to secure my php files?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PHP is a server-side language, which means that it is parsed by the server, and only the output of the script is sent to the browser, so it is impossible for people to see the source. For a bunch of good security tips, take a look at this article:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You need to make sure that Apache runs the .php before outputting the result. If you don't have php set up properly on the server, then Apache will show the contents of the .php files, rather than running them.

If you have .php files which contain passwords etc, it's advisable to make them 'include' which php accesses indirectly, then prevent Apache for ever serving them, by adding a .htaccess file and denying access to those files over HTTP.

Hope that helps
Good point about the passwords -- one other option is to put the passwords in includes outside of your web directory alltogether, which doesn't involve setting up an .htaccess file
Yes, the latter is preferable but not always an option given by ISPs
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.