PDA

View Full Version : php safe mode


th2mods
10-30-2007, 01:11 AM
i need it off for approx. 15 min, for this mod im installing
3) Install comprofiler.zip as a component.

NOTE: In Joomla 1.5, you need to set legacy mode to ON in the legacy

plugin settings before being able to installand run CB 1.1 on Joomla 1.5.

NOTE: PHP Safe mode must be off for component and plugins installation

in Joomla! 1.0.x and Mambo.

Tyler
10-30-2007, 01:26 AM
Nope you don't, and if you truly think you do then the answer is that it will NEVER be turned off. It is on for a reason, if we turn it off that is a huge security risk.

Have you tried it first?

th2mods
10-30-2007, 01:38 AM
okay, sorry i didn't know it was a security risk, and yea im trying now. no luck

Tyler
10-30-2007, 01:54 AM
You might be able to modify the script to make it work without it.

th2mods
10-30-2007, 01:55 AM
im trying to install "comprofiler.zip" for cummuntiy builder, i uploaded the files via ftp to "/hosted/subs/ulmb.com/a/d/advertise/public_html/administrator/components/com_installer/component/com_comprofiler" i get this error
Failed to create directory "/hosted/subs/ulmb.com/a/d/advertise/public_html/components/com_comprofiler/"
so i upload the files to that, then i get a error saying "the folder Failed to create directory in /hosted/subs/ulmb.com/a/d/advertise/public_html/components/com_comprofiler/ is already in use"

if i try uploading it via joomla! i get this error,
Failed to move uploaded file to /media directory. :-\

UnlimitedMB
10-30-2007, 02:02 AM
You need to contact joomla about this.

A failed to create directory message can NEVER be caused by safe mode.

th2mods
10-30-2007, 02:03 AM
You need to contact joomla about this.

A failed to create directory message can NEVER be caused by safe mode.

CHMOD maybe? to 777? will that work?

UnlimitedMB
10-30-2007, 02:09 AM
I remember checking this before.
Its a joomla bug.

It tries to create a folder without creating the parent folder first.

eg. to make /component/com_comprofiler you need to make /component first.

wwe
10-30-2007, 02:10 AM
CHMOD Doesn't have to be done on ULMB. If a script asks for something to be CHMOD'd to a certain number, then it's done automatically.

th2mods
10-30-2007, 02:12 AM
I remember checking this before.
Its a joomla bug.

It tries to create a folder without creating the parent folder first.

eg. to make /component/com_comprofiler you need to make /component first.

i dont get what you mean, i tried that but i get this error
so i upload the files to that, then i get a error saying "the folder Failed to create directory in /hosted/subs/ulmb.com/a/d/advertise/public_html/components/com_comprofiler/ is already in use"

UnlimitedMB
10-30-2007, 02:27 AM
Yes because you created the folder manually.

Delete com_comprofiler folder, and try install again.

th2mods
10-30-2007, 02:35 AM
same thing.....
Failed to create directory "/hosted/subs/ulmb.com/a/d/advertise/public_html/components/com_comprofiler/"

i made the directory again, and tried again....
Another component is already using directory: "/hosted/subs/ulmb.com/a/d/advertise/public_html/components/com_comprofiler/"

UnlimitedMB
10-30-2007, 02:41 AM
It could be because the last /
Without looking at the source code i dont know.
You should not have a / at the end of a directory path.

This script is buggy and wont work on php5.

This is explain on php.net
http://www.php.net/manual/en/function.mkdir.php

I've discovered that since my (shared) hosting provider upgraded to PHP 5.1.6 , a script containing this mkdir doesn't work:

<?php
mkdir('/home/benge/photos/gallery1/extra_large/', 0777);
?>

but this does work:
<?php
mkdir('/home/benge/photos/gallery1/extra_large', 0777);
?>

the difference being, the trailing slash "/" after "extra_large.

There were three ways to fix the problem:
1. remove the trailing slash from the script code
2. downgrade to < PHP 5.1.6
3. turn safe mode off

I went with option 1.

th2mods
10-30-2007, 02:43 AM
how do i 1. remove the trailing slash from the script code?

UnlimitedMB
10-30-2007, 02:51 AM
You have to find the line which created the directory.

It will be a mkdir.
search for the text "Failed to create directory" and look at the lines above it.

Really this is a software bug and joomal should fix it.

th2mods
10-30-2007, 03:06 AM
thank you, i have directed this to Joomla!
http://forum.joomla.org/index.php/topic,228250.msg1055757.html#msg1055757

th2mods
10-31-2007, 12:16 AM
its the host, not Joomla!

ANSWER:

1. Edit PHP.INI
2. add the following line:
upload_tmp_dir = /tmp

-------------------

REASONING

Short: php is trying to store the upload in the wrong place

Long:
I run a virtual server and have control over the whole machine - therefore can muck about with php.ini. YMMV.
Inside administrator/components/com_installer/admin.installer.php, Joomla tries to use the element "[tmp_name]" in a variable called $userfile.

Turns out $userfile[tmp_name] is nil. _But_ there is an error code stored in the error element. Error 6 - missing temp folder. A look at php.ini shows the upload_tmp directive commented out, which should have it use the system /tmp folder, but it doesn't.

adding the directive, "upload_tmp_dir = /tmp" gives php a place to actually store the upload, and thus a place to copy the upload from - to the media dir.


Hope it Helps!
'Brian
www.modernbrainiac.com
---


source http://forum.joomla.org/index.php/topic,34971.0.html

UnlimitedMB
10-31-2007, 12:34 AM
Do not create multiple threads on the same issue.
Threads merged.

We already have upload_tmp_dir set.
If the file your uploading is over 500kb its not allowed to upload via php.
You must upload it in the control panel or with ftp.

th2mods
10-31-2007, 12:46 AM
i created a new thread cause i didn't want to bump my own topic

@You must upload it in the control panel or with ftp.
i have been doing
my file is 552kb

UnlimitedMB
10-31-2007, 01:02 AM
Bumping means to make a nonsence post to bring your topic back to the top.
If your adding valid information its ok.

Creating a new topic which makes no sence out of the context of this thread is certainly not the right way to do it.

You are not uploading it in the control panel or ftp, you are uploading it with php through your website.

You wont be able to use that 552kb file unless joomla can read it from your directory and not as a php upload.

UnlimitedMB
10-31-2007, 02:32 AM
There are bugs in this component.

install.comprofiler.php
if(mkdir($mainframe->getCfg( 'absolute_path' ) . "/images/comprofiler/")) {

SHOULD BE

if(mkdir($mainframe->getCfg( 'absolute_path' ) . "/images/comprofiler")) {

This bug is repeated in other functions eg file_exists but does not error on this, however its still incorrect use.

You do NOT include a trailing / when performing any directory operation.

Attached is the fixed com_comprofiler.zip which will install successfully :)
This proves its a joomla bug and not ulmb.

th2mods
10-31-2007, 02:43 AM
i will try it through FTP right now, i have already tried it through the CP though

UnlimitedMB
10-31-2007, 02:56 AM
Also this is related to a php bug.
http://bugs.php.net/bug.php?id=42739

They say its fixed in the next version which is not released yet.

th2mods
10-31-2007, 03:21 AM
i used your version of the file, i understand what you mean, but i still get this
Failed to create directory "/hosted/subs/ulmb.com/a/d/advertise/public_html/components/com_comprofiler/"

i looked through the code myself, and saw no
if(mkdir($mainframe->getCfg( 'absolute_path' ) . "/components/com_comprofiler/")) {

th2mods
10-31-2007, 03:38 AM
so im trying to install another one, to see what happens, and so i can use it. and i get this error....
"/hosted/subs/ulmb.com/a/d/advertise/public_html/components/com_akocomment_se/"

UnlimitedMB
10-31-2007, 03:58 AM
unzip com_comprofiler.zip and its in install.comprofiler.php line 262.
Yeah i think all the modules have the same bug.

Unzip it, edit the install.xxxxx.php, search for mkdir (there are 2 lines).
Zip it back up and upload.

I only tried with 1.5 RC3

th2mods
10-31-2007, 11:11 PM
but what does this have to do with my error for "Failed to create directory" and the /media erorr? if(mkdir($mainframe->getCfg( 'absolute_path' ) . "/images/comprofiler/gallery")) {

th2mods
11-03-2007, 03:37 AM
i really need this working...

UnlimitedMB
11-03-2007, 03:58 AM
Unless you are willing to modify the code as i showed you its not going to work until php 5.2.5 is released.

th2mods
11-03-2007, 04:38 AM
i modified the code exactly as you told me, it did not work, i also tried the .zip you gave me

UnlimitedMB
11-03-2007, 05:25 AM
Well it worked for me.
Ive already spent time looking through the code and try to help you.
Im not sure what more you want.

Either do without it or wait for next version of php with the fix.

th2mods
11-03-2007, 05:33 AM
you said you tried this on what joomla version again?

UnlimitedMB
11-03-2007, 05:41 AM
1.5 RC3. could you not scroll up?

th2mods
11-03-2007, 05:44 AM
i remembered seeing it somewhere, but then i looked for it and didn't see it.

im using Joomla! 1.0.13 Stable

UnlimitedMB
11-03-2007, 05:45 AM
Well thats it then.
They probably already fixed this bug in the latest version.
You should upgrade.

th2mods
11-03-2007, 06:11 AM
it works on 1.5 rc3, meh i have to do it al over again. thank you for your time

th2mods
11-03-2007, 06:14 AM
just one more thing to get it working, i dont see what i need to change in this to solve this error: Failed to create directory "/hosted/subs/ulmb.com/a/d/advertise/public_html/test/components/com_comprofiler/plugin/user/plug_cbconnector/"

<?php

/**

* @package CB connector

* @version 2

* @copyright (C) 2005, 2006, 2007 gatenet.nl, and Greg Effland

* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU/LGPL

* @description This file includes the install message and handles upgrades from phpBB Connector

*/



function plug_cbconnector_install() {

global $database ;

$basePath = dirname( __FILE__ );

$sameDBCheck = true;

require_once($basePath."/cbcheader.php");

require_once($basePath."/databasefunctions.php");

$sql = "SHOW COLUMNS FROM #__comprofiler LIKE 'cb_phpbbid'";

$results = getDBlist($sql, $database);

$return = CBCheader();

if (count($results)>0) {

//phpbb connector must have been previously installed

echo "<a>phpBB Connector has been previously installed... Converting cb_phpbbid field to cb_forumid (CB Connector format)</a><br>";

//copy cb_phpbbid to cb_forumid

//then delete the cb_phpbbid column

//assuming cb_forumid is new lets drop that column and rename the cb_phpbbid to cb_forumid

$sql = "SHOW COLUMNS FROM #__comprofiler LIKE 'cb_forumid'";

$results = getDBlist($sql, $database);

if (count($results)>0) {

$sql = "ALTER TABLE #__comprofiler DROP COLUMN cb_forumid";

insertDB($sql, $database);

echo "<a>cb_forumid field dropped (so it can rename cb_phpbbid)</a><br>";

}

$sql = "ALTER TABLE #__comprofiler CHANGE cb_phpbbid cb_forumid varchar(255)";

insertDB($sql, $database);

$return .= "<a>cb_phpbbid field renamed to cb_forumid</a><br>";

//cleanup jos_comprofiler_fields

$sql = "DELETE FROM #__comprofiler_fields WHERE name='cb_phpbbid'";

insertDB($sql, $database);

$return .= "<a>comprofiled_fields table cleaned up</a><br>";

$return .= "<b><a>Upgrade Completed Successfully!</a></b><br>";

}

if ($sameDBCheck) {

//do check for phpbb_users table

$return .= "";

}

$return .= "<hr><br><b>CB Connector installed correctly!</b>";

return $return;

}

?>

th2mods
11-04-2007, 12:18 AM
dude?? i cant find the code i need to edit in the above message

UnlimitedMB
11-04-2007, 01:32 AM
The code which creates the directory is not in the code you quoted.

th2mods
11-04-2007, 02:31 AM
thats the "install.cbconnector.php"

UnlimitedMB
11-04-2007, 02:48 AM
wait for php 5.2.5.
im not going to do free programming work.

th2mods
11-04-2007, 02:53 AM
when will that be? when did the current version come out?

th2mods
11-04-2007, 03:14 AM
one more simple thing, i get have this error on something else, it displayes on my homepage, its annoying
Warning: ob_implicit_flush() has been disabled for security reasons in /hosted/subs/ulmb.com/a/d/advertise/public_html/test/libraries/joomla/cache/handler/callback.php on line 98

UnlimitedMB
11-04-2007, 03:49 AM
Edit callback.php and change ob_implicit_flush to @ob_implicit_flush