Home » Forum
NoNumber!

Joomla!® Websites & Extensions
development  -  support  -  consultancy

I try to respond within 48 hours (excluding weekends).
If I haven't responded by then, feel free to post a reminder or bug me via email.

My last reply was: 16 Hours, 11 Minutes ago.

Welcome, Guest
Please Login or Register.    Lost Password?

Function fopen + joomla
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Function fopen + joomla
#5135
Function fopen + joomla 2 Years, 3 Months ago  
Hello,

i dont speak a good english but I hope you'll understand my problem :

I have to do a php script. It has to open an .XLS file and write inside some data. I already tested my script (in a file.php) and it works perfectly on my website. But when I insert this code in the joomla sourcerer, I have the following error :


{source}
[[?php

$Id_file_xls = fopen ("http://www.my_web_site.ch/file/xcel_test.xls","w+");

?]]
{/source}

Error 1 :
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /home/www/4a67e21efb8a0e92a4456b6945896311/web/cms/plugins/system/sourcerer.php(502) : eval()'d code on line 1
Error 2 :
Warning: fopen(www.mywebsite.ch/folder/file.xls) [function.fopen]: failed to open stream: no suitable wrapper could be found in /home/www/4a67e21efb8a0e92a4456b699b6c0611/web/cms/plugins/system/sourcerer.php(502) : eval()'d code on line 1

Do I have to modify the htaccess file or something like that ? Thanks for your help, I'm lost
aduriez
Posts: 3
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#5141
Function fopen + joomla 2 Years, 3 Months ago  
Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#5150
Function fopen + joomla 2 Years, 3 Months ago  
Thanks for your answer but I already used Google for my search and there is no help. . . . every link talking about the server configuration. . .

But my problem is not with the server configuration : When I test my phpfiles on my server it works perfectly (www.myawebsite/testfile.php). . . So I thik my server configuration is ok. . . allow_url_open is on .. . No error. . .

It doesn't work only when I put the code in the sourcerer and try to see the result in Joomla.. .

I keep searching a solution and I will post it here if i find it. If you have some clues thank you !
aduriez
Posts: 3
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#5151
Function fopen + joomla 2 Years, 3 Months ago  
PS :

There is my phpinfo() :



fopen now works( i used a relative path and it works....) : $Id_file_xls = fopen ("../file/$FileName","w+");

but I have the same problem when I want to write into the file with fputs. There is my code :



$FileName = "xcel_test.xls";
2$Id_file_xls = fopen ("../file/$FileName","w+");
3    
4    
5    function XlsEcho($Value)
6    {
7    //echo $Value; // Affiche la chaine
8    $Temp=str_replace("[[TR]]","
",$Value);
9    $Temp=str_replace("[[TD]]"," ",$Temp);
10    global $Id_file_xls;
11    fputs($Id_file_xls,$Temp);
12    }
13    function XlsAddColonne()
14    {
15    global $Id_file_xls;
16    fputs($Id_file_xls," ");
17    }
18    function XlsAddLigne()
19    {
20    global $Id_file_xls;
21    fputs($Id_file_xls,"
");
22    }
23    
24    function XlsPrint($Value)
25    {
26    global $Id_file_xls;
27    fputs($Id_file_xls,$Value);
28    }
29    function XlsClose()
30    {
31    global $Id_file_xls;
32    global $FileName;
33    fclose($Id_file_xls);
34    echo "[[TABLE CLASS='fond' WIDTH='90%']][[TR]][[TD]]";
35    echo"Export : ";
36    echo "[[A href='file/$FileName.xls']] Cliquez ici[[/A]]";
37    echo "[[/TD]][[/TR]]";
38    echo"[[/TABLE]]";
39    }
40    if(file_exists("../file/$FileName.xls"))
41    {
42    echo"file alredy exist";
43    unlink ("../file/$FileName.xls");
44    echo"file deleted";
45    }
48    
49    
50    XlsEcho("Section");;


I keep trying
aduriez
Posts: 3
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#5156
Function fopen + joomla 2 Years, 3 Months ago  
try this for paths:
dirname( __FILE__ ).'/file/xcel_test.xls'

Peter van Westen
Admin
Posts: 9165
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
Go to topPage: 1
Moderators: Peter van Westen
Open Source Training | Online Joomla! Training and Support
MaxCDN | Content Delivery Network | Accelerate your site to the max
hosting joomla