Question:
PHP parsing is slow when I have a large MySQL database, but HTML parsing is fast. Why is this?
riflespinner2000
2008-10-18 17:41:33 UTC
This issue has nothing to do with queries in the php page. I have two identical files with different names. Test.php and Test.html There are no SQL queries, they are both html only files. Test.html takes about 0.5 seconds to load, but test.php takes about 2 seconds to load. This problem only occurs when I have a large MySQL database (500 megabytes). When I have a small MySQL database they both load at the same speed.

What can I do to fix the problem? How can I speed up php parsing? PHP parsing is slow even when there is no php to parse.
Three answers:
makg
2008-10-19 17:30:07 UTC
How do the files interact with the database? You say there are no SQL queries, but there must be some interaction with the database in order for there to be any difference depending on the size of the database. Do you connect to the database? If not, then there's no way the database size is playing a role. If you do, then my first guess would be that the html file doesn't actually connect to the database, but fails (and doesn't return an error message) or doesn't execute the code at all (I'm not aware of any way, in straight html, to connect to a database, and it doesn't seem possible, but I've been wrong before....). So I'm guessing that the html file uses PHP to connect to the database, and that the straight html file isn't actually executing that PHP piece -- that the speed issue has to do with actually making the connection versus not.
anonymous
2016-10-07 02:19:39 UTC
you are able to no longer - you are able to write the back documents to a document, then execute that document. (very own homestead page is a server-area interpreted language, and additionally you, the person, are working HTML on the customer. you are able to desire to apply Ajax, if it extremely is ideal for the activity, to replace the browser. yet why keep it in a database? merely keep it as a very own homestead page document.)
anonymous
2008-10-18 17:47:51 UTC
php needs to be interpreted by the browser



html interpretation is already built into the browser


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...