0

Possible Duplicate:
What is the best PHP code encryptor?
Encrypt php code

How do I encrypt my PHP pages so that no-one can read the contents of the source file. It has details like mysql user and passwords in it. Also it would be so that people can't copy it and start a website just like my one, with no development of their own.

Community
  • 1
  • 1
Amar H-V
  • 1,316
  • 3
  • 20
  • 33

4 Answers4

2

The PHP code does not need to be visible to the public in order for it to execute. Configure the webserver so it does not allow downloading of the raw PHP code.

wallyk
  • 56,922
  • 16
  • 83
  • 148
2

If your server is configured properly, it is virtually impossible for someone to view code. Once a user requests the php file, it is executed on your server and the response text is sent.

If you are able to see the source with a web browser, that means your server isn't configured correctly.

Blender
  • 289,723
  • 53
  • 439
  • 496
  • Well, I believe there's no such thing like you can configure your server properly. Someday, your computer will have security issue and someone can get in and retrieve the source code. I believe that's the reason why people want to know how to encrypt PHP source code. Also, simpler way, when someone stole the hardware physically, there's not enough protection can be done by server configuration. – Daniel Baktiar Jul 20 '16 at 12:25
  • @DanielBaktiar: When was the last time you heard of someone breaking into a datacenter and physically stealing a server off of a rack? – Blender Jul 20 '16 at 15:54
  • One of my ex-colleague had a unique story, the server got stolen while they are performing test. It was a couple years back. This is a physical U rack servers. – Daniel Baktiar Jul 23 '16 at 01:07
  • Another thing in mind, to give you perspective, server doesn't always mean a rack server. If you have your PHP installed in laptop on XAMPP for for demo on your boss' laptop. Your boss laptop get stolen (which is more common case than above U rack server get stolen, though had happened before), the source code will be out in the black market? – Daniel Baktiar Jul 23 '16 at 01:10
  • @DanielBaktiar: Encrypt your filesystem. You shouldn't be writing your code with the assumption that it will eventually be stolen. – Blender Jul 23 '16 at 03:08
0

As long as PHP is configured on the server, then your code should be fairly safe from view.

frustratedtech
  • 423
  • 4
  • 9
0

PHP is interpreted by your web server. You're php creates your html code which is visible to your viewers. Your php code is only visible if someone has access to your web server.

Jordonias
  • 5,778
  • 2
  • 21
  • 32