Jump to content

Recommended Posts

Is there a way to protect PHP source code from being viewed?

 

I was playing with HTML and PHP, and from what I can see, if you simiply link to a PHP file (without any parameters) and if someone right-clicks on the link and says "Download Target" or "Save Link As" from a browser, they can sometimes download the PHP file with source and all.

 

How can I either prevent this from being done or protect the source code of my PHP files?  I'm not so concerned about PHP files with SQL queries in them, but more about PHP files with information regarding accessing a database (username, password, host information, etc).

 

 

Link to comment
https://forums.phpfreaks.com/topic/183936-protect-php-source-code/
Share on other sites

When you download a page via "save link as" you get the raw HTML that was created from the PHP, not the PHP source itself. If people could just download the page and get the PHP, people could just steal the code of sites like Facebook

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.