Jump to content

Slow Scripts!


Recommended Posts

I have got IIS running on my laptop with PHP and MySQL so that I can test my scripts locally.

 

I am currently working on a small project and I am half way through coding quite a hefty page but it is running really slowly.  It can take around 20 seconds to load and I have still got quite a bit of coding to do on this same script.

 

Just wondering if there is anything I can do to speed up the PHP on my server before I look at an alternative coding approach to get it running faster?

Link to comment
Share on other sites

  • 2 months later...

Dude, in these scripts, do you use the database?

 

There can be also two things you can do with your scripts to make them faster, and that could be the problem also.

 

Always when you have a condition, and that condition ends the page, try the exit() function or exit(0) (http://br.php.net/manual/en/function.exit.php).

When you do that, the script just stops. It saves a lot of work to the server, 'cause it will still read all the code, even if it doesn't have to.

 

And another function you can try is mysql_close() (http://br.php.net/manual/en/function.mysql-close.php).

That's really useful, 'cause if you connect to the DB during scripting, and you finish the script, the DB connection will be still running!

 

Then if you finished using the connection to the base, close it.

 

The problem can also be these two things.

Link to comment
Share on other sites

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.