session_start() fails

Need help installing Joomla! 3.x? For all Joomla! 3.x installation issues please use this forum.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

session_start() fails

Post by AWizard » Wed Oct 10, 2018 2:53 am

I am trying to install Joomla 3.8.12 on a Ubuntu 16.04 LTS.

I get the following message:
Warning: session_start(): Failed to read session data: user (path: /opt/lampp/php/sessiondata) in /opt/lampp/htdocs/libraries/joomla/session/handler/native.php on line 260
followed by:
Error: Failed to start application: Failed to start the session

I have searched the internet including this forum and found that it might be caused by header already being sent or by lack or valid permission to the session data directory so I added the following code to native.php where the error is occuring.
echo get_current_user().":\r\n";
echo session_save_path().":\r\n";
file_put_contents(session_save_path().'/test','Test');
$header = (headers_sent($file, $line)?"Header sent in file ".$file." on ".$line:"Header not sent");

This adds output to the error as follows:
kevin: /opt/lampp/php/sessiondata: Header not sent

The user ought to be www-data according to the apache2 envvars file which has:
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

I have looked at the session path and found that the file created by the third line is indeed created so there is not a permissions problem for this user.

The forth line I think validates that the header has not already been sent.

Can anyone think of anything else that would prevent session_start() from working?

Incidentally, a session file is created in the session path whenever I start phpmyadmin or any other php application that I have written.

Many thanks for any help you may be able to give me.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 24795
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: session_start() fails

Post by Per Yngve Berg » Wed Oct 10, 2018 1:07 pm

Please post the FPA

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails

Post by AWizard » Wed Oct 10, 2018 11:29 pm

I would post the FPA if I knew how to. The instructions on the site are not clear to me and has loud disclaimers shattering any confidence in its ability let alone that it might stuff up my system.

I can advise that I am running PHP version 7.2.3 which seems to be a bit behind but not that much. Please let me know if I can provide any more information or tell me how I can get this FPA working.

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails FPA

Post by AWizard » Thu Oct 11, 2018 12:19 am

Last PHP Error(s) Reported :: Forum Post Assistant (v1.4.5 (Ganymede)) : 11th October 2018 wrote:[10-Oct-2018 14:19:44 Australia/Melbourne] PHP Warning: session_start(): Failed to read session data: user (path: /opt/lampp/php/sessiondata) in /opt/lampp/htdocs/libraries/joomla/session/handler/native.php on line 260
Forum Post Assistant (v1.4.5 (Ganymede)) : 11th October 2018 wrote:
Basic Environment :: wrote:Joomla! Instance :: Joomla! 3.8.12-Stable (Amani) 28-August-2018
Joomla! Platform :: Joomla Platform 13.1.0-Stable (Curiosity) 24-Apr-2013
Joomla! Configured :: Yes | Writable (777) | Owner: --protected-- . (uid: 1/gid: 1) | Group: --protected-- (gid: 1) | Valid For: 3.8
Configuration Options :: Offline: false | SEF: true | SEF Suffix: false | SEF ReWrite: false | .htaccess/web.config: No | GZip: false | Cache: false | CacheTime: 15 | CacheHandler: file | CachePlatformPrefix: false | FTP Layer: false | Proxy: N/A | LiveSite: https://www.a-wizard.com.au | Session lifetime: 15 | Session handler: database | Shared sessions: N/A | SSL: 2 | Error Reporting: default | Site Debug: false | Language Debug: false | Default Access: 1 | Unicode Slugs: false | dbConnection Type: mysqli | PHP Supports J! 3.8.12: Yes | Database Credentials Present: Yes |

Host Configuration :: OS: Linux | OS Version: 4.4.0-137-generic | Technology: x86_64 | Web Server: Apache/2.4.29 (Unix) OpenSSL/1.0.2n PHP/7.2.3 mod_perl/2.0.8-dev Perl/v5.16.3 | Encoding: gzip, deflate, br | Doc Root: --protected-- | System TMP Writable: Yes | Free Disk Space : 834.78 GiB |

PHP Configuration :: Version: 7.2.3 | PHP API: apache2handler | Session Path Writable: Yes | Display Errors: 1 | Error Reporting: 22527 | Log Errors To: /opt/lampp/logs/php_error_log | Last Known Error: 10th October 2018 14:19:44. | Register Globals: | Magic Quotes: | Safe Mode: | Open Base: | Uploads: 1 | Max. Upload Size: 128M | Max. POST Size: 128M | Max. Input Time: 60 | Max. Execution Time: 360 | Memory Limit: 256M

Database Configuration :: Connection Error: 1045:Access denied for user 'kneale'@'localhost' (using password: YES) : Database Credentials Present? in Configuration...
Detailed Environment :: wrote:PHP Extensions :: Core (7.2.3) | date (7.2.3) | libxml (7.2.3) | openssl (7.2.3) | pcre (7.2.3) | sqlite3 (7.2.3) | zlib (7.2.3) | bcmath (7.2.3) | bz2 (7.2.3) | calendar (7.2.3) | ctype (7.2.3) | curl (7.2.3) | dba (7.2.3) | dom (20031129) | hash (1.0) | fileinfo (1.0.5) | filter (7.2.3) | ftp (7.2.3) | gd (7.2.3) | gettext (7.2.3) | SPL (7.2.3) | iconv (7.2.3) | session (7.2.3) | intl (1.1.0) | json (1.6.0) | ldap (7.2.3) | mbstring (7.2.3) | standard (7.2.3) | mysqlnd (mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $) | mysqli (7.2.3) | PDO (7.2.3) | pdo_mysql (7.2.3) | pdo_pgsql (7.2.3) | pdo_sqlite (7.2.3) | Phar (2.0.2) | posix (7.2.3) | Reflection (7.2.3) | imap (7.2.3) | shmop (7.2.3) | SimpleXML (7.2.3) | soap (7.2.3) | sockets (7.2.3) | exif (7.2.3) | sysvsem (7.2.3) | sysvshm (7.2.3) | tokenizer (7.2.3) | wddx (7.2.3) | xml (7.2.3) | xmlreader (7.2.3) | xmlrpc (7.2.3) | xmlwriter (7.2.3) | xsl (7.2.3) | zip (1.15.2) | apache2handler () | Zend Engine (3.2.0) |
Potential Missing Extensions ::

Switch User Environment (Experimental) :: PHP CGI: No | Server SU: No | PHP SU: No | Custom SU (LiteSpeed/Cloud/Grid): No
Potential Ownership Issues: Maybe

Apache Modules :: core | mod_so | http_core | prefork | mod_authn_file | mod_authn_dbm | mod_authn_anon | mod_authn_dbd | mod_authn_socache | mod_authn_core | mod_authz_host | mod_authz_groupfile | mod_authz_user | mod_authz_dbm | mod_authz_owner | mod_authz_dbd | mod_authz_core | mod_authnz_ldap | mod_access_compat | mod_auth_basic | mod_auth_form | mod_auth_digest | mod_allowmethods | mod_file_cache | mod_cache | mod_cache_disk | mod_socache_shmcb | mod_socache_dbm | mod_socache_memcache | mod_dbd | mod_bucketeer | mod_dumpio | mod_echo | mod_case_filter | mod_case_filter_in | mod_buffer | mod_ratelimit | mod_reqtimeout | mod_ext_filter | mod_request | mod_include | mod_filter | mod_substitute | mod_sed | mod_charset_lite | mod_deflate | mod_mime | util_ldap | mod_log_config | mod_log_debug | mod_logio | mod_env | mod_mime_magic | mod_cern_meta | mod_expires | mod_headers | mod_usertrack | mod_unique_id | mod_setenvif | mod_version | mod_remoteip | mod_proxy | mod_proxy_connect | mod_proxy_ftp | mod_proxy_http | mod_proxy_fcgi | mod_proxy_scgi | mod_proxy_ajp | mod_proxy_balancer | mod_proxy_express | mod_session | mod_session_cookie | mod_session_dbd | mod_slotmem_shm | mod_ssl | mod_lbmethod_byrequests | mod_lbmethod_bytraffic | mod_lbmethod_bybusyness | mod_lbmethod_heartbeat | mod_unixd | mod_dav | mod_status | mod_autoindex | mod_info | mod_suexec | mod_cgi | mod_cgid | mod_dav_fs | mod_vhost_alias | mod_negotiation | mod_dir | mod_actions | mod_speling | mod_userdir | mod_alias | mod_rewrite | mod_php7 | mod_perl | Apache/2.4.29 (Unix) OpenSSL/1.0.2n PHP/7.2.3 mod_perl/2.0.8-dev Perl/v5.16.3 |
Potential Missing Modules :: mod_security | mod_evasive | mod_dosevasive | mod_qos | mod_userdir |
Folder Permissions :: wrote:Core Folders :: images/ (755) | components/ (755) | modules/ (777) | plugins/ (755) | language/ (755) | templates/ (755) | cache/ (755) | logs/ (777) | tmp/ (777) | administrator/components/ (755) | administrator/modules/ (755) | administrator/language/ (755) | administrator/templates/ (755) | administrator/logs/ (755) |

Elevated Permissions (First 10) :: modules/ (777) | modules/mod_articles_category/ (777) | modules/mod_articles_category/tmpl/ (777) | modules/mod_articles_news/ (777) | modules/mod_languages/ (777) | modules/mod_languages/tmpl/ (777) | modules/mod_syndicate/ (777) | modules/mod_syndicate/tmpl/ (777) | modules/mod_whosonline/ (777) | modules/mod_whosonline/tmpl/ (777) |
Extensions Discovered :: wrote:Components :: SITE ::
Core :: com_mailto (3.0.0) | com_wrapper (3.0.0) |
3rd Party::

Components :: ADMIN ::
Core :: com_templates (3.0.0) | com_config (3.0.0) | com_languages (3.0.0) | com_associations (3.7.0) | com_media (3.0.0) | com_ajax (3.2.0) | com_contenthistory (3.2.0) | com_redirect (3.0.0) | com_finder (3.0.0) | com_checkin (3.0.0) | com_login (3.0.0) | com_joomlaupdate (3.6.2) | com_modules (3.0.0) | com_banners (3.0.0) | com_installer (3.0.0) | com_messages (3.0.0) | com_cpanel (3.0.0) | com_menus (3.0.0) | com_postinstall (3.2.0) | com_fields (3.7.0) | com_admin (3.0.0) | com_plugins (3.0.0) | com_categories (3.0.0) | com_newsfeeds (3.0.0) | com_content (3.0.0) | com_users (3.0.0) | com_search (3.0.0) | com_cache (3.0.0) | com_tags (3.1.0) |
3rd Party::

Modules :: SITE ::
Core :: mod_articles_category (3.0.0) | mod_languages (3.5.0) | mod_whosonline (3.0.0) | mod_syndicate (3.0.0) | mod_articles_news (3.0.0) | mod_articles_archive (3.0.0) | mod_custom (3.0.0) | mod_breadcrumbs (3.0.0) | mod_articles_popular (3.0.0) | mod_banners (3.0.0) | mod_menu (3.0.0) | mod_related_items (3.0.0) | mod_random_image (3.0.0) | mod_wrapper (3.0.0) | mod_footer (3.0.0) | mod_feed (3.0.0) | mod_stats (3.0.0) | mod_login (3.0.0) | mod_articles_categories (3.0.0) | mod_finder (3.0.0) | mod_users_latest (3.0.0) | mod_tags_popular (3.1.0) | mod_articles_latest (3.0.0) | mod_tags_similar (3.1.0) | mod_search (3.0.0) |
3rd Party:: MOD_EASYFILEUPLOADER (2.7.8) | Unite Nivo Slider (2.0.2) | JComments Latest (3.0.4) |

Modules :: ADMIN ::
Core :: mod_logged (3.0.0) | mod_stats_admin (3.0.0) | mod_quickicon (3.0.0) | mod_status (3.0.0) | mod_custom (3.0.0) | mod_popular (3.0.0) | mod_menu (3.0.0) | mod_latest (3.0.0) | mod_feed (3.0.0) | mod_login (3.0.0) | mod_toolbar (3.0.0) | mod_sampledata (3.8.0) | mod_multilangstatus (3.0.0) | mod_submenu (3.0.0) | mod_title (3.0.0) | mod_version (3.0.0) |
3rd Party::

Plugins :: SITE ::
Core :: plg_system_languagecode (3.0.0) | plg_system_updatenotification (3.5.0) | plg_system_cache (3.0.0) | plg_system_sessiongc (3.8.6) | plg_system_remember (3.0.0) | plg_system_redirect (3.0.0) | plg_system_stats (3.5.0) | plg_system_logout (3.0.0) | plg_system_p3p (3.0.0) | plg_system_debug (3.0.0) | plg_system_languagefilter (3.0.0) | plg_system_sef (3.0.0) | plg_system_highlight (3.0.0) | plg_system_log (3.0.0) | plg_system_fields (3.7.0) | plg_twofactorauth_totp (3.2.0) | plg_twofactorauth_yubikey (3.2.0) | plg_quickicon_phpversioncheck (3.7.0) | plg_quickicon_extensionupdate (3.0.0) | plg_quickicon_joomlaupdate (3.0.0) | plg_extension_joomla (3.0.0) | PLG_INSTALLER_FOLDERINSTALLER (3.6.0) | plg_installer_packageinstaller (3.6.0) | PLG_INSTALLER_URLINSTALLER (3.6.0) | plg_content_emailcloak (3.0.0) | plg_content_pagenavigation (3.0.0) | plg_content_joomla (3.0.0) | plg_content_vote (3.0.0) | plg_content_pagebreak (3.0.0) | plg_content_finder (3.0.0) | plg_content_loadmodule (3.0.0) | plg_content_fields (3.7.0) | plg_editors-xtd_menu (3.7.0) | plg_editors-xtd_module (3.5.0) | plg_editors-xtd_image (3.0.0) | plg_editors-xtd_pagebreak (3.0.0) | plg_editors-xtd_readmore (3.0.0) | plg_editors-xtd_article (3.0.0) | plg_editors-xtd_fields (3.7.0) | plg_finder_categories (3.0.0) | plg_finder_content (3.0.0) | plg_finder_newsfeeds (3.0.0) | plg_finder_tags (3.0.0) | plg_finder_contacts (3.0.0) | plg_search_categories (3.0.0) | plg_search_content (3.0.0) | plg_search_newsfeeds (3.0.0) | plg_search_tags (3.0.0) | plg_search_contacts (3.0.0) | plg_captcha_recaptcha (3.4.0) | plg_authentication_gmail (3.0.0) | plg_authentication_ldap (3.0.0) | plg_authentication_cookie (3.0.0) | plg_authentication_joomla (3.0.0) | plg_fields_textarea (3.7.0) | plg_fields_imagelist (3.7.0) | plg_fields_sql (3.7.0) | plg_fields_media (3.7.0) | plg_fields_text (3.7.0) | plg_fields_list (3.7.0) | plg_fields_calendar (3.7.0) | plg_fields_integer (3.7.0) | plg_fields_color (3.7.0) | plg_fields_usergrouplist (3.7.0) | plg_fields_radio (3.7.0) | plg_fields_checkboxes (3.7.0) | plg_fields_url (3.7.0) | plg_fields_editor (3.7.0) | plg_fields_user (3.7.0) | plg_user_profile (3.0.0) | plg_user_joomla (3.0.0) | plg_user_contactcreator (3.0.0) |
3rd Party:: plg_editors_codemirror (5.38.0) | plg_editors_tinymce (4.5.8) |
Templates Discovered :: wrote:Templates :: SITE :: protostar (1.0) | beez3 (3.1.0) |
Templates :: ADMIN :: hathor (3.0.0) | isis (1.0) |

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9810
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK
Contact:

Re: session_start() fails

Post by toivo » Thu Oct 11, 2018 6:47 am

Your site seems to be up and running, which means that you must have fixed the database credentials, which caused the error.

There are some issues, though:
- none of the core folders should be world writable, '777', use '755'
- JComments is out of date

You can get rid of 'index.php' in the URLs by using the .htaccess file and enabling SEF URLs: https://docs.joomla.org/Enabling_Search ... _on_Apache

If you have not done it already, update Joomla to 3.8.13.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
troubleshooting smtp and other articles https://talikka.com/joomla

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails

Post by AWizard » Thu Oct 11, 2018 6:35 pm

Thank you for checking this but the site is not yet up and running. I still get the same message when I try to run it either by putting 127.0.0.1 or localhost in the address bar of a browser on the server or by putting https://33837eac.ngrok.io/index.php in the address bar of any other computer on the internet.

This message is shown as the Last PHP Error(s) Reported in the FPA posted above. The first item in the report and I am unable to get past it.

Yes, I agree about the world writable state but at this stage I am just trying to eliminate all possible points of failure and for some reason Joomla is not using the www-data user properly yet.

And yes, I will use SEF URSs and update to 3.8.13 as soon as I can get the site up and running.

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9810
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK
Contact:

Re: session_start() fails

Post by toivo » Thu Oct 11, 2018 7:23 pm

Is the FPA extracted from a totally different website, not https://www.a-wizard.com.au, hosted at GoDaddy? See the image below. Are you perhaps in the process of migrating the site to Amazon AWS?

You should remove the domain name from the variable $live_site in the file configuration.php. It can be used only in particular circumstances, otherwise it causes issues. A real domain record in a DNS system needs to point to the IP address of the web server hosting the site.

Database Configuration :: Connection Error: 1045:Access denied for user 'username'@'localhost' (using password: YES)
You need to fix the above database connection error. The database username and password in the file configuration.php need to match the database username and password of your database schema, as configured in the database server.
You do not have the required permissions to view the files attached to this post.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
troubleshooting smtp and other articles https://talikka.com/joomla

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails

Post by AWizard » Thu Oct 11, 2018 8:07 pm

Hello Toivo. Yes, I am investigating running the site from my own computer but so far have not been able to get the port forwarding working so am using ngrok tunneling. It works fine if I go to my own applications such as https://33837eac.ngrok.io/FileWitch/LogonForm.php so now I just need to get Joomla working the same way.

I have commented out the live_site variable and changed the database access to JoomlaUser with an updated password. However, I still get the same message.

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9810
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK
Contact:

Re: session_start() fails

Post by toivo » Thu Oct 11, 2018 9:05 pm

AWizard wrote:I am investigating running the site from my own computer but so far have not been able to get the port forwarding working
Your ISP may have something to say about port forwarding. Have you checked their Terms Of Service? The architecture may suit low traffic but supporting it requires expertise in comms protocols and iptables, among other things.

AWizard wrote:...so now I just need to get Joomla working the same way.
If I were you, I would first worry about connecting to the database. I hope you have not modified any core files of Joomla.

AWizard wrote:I have ... changed the database access to JoomlaUser with an updated password.
It is not clear what exactly you mean. The user credentials set up in phpMyAdmin, or some other MySQL client or a utility in the cPanel provided by your host, are independent from the Joomla user credentials, maintained in the table #__users in the User Manager. The credentials set for your database schema need to match the username and password in the file configuration.php. In addition, the database host is probably 'localhost', assuming that the web server acts as the database server, and the database name must exist, too.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
troubleshooting smtp and other articles https://talikka.com/joomla

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails

Post by AWizard » Thu Oct 11, 2018 10:07 pm

Hi Toivo. I cant really verify the database connection until I get past this session_start() issue. As I said, I have changed the database access in configuration.php and copied the generated password from MySQL into that same config table. I would need to download and run the FPA again to verify that the database access works.
Anyway, the entries in the configuration.php are:
public $dbtype = 'mysqli';
public $host = 'localhost';
public $user = 'joomlauser';
public $password = 'theGeneratedMySQLPassword4Joomla';
public $db = 'joomla';
The only change I have made to core joomla php files is the one I mentioned at the beginning to verify that there was no issue with headers having already been sent or file access permissions. Those changes have now been removed.


Post Reply

Return to “Installation Joomla! 3.x”