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! While you're at it, check out some resources Treehouse students have shared here.
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 trialLuis Mesejo
12,212 PointsDoes the php code ever get to the client? OR only the processed html result after the server reads the php file?
Hi,
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 ?
5 Answers
Erik McClintock
45,783 PointsLuis,
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.
Erik
Luke Armstrong
1,663 PointsLuis,
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!
- Luke
Matthew Proudman
11,879 Pointsalso in some cases where the syntax is wrong, the server may thinksomething is HTML when it is not an extra tag symbol ('>') is an exsample of this.
Luis Mesejo
12,212 PointsThank you Erik!
Matthew Proudman
11,879 Pointsalso in some cases where the syntax is wrong, the server may thinksomething is HTML when it is not an extra tag symbol ('>') is an exsample of this.