Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-08-26 12:35:43
- Tony_Wong
- New Member

- From: Kyoto
- Registered: 2006-11-24
- Posts: 7
$path_to_site is wrong and cannot be changed
My webhost upgraded the server and that gave a lot of problems, all but one I solved.
I am getting many errors when running diagnostics:
$path_to_site is inaccessible.: /var/www/vhosts/domainname
/var/www/vhosts/domainname/index.php is inaccessible
Image directory is not writable: /var/www/vhosts/domainname/images
.htaccess file is missing
The first one is wrong(path_to_site), it should be /var/www/vhosts/domainname/httpdocs
If I change that in mysql (I cannot find a way to change it in the txp admin section, I think it is a path you set during setup) all errors are gone, but as soon as I do something in the admin section the old path_to_site is inserted in the mysql table and the diagnostics give the same errors again.
How to solve this?
The site is running fine, it only gives a problem when uploading images. txp looks for the images directory in the wrong place. Strange enough uploading files is not a problem (that gets handled differently than uploading images i guess).
Offline
Re: $path_to_site is wrong and cannot be changed
Some help:
Did you edit the config-file, found in /textpattern/config.php? Change at line 7: $txpcfg['txpath'] = '/home/user/public_html/textpattern';, that what corresponds yours.
At Textpattern’s panel, at path Textpattern / Admin / Preferences / Advanced => Image directory, that what is corret one
Add .htaccees-file to the textpattern’s site-root, with code:
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /relative/web/path/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php
</IfModule>
#php_value register_globals 0
And at last: change images-dir CHMOD to 777
Cheers!
Offline
#3 2007-08-26 13:59:38
- Tony_Wong
- New Member

- From: Kyoto
- Registered: 2006-11-24
- Posts: 7
Re: $path_to_site is wrong and cannot be changed
Yes everything you mentioned is fine. It is just $path_to_site which is not good. When I change the value with Phpmyadmin and run diagnostics right after that, all is OK. When I click on the content tab and then the images tab, I cannot upload images again and running diagnostics after that, all the old errors show up again. When I check the value of path_to_site with PHPMyAdmin, the value is reverted to the wrong value again.
Offline
Re: $path_to_site is wrong and cannot be changed
$path_to_site is checked and corrected in two places: /textpattern/index.php and /textpattern/publish.php. Both use the same method to determine the correct $path_to_site.
In the /textpattern/publish.php file, just before the last line ( ?> ) add the following:
echo "here: $here\n";
echo "file: ".__FILE__."\n";
echo "pts: ".dirname(dirname(__FILE__));
Then visit your front page and view the bottom of the HTML source. What do the last few lines say?
Last edited by ruud (2007-08-26 14:10:16)
Offline
#5 2007-08-26 14:20:36
- Tony_Wong
- New Member

- From: Kyoto
- Registered: 2006-11-24
- Posts: 7
Re: $path_to_site is wrong and cannot be changed
here: /var/www/vhosts/domainname
file: /var/www/vhosts/domainname/httpdocs/textpattern/publish.php
pts: /var/www/vhosts/domainname/httpdocs
Offline
Re: $path_to_site is wrong and cannot be changed
“here” is set to the wrong value. Strange. Let’s have a closer look at that. First remove the added code in publish.php. Then, at the end of /var/www/vhosts/domainname/httpdocs/index.php (just above ?> ) add:
echo "here: $here\n";
echo "file: ".__FILE__."\n";
echo "dirname: ".dirname(__FILE__);
What does that show in the HTML source?
Last edited by ruud (2007-08-26 15:38:35)
Offline
#7 2007-08-26 15:58:03
- Tony_Wong
- New Member

- From: Kyoto
- Registered: 2006-11-24
- Posts: 7
Re: $path_to_site is wrong and cannot be changed
here: /var/www/vhosts/domainname
file: /var/www/vhosts/domainname/httpdocs/textpattern/publish.php
dirname: /var/www/vhosts/domainname/httpdocs/textpattern
Thanks very much for looking into this problem by the way.
Last edited by Tony_Wong (2007-08-26 16:03:17)
Offline
Re: $path_to_site is wrong and cannot be changed
I think you added it in the wrong file. The code should be added in /index.php, not /textpattern/publish.php
Offline
#9 2007-08-26 16:48:58
- Tony_Wong
- New Member

- From: Kyoto
- Registered: 2006-11-24
- Posts: 7
Re: $path_to_site is wrong and cannot be changed
OMG, I’m sorry. Here’s the new result:
here: /var/www/vhosts/domainname
file: /var/www/vhosts/domainname/httpdocs/index.php
dirname: /var/www/vhosts/domainname/httpdocs
Offline
Re: $path_to_site is wrong and cannot be changed
On line 20 of /index.php, what does you see. It should say $here = dirname(__FILE__);, but looking at the contents of $here, it’s almost as if it says $here = dirname(dirname(__FILE__));
Offline
#11 2007-08-26 17:02:52
- Tony_Wong
- New Member

- From: Kyoto
- Registered: 2006-11-24
- Posts: 7
Re: $path_to_site is wrong and cannot be changed
It said:
$here = dirname($_SERVER[‘DOCUMENT_ROOT’]);
And now I know what the problem is, the index.php file was an older version of Textpattern (4.0.4).
The 4.0.5 version works fine. I think I had the same problem when I had txp 4.0.4 installed (it made me install 4.0.5). If you want I can try to reproduce it in 4.0.4. But I am very happy this is solved. Thank you very much.
Offline
Re: $path_to_site is wrong and cannot be changed
If it works in 4.0.5, then it’s okay. Make sure you upgrade all TXP files to 4.0.5
Offline