Smoerble
asked on
typo3 PHP_SCRIPT_EXT include problem
I want to include the outcome of a PHP script in Typo3. It works fine, if I use a script that has no other includes. Typo3 script I use:
-------------------------- ----
IMPORTED-MENU = PHP_SCRIPT_EXT
IMPORTED-MENU {
file = fileadmin/smo_latesttopics _export.ph p
}
-------------------------- ----
The problem I have now is, that I want to use PHP scripts, that are related to a forum.
If I run the script like this:
-------------------------- ----
http://www.mydomain.com/forum/smo_latesttopics_export.php
-------------------------- ----
It works as planned.
If I add use the following in typo3script (the double ../ is correct in my test case), nothing gets displayed in the template at the particluar area.
-------------------------- ----
IMPORTED-MENU = PHP_SCRIPT_EXT
IMPORTED-MENU {
file = ../../forum/smo_latesttopi cs_export. php
}
-------------------------- ----
If I use copy the script to fileadmin folder and correct all paths inside the script, I get the following error:
-------------------------- ----
IMPORTED-MENU = PHP_SCRIPT_EXT
IMPORTED-MENU {
file = fileadmin/smo_latesttopics _export.ph p
}
-------------------------- ----
error:
-------------------------- ----
Warning: main() [function.main]: open_basedir restriction in effect. File(../../forum/init.php) is not within the allowed path(s): (/var/www/vhosts/mydomain. com/httpdo cs:/tmp) in /var/www/vhosts/mydomain.c om/httpdoc s/typo3-te st/fileadm in/smo_lat esttopics_ export.php on line 2
-------------------------- ----
Reason:
-------------------------- ----
require_once( '../../forum/init.php' );
-------------------------- ----
So how can I include a php script from a different folder but the typo3/fileadmin please?
--------------------------
IMPORTED-MENU = PHP_SCRIPT_EXT
IMPORTED-MENU {
file = fileadmin/smo_latesttopics
}
--------------------------
The problem I have now is, that I want to use PHP scripts, that are related to a forum.
If I run the script like this:
--------------------------
http://www.mydomain.com/forum/smo_latesttopics_export.php
--------------------------
It works as planned.
If I add use the following in typo3script (the double ../ is correct in my test case), nothing gets displayed in the template at the particluar area.
--------------------------
IMPORTED-MENU = PHP_SCRIPT_EXT
IMPORTED-MENU {
file = ../../forum/smo_latesttopi
}
--------------------------
If I use copy the script to fileadmin folder and correct all paths inside the script, I get the following error:
--------------------------
IMPORTED-MENU = PHP_SCRIPT_EXT
IMPORTED-MENU {
file = fileadmin/smo_latesttopics
}
--------------------------
error:
--------------------------
Warning: main() [function.main]: open_basedir restriction in effect. File(../../forum/init.php)
--------------------------
Reason:
--------------------------
require_once( '../../forum/init.php' );
--------------------------
So how can I include a php script from a different folder but the typo3/fileadmin please?
Also check the file permission and make sure that all your scripts have the same file owner
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Arg.
Sorry, I wanted to split the points :(.
Thanks for both solutions, as both work fine!
Sorry, I wanted to split the points :(.
Thanks for both solutions, as both work fine!
<?php
echo __FILE__;
?>
Create the above script in the same directory as you file, then use the full path for inclussion:
--------------------------
IMPORTED-MENU = PHP_SCRIPT_EXT
IMPORTED-MENU {
file = /full/path/to/fileadmin/sm
}
--------------------------