xampp-protable requires all php code on the same drive?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

xampp-protable requires all php code on the same drive?

Postby Peter Fu » 02. March 2013 13:56

Hi,

I just come across a strange problem today using xampp-portable (1.8.1). In php files which are not on the same drive of xampp-portable installation, it cannot access PHP Session.

My xampp-portable is installed at D:\Soft\xampp-portable, and my DocumentRoot is C:\www.

I put two files a.php and b.php in C:\www.

a.php
Code: Select all
<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);

// this starts the session
session_start();
// this sets variables in the session
$_SESSION['color']='red';
$_SESSION['size'] ='small';
$_SESSION['shape']='round';
echo "Done";

echo "Our color value is ".$_SESSION['color'];
echo "Our size value is ".$_SESSION['size'];
echo "Our shape value is ".$_SESSION['shape'];
?>


b.php
Code: Select all
<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);

// this starts the session
session_start();

$_SESSION['color']='green';

// echo variable from the session, we set this on our other page
echo "Our color value is ".$_SESSION['color'];
echo "Our size value is ".$_SESSION['size'];
echo "Our shape value is ".$_SESSION['shape'];
?>


Output of a.php
Code: Select all
 Warning: session_start(): open(\Soft\xampp-portable\tmp\sess_ihp85uslaj309f6ll21uipnc82, O_RDWR) failed: No such file or directory (2) in C:\Users\Peter\Documents\workspace-sts-3.1.0.RELEASE\test-session\a.php on line 6
DoneOur color value is redOur size value is smallOur shape value is round


Output of b.php
Code: Select all
Warning: session_start(): open(\Soft\xampp-portable\tmp\sess_ihp85uslaj309f6ll21uipnc82, O_RDWR) failed: No such file or directory (2) in C:\Users\Peter\Documents\workspace-sts-3.1.0.RELEASE\test-session\b.php on line 6
Our color value is green
Notice: Undefined index: size in C:\Users\Peter\Documents\workspace-sts-3.1.0.RELEASE\test-session\b.php on line 12
Our size value is
Notice: Undefined index: shape in C:\Users\Peter\Documents\workspace-sts-3.1.0.RELEASE\test-session\b.php on line 13
Our shape value is


After I moved DocumentRoot from C:\www to D:\www, everything goes well.

So I guess all web directories must be on the same drive where xmapp-portable is installed. Is that true?

Thanks,
Peter
User avatar
Peter Fu
 
Posts: 2
Joined: 02. March 2013 13:46
Operating System: Windows 7

Re: xampp-protable requires all php code on the same drive?

Postby Altrea » 02. March 2013 14:44

Hi Peter,

Peter Fu wrote:After I moved DocumentRoot from C:\www to D:\www, everything goes well.

So I guess all web directories must be on the same drive where xmapp-portable is installed. Is that true?

The path where the session files will be created is defined in your \xampp\php\php.ini file in the session.save_path property.

Have you changed any other settings exept the DocumentRoot?

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: xampp-protable requires all php code on the same drive?

Postby Peter Fu » 03. March 2013 09:13

Hi Altrea,

My xampp installation is D:\Soft\xampp-portable.

The session.save_path is the default value as following, I didn't change that.
Code: Select all
session.save_path = "\Soft\xampp-portable\tmp"


I created a VirtualHost using the following configuration.
Code: Select all
<VirtualHost dev.peterfu-localhost.com:80>
    ServerAdmin peter.fu@activecollabmod.com
    DocumentRoot "C:/Users/Peter/Documents/workspace-sts-3.1.0.RELEASE"
    ServerName dev.peterfu-localhost.com
    ##ServerAlias www.dummy-host.localhost
    ##ErrorLog "logs/localhost-error.log"
    ##CustomLog "logs/localhost-access.log" combined
   
   <Directory "C:/Users/Peter/Documents/workspace-sts-3.1.0.RELEASE">
      Require all granted
      AllowOverride All
      Options Indexes FollowSymLinks Includes ExecCGI
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>


Other configuration is not touched.

Edit 1:
I can confirm that the session values are actually written. Because after a.php is executed, there's a file created at D:\Soft\xampp-portable\tmp\sess_ihp85uslaj309f6ll21uipnc82. Content as following.
Code: Select all
color|s:3:"red";size|s:5:"small";shape|s:5:"round";size|s:5:"small";


So I think it just cannot read those values.

Thanks,
Peter
User avatar
Peter Fu
 
Posts: 2
Joined: 02. March 2013 13:46
Operating System: Windows 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 132 guests