0

for some reason my php script stops executing the php code after i state the session_start() action, This problem only occurs when i try to test it on a webserver (it works fine on xampp)

Here's a piece of the code: (Note in only works if i remove the session_start action.)

session_start(); 
//CODE STOPS HERE 
$date = date("Y-m-d"); 

if(isset($_SESSION['username'])) 
{ 
$username = ($_SESSION['username']); 

echo "<div id = 'registratie'> 
<form method='POST' action='register.php'> 


<h1>Registratie formulier</h>

this is the error i am getting: Fatal error: session_start(): Failed to initialize storage module: memcache (path: /tmp) in /home/builder/domains/site-builder.nl/public_html/clients/nm/stagiares/stageproj‌​ectotman/member.php on line 27

Line 27: session_start();
  • Do you know what the error is? Can you turn on error reporting? (use `ini_set('display_errors', 'On');`) – slugonamission Jun 16 '14 at 16:08
  • What is your PHP version? – Hristo Valkanov Jun 16 '14 at 16:10
  • this is the error i am getting: Fatal error: session_start(): Failed to initialize storage module: memcache (path: /tmp) in /home/builder/domains/site-builder.nl/public_html/clients/nm/stagiares/stageprojectotman/member.php on line 27 – user3745612 Jun 16 '14 at 16:10
  • Can we see line 27 of member.php? – dcclassics Jun 16 '14 at 16:13
  • Line 27 is the session_start(); action – user3745612 Jun 16 '14 at 16:15
  • possible duplicate of [session\_start(): Failed to initialize storage module: memcache (path: /var/lib/php5) in /usr/share/phpmyadmin/libraries/session.inc.php on line 81](http://stackoverflow.com/questions/21387375/session-start-failed-to-initialize-storage-module-memcache-path-var-lib-p) – slugonamission Jun 16 '14 at 16:18
  • You're not closing PHP properly with `$username = ($_SESSION['username']); echo "
    ` plus, a missing closing brace `}`
    – Funk Forty Niner Jun 16 '14 at 16:22
  • the script is being propperly closed. That is just a small part of the code you are seeing, i only showed the crucial part that is giving the error. – user3745612 Jun 16 '14 at 16:26
  • Does site-builder.nl allow you to have your own sessions? If not then you have to set up your own session handler. – beingalex Jun 16 '14 at 16:30
  • This is a server configuration issue, not a PHP issue. PHP is trying to store session data in memcache but there's a problem with your memcache config. To confirm, try changing your php.ini file on that server to use the 'files' save handler per https://php.net/manual/en/session.configuration.php – Dan Cowell Jun 16 '14 at 16:40
  • Is that the _only_ error message, or are you also getting messages about "headers already sent"? Before or after this error? – Phil Perry Jun 16 '14 at 18:01

1 Answers1

1

If you are using PHP7.0.0 on xampp you may try the below:

Note: Just search the below in your 'php.ini' file located at 'c:\xampp\php\php.ini' to fix the issue: (chage the value to 1 from 0)

use_only_cookies=1

Source: https://community.apachefriends.org/viewtopic.php?p=248070&sid=0b7559defe15317f41699d1ce9194e3f