Monthly Archives: August 2006

Disabling the PHPSESSID in the Query String

If you’ve worked with PHP sessions, probably your URL looked something like this:

http://www.yourdomain.com/page.php?PHPSESSID=59aa95ad46cd67d82ba0f812407326dd

If you don’t like the PHPSSID being displayed in the query string, you might have wondered how to disable it.

Well, a way to disable it is by setting session.use_trans_sid to off in your php.ini. However, if you don’t have access to the php.ini file because you’re hosting your site on a shared server, then, you can accomplish this by using a .htaccess file*.

The following example worked for me:

<IfModule mod_php4.c>
     php_flag session.use_trans_sid off
</IfModule>

That’s it! I hope this helps.
––––

*Make sure your hosting provider allows .htaccess files.

/usr/bin/wget: Permission denied

If you’ve ever got the error /bin/sh: /usr/bin/wget: Permission denied when trying to execute a .php script using a cron job, spent minutes/hours trying to find a solution to this, well, I hope this post will help you to save some time.

It’s possible that your hosting provider, for security reasons, is not allowing you to execute the wget command. If you want to use the wget (or GET) command, you can do two things:

a) send an email to your hosting provider’s support department. Or

b) you can try using the following command:

php -q /path/to/script.php

The above example worked for me nicely. However, if it still doesn’t work for you, then contact your hosting provider; maybe there are other things that they need to take care of (or fix) first before you can work with cron jobs.

Cheers!