Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What of the zillion programming languages is this - php? If yes, I believe session_start expects options, not session name as a parameter. Check whether the session is created successfully - whether session_start retuned true.
Also, be sure that you fully understand what "sessions" are, how they work, and how they are implemented.
Until you are absolutely clear on what is actually going on – when, and why – it can indeed be very confusing! So, let me try to explain:
A "session" is a host-side place where variable values can be stored between one HTTP request and the next. Once the session has been established on the host, the (random ...) "session-id" is communicated to the client side by means of an HTTP "cookie." In this way, it will be included in each subsequent request. Either the programming language or the web-site software takes care of the chore of making the session-variables available to you, and for storing the new values back in the persistent storage-area at the end of the request.
I know what sessions are and how to use them having used them thousands of times and have over 1 million lines of code written using them. That is why I can't understand why they are not working now. I'm using them on 2 CPUs 1.) Kubuntu 14.04 LTS, 2.) Kubuntu 18.04 LTS.
These calls are originating in the Enterprise Modules Framework, that I designed originally in 1994 and use on almost every PHP project I use/build since then, with over 2,000 projects completed deployed at over 5,000 companies, with no current errors; and now starting a new "data capture" project now.
The "em-dio.php" object (named for Enterprise Modules Data I/O) allows the seamless capture, exchange & transfer of data in any DB engine (yes all DB engines and all their calls work in this module). The "em-objects.php" initializes all the 32 plus EM Objects. Of course all are written to be compiled as PHP is 100% compilable!
You would know I'm correctly calling session_start. I still get the errors even without declaring the session name. Knowing your security for PHP you know you have to turn "globals" off, so sessions is the only secure way to share variables information between PHP files/modules you are using.
"em-obects.php" is this initiating code:
Code:
<?php
/***************************************************************************/
/* Classes: Analysis: em_analy, Archive: em_archv, */
/* Array Proc. em_aproc, Audit: em_audit, */
/* Communication: em_comms, Data Format: em_datfm, */
/* Data I/O: em_datio, Drivers(HAL): em_haldv, */
/* En/Decrypt, em_crypt, File System: em_flsys, */
/* Logic: em_logic, Math Basic, em_bmath, */
/* Math Advanced, em_amath, Networking: em_netwk, */
/* Notification em_notif, Scheduling, em_sched, */
/* Show: em_dshow, Security: em_secur, */
/* Standard I/O: em_stdio, Synching: em_synch, */
/* Translation: em_trans, Virtualization em_vertz. */
/***************************************************************************/
/* Notes: Enterprise Modules only uses the "Advanced Documentation */
/* Standard, which is shown here. Please following this std. */
/* when submitting extensions and enhancement to EM. */
/***************************************************************************/
/* Notes: The class modules for modularization purposes are only linked */
/* but not contained here. */
/***************************************************************************/
/* Mod by: Nyle E. Davis Mod Date: 18-03-06 */
/* Change: Class Adds */
/* Desc: The original 24 EM modules are documented above, but over time */
/* it was seen that these additional modules were needed. At the */
/* time of entry of this comment there are now 36 modules. */
/* Adv Arrays: em_adray, Backup: em_bckup, */
/* Collaboration, em_collb, Development: em_devlp, */
/* Engineering: em_engfc, Flow: em_flows, */
/* GIS, em_ginfo, Media, em_media, */
/* Presentation: em_prest, Rendering: em_rendr, */
/* Streaming: em_strem, Ver Control: em_versc, */
/***************************************************************************/
/* Mod by: Nyle E. Davis Mod Date: 18-03-10 */
/* Change: MVC Adds */
/* Desc: Added abstract classes to allow MVC processing for Enterprise */
/* Modules. ` */
/***************************************************************************/
//define ( 'PRUN_ME', 1 );
session_start ( );
include_once ('em_aproc/em_adray.php'); // Advanced Array Funtions
include_once ('em_analy/em_analy.php'); // Analisys/Analytics Funtions
include_once ('em_aproc/em_aproc.php'); // Array Processing Functions
include_once ('em_archv/em_archv.php'); // Archive/Compression Functions
include_once ('em_audit/em_audit.php'); // Audit Functions
include_once ('em_bckup/em_bckup.php'); // Backup/Disaster Recovery Functions
include_once ('em_collb/em_collb.php'); // Collaberation Functions
include_once ('em_comms/em_comms.php'); // Communitcation Functions
include_once ('em_crypt/em_crypt.php'); // EnCrypt/DeCrypt Functions
include_once ('em_datfm/em_datfm.php'); // Data Format Functions
include_once ('em_dio/em_dio.php'); // Data I/O Functions
include_once ('em_devlp/em_devlp.php'); // Development Functions
include_once ('em_dshow/em_dshow.php'); // Display/Show Functions
include_once ('em_engfc/em_engfc.php'); // Engineering Functions
include_once ('em_flows/em_flows.php'); // Functions for Flows
include_once ('em_flsys/em_flsys.php'); // File System Functions
include_once ('em_ginfo/em_ginfo.php'); // GIS Functions
include_once ('em_haldv/em_haldv.php'); // Driver Functions
include_once ('em_langs/em_langs.php'); // Languages Functions
include_once ('em_logic/em_logic.php'); // Logic Functions
include_once ('em_maths/em_amath.php'); // Advanced Math Funtions
include_once ('em_maths/em_bmath.php'); // Basic Math Functions
include_once ('em_media/em_media.php'); // Media Functions
include_once ('em_model/em_model.php'); // Modeling Functions
include_once ('em_netwk/em_netwk.php'); // Networking Functions
include_once ('em_notif/em_notif.php'); // Notification Functions
include_once ('em_rendr/em_rendr.php'); // Rendering Functions
include_once ('em_sched/em_sched.php'); // Scheduling Functions
include_once ('em_secur/em_secur.php'); // Security Functions
include_once ('em_seopr/em_seopr.php'); // SEO Proc Functions
include_once ('em_stdio/em_stdio.php'); // Standard I/O Functions
include_once ('em_strem/em_strem.php'); // Streaming Functions
include_once ('em_synch/em_synch.php'); // Synchronization Functions
include_once ('em_trans/em_trans.php'); // Translation Functions
include_once ('em_vectr/em_vectr.php'); // Vectoring Functions
include_once ('em_versn/em_versn.php'); // Version Control Functions
include_once ('em_virtl/em_virtl.php'); // Virtualization Functions
// Declarce Modules
class em_modules {
/************************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Declare the Emterprise Modules. */
/************************************************************************/
function __construct() {
/*********************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Open the Emterprise Modules. */
/*********************************************************************/
$em_modules = new em_modules();
// Reserved for adding individual models
} // end function __construct
} // end class em_modules
abstract class em_mvc_model {
/************************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Declare the Emterprics Module MVC Model method. */
/************************************************************************/
function __construct() {
/*********************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Open the Emterprise Module MVC Model method. */
/*********************************************************************/
$em_mvc_model = new em_mvc_model();
// Reserved for adding individual models
} // end function __construct
} // end class em_mvc_model
abstract class em_mvc_viewer {
/************************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Declare the Emterprise Module MVC Viewer method. */
/************************************************************************/
function __construct() {
/*********************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Open the Emterprise Module MVC Viewer method. */
/*********************************************************************/
$em_mvc_viewer = new em_mvc_viewer();
// Reserved for adding individual models
} // end function __construct
} // end class em_mvc_viewer
abstract class em_mvc_controller {
/************************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Declare the Emterprise Module MVC Controller method. */
/************************************************************************/
function __construct() {
/*********************************************************************/
/* Author: Nyle E. Davis Mod Date: 18-03-10 */
/* Desc: Open the Emterprise Module MVC Controller method. */
/*********************************************************************/
$em_mvc_controller = new em_mvc_controller();
// Reserved for adding individual models
} // end function __construct
} // end class em_mvc_controller
?>
All this code has been in use, without errors since inception and installed at over 5,000 companies we have supported for processing.
So now back to the question: Why is it not working now? I've been having Apache issues on the 18.04 LTS machine, so was developing on the 14.04 LTS machine.
I'm currently using cmd line for testing, but expect to be in the browser with final completion of the "screen" module. Getting these errors:
Code:
PHP Notice: A session had already been started - ignoring session_start() in /Syncs/Projects/EM/em_dio/em_dio.php on line 36
<pre>array(0) {
}
</pre>
PHP Notice: Undefined variable: emdir in /Syncs/Projects/EM/em_dio/em_dio.php on line 45
ED=> !PHP Notice: Undefined variable: emdir in /Syncs/Projects/EM/em_dio/em_dio.php on line 46
PHP Warning: include_once(/em_objects.php): failed to open stream: No such file or directory in /Syncs/Projects/EM/em_dio/em_dio.php on line 46
PHP Warning: include_once(): Failed opening '/em_objects.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /Syncs/Projects/EM/em_dio/em_dio.php on line 46
PHP Fatal error: Class 'em_modules' not found in /Syncs/Projects/EM/em_dio/em_dio.php on line 48
The latter errors are obvious, since the var "emdir" does not get set, the path to the file being called is the default path, not the declared path, thus those errors are caused by the path not being properly defined.
Now if you think I have a PHP config issue, which I suspect, let me know. Open to any other ideas also!
em-obects.php does start a session but since your test script has already started a session you see the "A session had already been started" error message. A session is created when using the command line but when starting a new session you need the old session ID to use the previously stored values. As posted sessions is a way to store information used across web pages not files/functions. When calling functions via the command line your back in the real world of variable scope.
I know what sessions are and how to use them having used them thousands of times and have over 1 million lines of code written using them. That is why I can't understand why they are not working now. I'm using them on 2 CPUs 1.) Kubuntu 14.04 LTS, 2.) Kubuntu 18.04 LTS.
These calls are originating in the Enterprise Modules Framework, that I designed originally in 1994 and use on almost every PHP project I use/build since then, with over 2,000 projects completed deployed at over 5,000 companies, with no current errors; and now starting a new "data capture" project now.
Well then you should be able to at least formulate a proper question with all required information and initial troubleshooting steps.
Or maybe your claims should be taken wtih a pinch of salt?
Also, are you running your servers of Kubuntu machines, i.e. desktop installs??? One of them EOL???
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.