Increase php timeouts with .htaccess

If you are running mod_php you may experience problems with big uploads and imports (or other long running processes).

You can adjust php’s default timeouts using a .htaccess file.

Create a file called .htaccess and put the code:

# increase php time-out limits
php_value max_execution_time 1000
php_value max_input_time 1000

inside it. Put the .htaccess file into the top-most directory of your site. If you already have a .htaccess
file, add the code above to the end of it.

This should solve you problem in most cases.

If it does not, try to increase the times (1000). If the problem persists, open a support ticket and include the URL, click path and any needed usernames and passwords. We will duplicate the problem and attempt to adjust your php execution times to make your script work.

Note: if you are running php as a cgi, you’ll need to adjust your /etc/php.ini file. Adding directives to .htaccess files has no effect on installs using php-cgi.

Running a different php version for only part of my website

Update: for newer accounts use :

php-script

instead of

custom-php

You can also set the php version on a per-directory basis (for testing, development, etc.). To run a different php version on part of your site, perform the following.

Create a .htaccess file :

.htaccess

(the leading dot is required)

inside the top level directory for which you want to change the php version.

Inside the file put the lines:

AddHandler custom-php .php .pcgi .phtml .inc .phtml~ .php~ .inc~ .html~
Action custom-php /cgi-sys/php5.6

some users may need the following instead:

Action php-script /cgi-sys/php7
AddHandler php-script .php .maml .html .css .mss .pcgi .phtml .inc .phtml~ .php~ .inc~ .html~

Replace php5.6 with which ever version you want to run
You can also add other file extensions to the list in the first line.

Depending upon the server and current php verison, you can choose from among:

/cgi-sys/php8.1
/cgi-sys/php7
/cgi-sys/php7.4
/cgi-sys/php5.6

etc.

In general, many php<major-version>.<minor-version> will work. The possible versions may vary. Contact support if a version you need is missing.

Historical Notes:

The following no longer is allowed. This is kept for historical reference:

To run a part of your site as mod_php, add this line to a .htaccess in the directory you want to run as mod_php :


AddHandler application/x-httpd-php .php3 .phtml .php .php4 .php~ .php3~ .php4~ .phtml~ .inc .inc~

sftp gives the error “Received message too long”

Question:

sftp gives the error “Received message too long”

Answer:

Check your .bashrc file. You likely have something in your .bashrc that is sending output and killing sftp. Most items that send output belong in .bash_profile.

The primary difference between .bashrc and .bash_profile is that .bashrc is used for non-interactive logins (sftp, etc.) and .bash_profile is used for interactive logins.

Keep your .bashrc free of anything that would send output.

Does my account support wildcard SSL certs / certificates?

Question:

Does my account support wildcard SSL certs / certificates?

Answer:

Wildcard certs work fine. Keep in mind however that wildcard certs only work for 1st level subdomains like:

*.my_domain.com

not

*.subdomain.my_domain.com

Not important for most uses but something to note. Contact support to order your certificate or to have your existing certificate installed.

Weird error message: “Suddenly the Dungeon collapses!! – You die”

Question:

I was ssh’d into the server when I saw the message:

Suddenly the Dungeon collapses!! – You die…

What happened? Did someone hack my account?

Answer:

No. This is the message that the screen program gives if you kill your own instance of screen (or if it otherwise crashes).

All is well and the server is fine.

.htaccess versus php.ini for php options

Question:

What is the difference between php.ini and .htaccess for php options? When should I use php.ini and when should I use .htaccess?

Answer:

You should use .htaccess only when you are running php via mod_php. This is a setting in your control panel “php” section.

php options inside .htaccess files have no effect when running as a cgi.

You can change your php versions from cgi to mod_php inside your control panel in the php section.

When php is run as mod_php, php is built into the webserver and the webserver can understand the php directives inside .htaccess

When php is running as a cgi, the webserver does not understand the php directives inside a .htaccess file. Instead you must create the directy “etc” and put a php.ini file inside it. When your php parser starts it will read these the directives inside php.ini and process them.

MySQL timezone setting per query – shared hosting and VPS

Question:

We would like to set our local timezone for web-based transactions. Our web site uses the MySql ‘now()’ function to retrieve the current time.

Is there a way to adjust the time for all our database operations?

Thanks!

Answer:

Yes. The mysql documentation describes how to set it per query at :

http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html (check this link fi the instrucitons here seem to be out of date)

As of this writing, you can do this by performing:


SET time_zone = timezone;

at the start of each session. Keep in mind that if you are doing this in a script, you’ll need to do this each time you connect (basically once per script in most cases).

If you are using one of our VPS’s you can make a global time zone setting and not perform this on each connection.

Using Pine, I get the error: Problem detected: “Received abort signal”

Question:

I tried to send mail from pine and got the error:

Problem detected: “Received abort signal”.

Answer:

We have added a TLS encryption to the mail server and some versions of pine do not work correctly with TLS.

Here is how to fix the problem:

At the main pine menu

press s for setup

c for config

then set the third line (smtp-server) to be:

localhost/novalidate-cert

Save your settings and you should now be able to send mail.

How do I install drupal on my hosting account

Drupal installs easily on phpwebhosting.com servers. ssh to your server and type the following:

1. Download drupal

wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-4.7.2.tar.gz

(get the latest download address from the drupal website)

2. unpack it and cd to the drupal directory

tar xzpvf drupal-4.7.2.tar.gz

3. make drupal your default web dir

mv www www_old
mv drupal-4.7.2 www

(you can also keep your existing www directory and move drupal to a subdir of www)

4. Edit the config file

emacs sites/default/settings.php

search for :

$db_url = ‘mysql://your_username_here:your_password_here@localhost/your_database_name’;

(line 87 in the current settings.php – might change in the future)

Be sure to replace :

your_username_here
your_password_here
your_database_name

with your actual username, password and database. When you signup a database with your username is created automatically. You can use that one or create a new one.

5. Create the database

mysql -u your_username -p your_database_name < database/database.4.1.mysql 6. Load your site Go to your site and create a user. The first user created will become the admin user with all rights. 7. Your are done - enjoy!

What apache version should I use?

Question:

Hi,

I’m installing a small test environment on my workstation at home. What apache version should I use to match my account at phpwebhosting?

Answer:

[As a note to anyone who just happened across this FAQ – you do not need your own home webserver, etc. to use your hosting account. This question is aimed at developers who need to duplicate a full test environment on their home or office workstations. Regular users can just upload their files to their server and work on the server.]

We recommend you install apache 1.3.x

Apache 2 is the newer version but nearly all hosts (including us) use the 1.3 versions. Many people report that Apache 2 still has some issues with mod_php and some other popular modules.

However, if you already have Apache 2 installed it should work just fine. For most uses the webserver version will not make much difference. Even the “issues” with mod_php are a bit of a debatable point in the Apache and php communities.

Bottom line – if you’re doing a new install, go with Apache 1.3.x. If you’ve already got an Apache 2 version, use it – it should work fine.