Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Luis Mesejo12,212 Points
Does the php code ever get to the client? OR only the processed html result after the server reads the php file?
As Paulk said in the video, "We wanna send it to the server, interpret it with the PHP interpreter on the server" but is the php code ever actually sent to the client ?
Erik McClintock45,783 Points
PHP runs totally behind the scenes on the server; it does not interact with the client. The server will interpret the PHP and then send back the appropriate client-side information to display in your browser.
On a normal basis the client will never see the php coding. However, there are some exceptions. In order for a server to run php scripts, it must have the php 5.x package installed and running. Not all web hosts provide php support, and so if someone were to upload php onto one of those hosts, it would not run. Instead, the php code would be sent to the client as normal text in the html.
The only other time that a client can see php scripts is if the server is broken and the php package stops running.
Ideally, the client will never see the php code, but if you plan to use php then make sure the web server has the latest package installed.
For anyone reading, hope that helps!