FAQ: Errors, Warnings and Notices
Why do my articles load slowly?
When I have comments enabled, my individual article pages load more slowly than the rest of my site.
Preferences > Advanced > Publish > Spam blacklists (comma-separated)
sbl.spamhaus.org if it is there.
If this does not resolve the problem, read up on Diagnosing Performance Problems.
This FAQ does not apply to:
- Sluggish admin-side performance
- Slow rendering of article list pages
- Delays during a comment preview or comment post
Article tags cannot be used outside an article context
Article tags, such as
body may only be used from within an article context, which is either:
- within a form called by the
- within an individual article page
UNIQUE and INDEX keys should not both be set..
Safe Mode move_uploaded_file error
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is xyz is not allowed to access…
I get a
move_uploaded_file error when trying to upload a file or image.
Your hosting company has set PHP’s upload_tmp_dir setting incorrectly. You’ll need to ask them to fix it.
The upload_tmp_dir setting must refer to a filesystem directory that is accessible and writable by the PHP server process. In Safe Mode, upload_tmp_dir must be within open_basedir. See here and here for technical information.
Fatal error: Maximum execution time..
Fatal error: Maximum execution time of 60 seconds exceeded in…
Some servers set a time limit on PHP scripts, to stop long operations from continuing indefinitely.
Some Textpattern functions can take several minutes to execute (specifically, uploading files and importing article data). This can sometimes exceed the default time limit set by hosting companies. Textpattern attempts to automatically raise the PHP script time limit where possible. If you’ve received a maximum execution time error, it means Textpattern was unable to raise its time limit, so you’ll have to do it manually.
The procedure for raising the time limit is system dependent. Please see the PHP manual for details, and check your hosting company’s documentation for more information.
Textpattern suddenly stopped working
Software doesn’t wear out or change by itself. If your copy of Textpattern stopped working, it’s because something on the server has changed. The most likely causes of sudden unexplained problems are:
- Server upgrades and configuration changes. Check your hosting company’s news announcements or ask them if they’ve changed anything on your server recently. In particular, hosting companies have been known to upgrade MySQL versions or move databases without following the necessary procedures for ensuring data integrity.
- Database or filesystem corruption. A server crash or hardware failure can cause data and files to be lost or corrupted. See this FAQ for more information about repairing a corrupt database.
- Textpattern modifications or plugins. Have you installed a new plugin, Textpattern update, or modified one of Textpattern’s files recently? In some cases these changes can cause problems that aren’t noticed till some time later.
If your Textpattern site has suddenly stopped working, here are some steps you should take:
1. Check both the public web site and the Textpattern administration interface to see if they are working. Some problems affect only one or the other.
2. If you can log in to the Textpattern admin interface, view the admin > diagnostics page in both Low and High detail modes. Textpattern should report any major database corruption issues. See this FAQ for information on repairing these problems.
3. Check with your hosting company to see if they’ve upgraded or changed something recently, or moved your account to a new server.
4. If you can log in to the Textpattern admin interface, try disabling plugins one by one (on the admin > plugins tab).
5. Upload fresh copies of Textpattern’s files to your server, to replace any that might have been modified or damaged. This won’t affect content stored in your database. Make sure you upload all files in all subdirectories.
If none of these steps uncover the problem, you should raise a technical support ticket with your web hosting company.
Article text is cut off
I just edited an article, and the body text is cut off half way through.
We’ve had unconfirmed reports of some Firefox extensions causing problems with incomplete body text on the content > write tab.
If you’re experiencing this or similar problems, please test with browser extensions disabled, or try a different web browser.
Problems uploading images or files
I’m getting an error when I try to upload images or files using the Textpattern admin interface.
“Warning: move_uploaded_file() [function.move-uploaded-file]: SAFE MODE Restriction in effect.”
Does Textpattern work in PHP safe mode?
In order to use the Textpattern administration interface to upload images and files (via content > images or content > files), you’ll need to ensure Textpattern has access to the necessary directories.
Both image and file uploads require write access to a temporary directory. Textpattern attempts to find a writable temp directory during installation, and will automatically use it if one is found.
If no writable temporary directory was found, Textpattern will display a warning message on your admin > diagnostics page.
If you’ve recently moved Textpattern to a new server, you might need to alter the temporary directory setting to point to a new location.
To force Textpattern to search for a new temporary directory:
1. Go to admin > preferences > advanced preferences
2. Find the “Temp folder” setting, under “Admin”
3. Delete the contents of the Temp folder setting, and click the Save button.
If Textpattern is able to find a suitable temporary directory, it will automatically fill in the new setting. If the Temp folder setting stays blank, you’ll need to set it manually:
1. On the admin > diagnostics page, make a note of the Textpattern path setting. Typically it looks something like
1. On your web server, using an FTP client, shell access or a file manager provided by your hosting company, find the
tmp folder located inside the Textpattern path directory.
2. Change the permissions on this
tmp folder to make it writable by the web server process. Your hosting company may provide specific instructions on this. On a Unix server, you may have to make the directory “world writable” by setting its permissions to
777, but before you do this, always consult your webhost, because
777 permissions are a serious security risk on shared webhosts and frowned upon in other hosting setups, so it’s safer to first try
700 or (if that fails)
3. On the admin > preferences > advanced page, change the Temp folder setting to the full path to this tmp folder. If your Textpattern path is
/home/foo/public_html/textpattern, that means your Temp folder setting should be
Regardless of whether the temp directory is detected automatically or set manually, you’ll also need to make the
images directories writable. These are located in the same parent directory that contains your Textpattern path – using the above example,
Using the same method described in Step 2 above, change the permissions on both of these directories to make them writable by the web server process.
Once the Temp folder is set correctly and writable, and the images and files folders are writable, file and image uploads should work correctly.
405 Method Not Allowed error
I get a 405 Method Not Allowed error when submitting a form
I get a 405 Resource Not Valid error when submitting a form
This is most likely a server configuration problem with Microsoft IIS. Textpattern itself never generates a 405 error.
You should ask your web hosting company to resolve the issue.
See this Google search for some discussion and possible solutions.
Errors during setup with MySQL 4.1.1
MySQL error during installation: “Specified key was too long. Max key length is 500”
This error is caused by a bug in MySQL 4.1.1.
MySQL 4.1.1 was an early test release, not a production version of MySQL. The first 4.1.x version deemed suitable for production use is 4.1.7.
Please upgrade your server, or raise a support ticket with your hosting provider and ask them to upgrade MySQL to a release version.
Client does not support authentication protocol
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client..
This is a PHP error that occurs when the version of the PHP MySQL library is different to the MySQL server.
Please contact your hosting provider and ask them to fix the problem.
imagejpeg() error when creating a thumbnail
How do I get password-protected directories (with .htaccess) to co-exist with textpattern?
Using .htaccess authentication makes the directory inaccessible.
HTTP Basic Authentication with the webserver redirects everything to textpattern’s index page.
Using HTTP Auth with Apache results in 404 error pages.
Please add the following lines to your .htaccess file:
ErrorDocument 401 /[path_to_file]/myerror.html
ErrorDocument 403 /[path_to_file]/myerror.html
Make sure you point to existing, static html files.
Explanation: HTTP Basic-Auth first sends
401 Unauthorized to request a password from the browser. The webserver tries to serve the corresponding, specified Errordocument. However when the ErrorDocument directive of your webserver is set wrongly, i.e. points to a non-existent file, Textpattern ends up handling the page-request.
Problems with code in article bodies
My PHP code doesn’t work properly in an article body
<txp:output_form form="my_js_code" />
If you often find yourself calling code from article bodies, you might consider rethinking your design. Articles are for content, code is more appropriate for a page template or form. See if you can place the code in your article form instead.
Occasional "Database Unavailable" errors
Occasionally I see a “Dabatase Unavailable” error. Why?
Occasionally I see a “500 Internal Server” error, then it returns to normal..
Intermittent errors like these are usually caused by an overloaded server.
Database Unvailable means Textpattern is unable to connect to the SQL database. This can happen occasionally on some shared/virtual hosting servers when another user hogs all the available database resources. If it happens regularly, ask your hosting company whether there’s something they can do to fix the problem.
A 500 Internal Server error could mean any number of things, from a server misconfiguration to a major crash. Occasional intermittent 500 errors can happen on shared/virtual hosting servers when another user hogs all the available memory, cgi processes, or some other limited server resource. Again, talk to your hosting company if it happens regularly.
If you’re seeing Database Unavailable or 500 Internal Server errors on every page view, without exception, then the problem is most likely a database server crash, or a misconfiguration. In some cases we’ve seen hosting companies change important database or server settings without informing their customers first.
If this is the case, check the settings in your textpattern config.php file and make sure you can connect to the database using those settings in phpMyAdmin or similar. If the database server is working, check your .htaccess file, and consider temporarily disabling it. If problems persist, talk to your hosting company.
Individual article pages don't respond
My article list pages work fine, but some individual article pages time out
When I try to view an article page with comments, the page doesn’t load
Are you using a Gravatar plugin? These and similar problems can occur when the Gravatar web site is down.
Disable the plugin and see if it makes a difference.
Search result troubleshooting
My site search isn’t returning the correct results.
Some common issues with searching:
If your search results page is completely blank (a zero byte page), the problem is probably a fatal error that is not displayed because of your Production Status setting. See this FAQ for more information.
Page layout is displayed, but no articles
If your search results page shows its normal page layout, but with no articles, you should check three things:
1. That the sections containing the articles in question have Include in site search set to Yes on textpattern > presentation > sections.
2. That the search term you’re using really does match some articles. Test the same search term in the Search Body & Title box on textpattern > content > articles, and make sure that finds at least one Live article. If not, use a single, common word, and try varying the case. Case sensitive search results are caused by an incorrect collation setting on your textpattern database or table.
3. If you’re using a special section such as
/search/ to display your search results, make sure your
<txp:article /> tag doesn’t
searchall=0 – this will force it to look for articles in the
searchall=1 is the default; this tells the article tag to display results from all sections that have Include in site search set to Yes.
Wrong articles are displayed
If your search results page displays the wrong articles – the same articles as your front page, for example – it’s probably because you’re using the
<txp:article_custom /> tag instead of
<txp:article />. article_custom is context insensitive – that is, it always displays the same list of articles, regardless of the URL or query parameters.
Either change your page template to use
<txp:article /> instead, or use a separate section and template to display the search results.
Error: publish.php cannot be called directly
“If you just updated and expect to see your site here, please also update the files in your main installation directory. (Otherwise note that publish.php cannot be called directly.)”
This is most commonly caused by forgetting to update the topmost
index.php file (or perhaps
css.php) when upgrading.
Please ensure that you upload all files to your web server when you upgrade.
If you’re trying to
include() publish.php from another script or page, please note that this is not recommended, and unsupported. Textpattern is intended to work as a stand-alone application. Embedding it in another script might break things in catastrophic or subtle ways, or (worse) open a security hole.
If you really must include publish.php from another script, start by examining the code in index.php.
Fatal error: Allowed memory size..
Fatal error: Allowed memory size of 8388608 bytes exhausted..
Textpattern’s memory usage is quite low – usually no more than a couple of megabytes.
Unless your server admin has set the PHP memory limit far too low — unlikely, but not impossible — the cause is probably a plugin. Some older archive page plugins work by loading all articles into memory at once. This could easily exhaust the available memory if you have a large number of articles.
Disable your plugins one by one, until you find the culprit. If the cause is indeed a plugin, we suggest contacting its author about the problem.
Comment emails aren't received
Comment and/or password emails are never received
Can Textpattern send mail from Windows servers?
Textpattern uses PHP’s built-in mail functions to send email. Email should work on any properly configured system. Unfortunately, not all web hosts configure PHP’s mail settings correctly – particularly on Windows servers.
Additionally, some servers perform spam filtering on outgoing email, or block messages that don’t have a recognized
Ask your web host’s technical support about PHP mail to find out if it’s properly configured, and whether there are any restrictions. Textpattern uses the Publisher user’s email address as the
From: address when sending password emails, and the article author’s email address when sending comment notifications.
If you’re running Textpattern on your own server, please check your email settings in php.ini.
On Windows servers, or Unix servers that block or restrict access to sendmail, you’ll need to set
The install page shows a jumble of PHP code
When I view Textpattern pages, all I see is the contents of the PHP files
Either one of two things is happening:
1. Your server isn’t configured to interpret
.php files as programs.
Ask your web host or server admin to set up the necessary
AddType magic. If you’re running your own server, please see the PHP Installation instructions.
2. You’re trying to open Textpattern’s PHP files directly from your own computer, perhaps using a
If you want to run a Textpattern installation on your local machine for test purposes, and have all the necessary server software installed, make sure you access Textpattern via
http://.. URLs. If you use
file:.. URL instead, your web browser will open the PHP files directly, bypassing the web server and PHP software.
Article Images aren't working
To use Textpattern’s Article image feature (under Advanced Options on the content > write page), you need to do two things:
1. Place an image URL or ID in the Article image field. The ID is a single number, like
123 – don’t use an extension. If you want to refer to it by filename, you’ll need to use an absolute URL like
http://example.com/images/cat_pic.jpg. Don’t put HTML or Textpattern tags in the Article image field, they’re not needed and won’t work.
2. Make sure your article form includes the following tag:
More detailed instructions are included in Textbook.
Tabs show up as tab_content, tab_presentation..
All of the text on my admin pages shows up as short phrases with underscores (tab_content, advanced_options, etc)
This happens when there is no language installed. (Perhaps you encountered an error during the setup process?)
Go to tab_admin > tab_preferences, manage_languages, then install or update the appropriate language.
If the language is installed correctly and the problem persists, try switching to a different language and back.
404 error unless I use index.php
http://example.com/index.php works, but http://example.com/ gives a ‘404 Not Found’ error
Uncomment (remove the ”#” from) the following line in your .htaccess file:
#DirectoryIndex index.php index.html
If that doesn’t help, or causes a 500 Internal Server error, contact your web host tech support and ask them about enabling
DirectoryIndex for PHP files.
Client does not support authentication protocol requested by server
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /Library/WebServer/Documents/tp1/textpattern/setup/index.php on line 187
This and similar errors are caused by a PHP installation problem: the version of the PHP mysql client library is older than the MySQL server.
You should raise a support ticket with your web hosting company, and ask them to reinstall the correct versions.
412 Precondition Failed
Why do I get a “412 Precondition Failed” error when submitting a form?
“mod_security: Access denied with code …”
I get a mysterious server error when trying to save a page template or form.
These and similar errors are usually caused by mod_security filtering. Some hosting companies use mod_security or other similar filters to block web form submissions containing certain key words or suspicious symbols, in order to prevent comment spam or hack attempts. Occasionally these security rules can block legitimate requests.
Textpattern never sends a 412 response.
You should raise a technical support ticket with your hosting company. There is nothing Textpattern can do to fix the problem.
Images are broken on certain pages
My images show up broken on category pages
My images show up broken on article pages
Stylesheets are broken on article pages
Images or CSS stylessheets that are broken only on certain pages using clean URL mode usually indicates a problem with relative URLs.
Clean URLs look something like this:
When you use a relative image URL – such as
<img src="images/foo.jpg" />, or (in Textile) !images/foo.jpg! – it’s the web browser that appends that image URL to the current page URL to resolve the final location, not Textpattern. When viewing the pages listed above, the web browser would request images from these URLs:
The first of these might work, but the second and third won’t.
The same applies to stylesheets, and to images referenced within stylesheets.
There are several solutions.
One is to always use absolute URLs for images and stylesheets. Instead of
/images/foo.jpg. (If Textpattern is installed in a subdirectory, use
Another is to specify a base URL in your page template, like this:
That instructs the web browser to use
http://example.com/ as the base page when resolving all relative URLs.
When linking to images, you can use two tags to help.
The txp:image tag lets you display any image that was uploaded using Textpattern’s image manager. You refer to the image by its ID number:
<txp:image id="3" />
..or by name (minus the file extension):
<txp:image name="foo" />
To link to other images, you can use the
txp:img tag, which prepends the Textpattern root URL to image paths:
<txp:img src="images/foo.jpg" />
For other types of links, the txp:site_url tag will be useful.
More information at W3.org, HTML and URLs.
Blank page after editing a page template
I changed a tag in my page template (or form), now the page is completely blank!
A large portion of my page is missing
This usually means an error has occured but is not displayed because you’re running in Live mode. Setting the Production Status preference to Live suppresses all error messages. When a fatal error occurs in Live mode, the result is a blank page.
Go to textpattern > admin > preferences, and set Production Status to Testing, then view the problem page again. You should see a more informative error message this time.
It’s always a good idea to use Testing mode when editing templates and forms. Switch to Live mode only when you’re certain everything works.
(Debugging mode is intended only for developers; it’s normal to see some spurious messages in this mode)
If you’re still seeing a blank page even in Testing mode, the most likely cause is a syntax error in one of your
<txp:...> tags. Common problems to look for include:
- unclosed tags
</txp:foo />instead of
Parse error: unexpected ..
Parse error: parse error, unexpected ’.’ in /home/domain/www/txp/textpattern/lib/txplib_forms.php on line 167
Parse error: parse error, unexpected ..
These and similar errors occur when Textpattern’s PHP files have been corrupted or incorrectly modified. The best solution is to download a fresh copy and replace the files on your server.
If you’re experiencing repeated problems, make sure your FTP client (or whatever program you’re using to transfer files to your server) isn’t set to ASCII mode.
Warning: Missing argument 2 for..
Warning: Missing argument 2 for if_comments_allowed() in /httpdocs/textpattern/publish/taghandlers.php on line 1188
Warning: Missing argument 2 for some_function ..
These and similar errors occur when an enclosing
<txp:...> tag isn’t closed properly. The function name will be the name of the tag (
<txp:if_comments_allowed> in the above example).
Check for errors like these in your page templates:
Using an enclosing tag as self-closing
<txp:some_tag />instead of
<txp:some_tag> ... </txp:some_tag>
Error in closing tag
Missing closing tag
Textpattern crashes Apache under WAMP
A known bug in either PHP or Apache causes the Apache process to crash during Textpattern setup on certain versions of WAMP (PHP 5, Apache/1.3.33).
The bug is triggered by the apache_get_modules() function call.
There are no plans to alter Textpattern to work around the problem, since the bug is in the web server itself. We think it’s reasonable to include “a web server that doesn’t crash” in the list of Textpattern system requirements.
Clean URLs don't work
Permlinks don’t work
I get a 404 error when trying to comment
I get a 404 error when trying to view article pages
I get a 404 error when trying to view section pages
The wrong content is displayed in clean URL mode
These and similar problems happen when you use “clean” URL mode on a server that doesn’t support mod_rewrite in .htaccess, or requires additional configuration in order to work. The .htaccess file supplied with Textpattern is designed to work on most Apache servers, but there is no universal solution.
The Textpattern diagnostic page will attempt to warn you if it can determine that clean URLs are not supported on your system. However, it doesn’t detect all incompatible servers – the absence of a warning does not mean that your server supports clean URLs.
The simplest solution is to use “messy” URLs instead (see textpattern > admin > preferences > permanent link mode, and remove or move aside the .htaccess file).
Some servers support mod_rewrite, but require some additional configuration in order to make it work properly.
If your web server is Apache, and supports mod_rewrite in .htaccess, you can find some suggestions for specific web hosts in this forum thread. “1and1” is the most common host that requires such changes for clean URLs to work.
Most free or nearly free hosting services don’t support clean URLs at all. In some cases clean URLs appear to work fine at first glance, but might fail in subtle ways.
On servers that support mod_rewrite, the most common solution is to uncomment (remove the leading ‘#’ from) this line in .htaccess:
..and change the path as appropriate. If Textpattern is installed in your web site root (i.e. the front Textpattern page is at
http://example.com/), you should use this:
If Textpattern is installed in a subdirectory (the front Textpattern page is at
Other changes required on some hosts include:
DirectoryIndex index.php index.html
Both of these lines are included in the default .htaccess file, so you can simply uncomment them.
If you are configuring your own Apache server, or using a hosting arrangement that lets you modify your own Apache configuration settings, you might need to add the following to the appropriate place in httpd.conf:
If none of those changes work, or if they cause a 500 server error, you’ll need to use “messy” URLs instead, or ask your hosting company for help.
500 Internal Server Error
I get a “500 Internal Server Error” when trying to view pages
I get a “403 Forbidden” when trying to view pages
These and similar errors are almost always caused by
.htaccess file is used by Textpattern to mange “clean” URLs – http://example.com/articles/123/hello-world instead of http://example.com/index.php?id=123.
While we’ve done our best to ensure the .htaccess file supplied with Textpattern will work with as many web server configurations as possible, some servers are configured to restrict this. A
500 Internal Server Error or
403 Forbidden response is usually the result of a .htaccess file that tries to exceed these restrictions.
The simplest thing you can do to fix the problem is simply delete or rename
.htaccess, and switch to “Messy” URL mode (see textpattern > admin > preferences > permanent link mode).
You’ll find some other pointers in this FAQ.
Notice: undefined variable..
When your Production Status is set to Debugging, it’s not uncommon to see PHP Notices similar to this:
Notice: Undefined index: permlink in …/textpattern/lib/txplib_misc.php(412) : eval()’d code on line 26
Debugging mode is intended for just that: debugging problems. If everything is working fine, there’s no reason to turn on Debugging.
Notices in debug mode are not unusual, and by themselves aren’t an indicator of something wrong. If the only symptom you have is that there are notices produced when Production Status is set to Debugging, then there’s nothing wrong, and you can safely ignore them.
By itself, with no other symptoms, a Notice is not a bug, so please don’t report it as such.
On the other hand, if something is failing to work, the messages produced in debug mode might be helpful in tracking down the source of the problem.
Fatal error: xml_parser_create
Fatal error: Call to undefined function: xml_parser_create() in /htdocs/www/CMS/textpattern/lib/IXRClass.php on line 147
Textpattern requires the PHP XML library, which is enabled by default in PHP 4. It has been disabled on your server.
Some hosting companies (notably Modwest.com) disable PHP XML by default, but allow individual users to turn it on in their PHP configuration. Please contact your host’s technical support if you need help with this.
If you’re running PHP on your own server, the installation instructions for PHP XML are listed on this page. Please note that installing and configuring a web server is outside the scope of the Textpattern support forum.
Notice: Constant txpinterface already defined..
This is usually caused by failing to upgrade all of Textpattern’s files. Make sure you don’t forget the index.php file that lives at the Textpattern root.
Fatal error: Call to undefined function..
Fatal error: Call to undefined function: formatmentionslink() in /home/somewhere/textpattern/lib/txplib_misc.php(429) : eval()’d code on line 172
Fatal error: Call to undefined function: checkcommentsallowed()
These and similar errors immediately after an upgrade are usually caused by one of two things:
- Old plugins that haven’t been updated to work with the current version of Textpattern
- Not updating or uploading all of Textpattern’s files correctly. Make sure you upload all the files in all subdirectories.
Similar errors immediately after installation usually indicate:
- An incorrect
txpathsetting in config.php. The value automatically detected by the setup process is almost always correct, so don’t change it unless you know what you’re doing.
- Textpattern .php files that are missing or in the wrong location.
Warning: failed to open stream..
Warning: failed to open stream..
Warning: main(/publish.php): failed to open stream: No such file or directory in /home/somewhere/textpattern/index.php on line 12
These and similar errors are usually caused by:
- A missing or empty config.php file
- Missing or empty subdirectories
- Missing .php files
- An incorrect ‘txpath’ setting in config.php
Make sure you’ve uploaded the complete contents of the Textpattern .zip/.tar.gz file to the correct location, and that your config.php settings are correct.
Warning: Unable to save result set..
Warning: mysql_query(): Unable to save result set..
Warning: mysql_query() [function.mysql-query]: Unable to save result set in /home/somewhere/public_html/blog/textpattern/lib/txplib_db.php on line 53
The “Unable to save result set” error is generally associated with major MySQL problems, like a corrupt table or faulty install. It is not caused by Textpattern.
In some cases we’ve found that repairing the MySQL database fixes this, even though CHECK TABLE reported no problems at all.
The PHP manual has a FAQ topic on a PHP installation problem that can cause this error.
The MySQL manual has a section on checking and repairing tables.
If your hosting company provides phpMyAdmin, you can select a table, then use the “Repair table” option under the Operations tab.
There is also a Textpattern plugin which can allow you to repair tables in your Textpattern database.