Welcome Guest, Not a member yet? Register   Sign In
  Setting baseURL in Registrar not working
Posted by: petewulf1 - Yesterday, 03:20 AM - Replies (1)

Hey guys,
the registrar does not seem to work (at least for me). I followed th documentation and set it up like so:
-------------------

Code:
<?php

namespace Config;

class Registrar{

  public function __construct(){
    defined('LOCATION') || define('LOCATION', $_SERVER['CI_ENVIRONMENT']);
    }

  public static function App(): array{
     
    $conf = [];
    $conf['baseURL'] = 'http://192.168.0.1:81/'; 
    if(LOCATION == 'staging') $conf['baseURL'] = 'http://mydomain.com/';

    return $conf;

    }
  }
---------------------

I always get the error 
Fatal error: Uncaught CodeIgniter\Exceptions\ConfigException: Config\App::$baseURL "/" is not a valid URL. in ...\vendor\codeigniter4\framework\system\HTTP\SiteURI.php:201

Autodiscovery is set to true.
Its only workig if a manually set the baseURL in App.php but the URL should be set dynamically based on the environment. CI3 was way more comfortable and dynamic to set up.
Anybody knows the problem?

Thanks and kind regards,
Daniel


  Sessions old files are deleted
Posted by: Stord1980 - 05-11-2025, 11:31 PM - Replies (1)

Currently, within the Session library when using file - we see CI_Session_files_driver::read taking up to 120s to process 
Sessions old files are deleted but after some time I see still see these performance issues on requests tracked in NewRelic where it takes 100-120s


  Update from 4.6.0 to 4.6.1 failed
Posted by: Vespa - 05-11-2025, 07:13 AM - Replies (7)

I got in trouble with latest update...it's my fault for sure but each update it's a pain.
I run composer update to update new files...then I downloaded the latest package and manually replaced the following files in the project space:

Code:
app/Config/Autoload.php

app/Config/Cache.php

app/Config/DocTypes.php

app/Config/Mimes.php

app/Config/Modules.php

app/Config/Optimize.php

app/Config/Paths.php

app/Views/errors/html/debug.css

preload.php

public/index.php

spark

Now, when I try to run spark serve file I got the follwoing error:
Code:
PHP Warning:  require(D:\_GAVS_nuovo_sito\project-root\app\Config/../../system/Boot.php): Failed to open stream: No such file or directory in D:\_GAVS_nuovo_sito\project-root\spark on line 85

Warning: require(D:\_GAVS_nuovo_sito\project-root\app\Config/../../system/Boot.php): Failed to open stream: No such file or directory in D:\_GAVS_nuovo_sito\project-root\spark on line 85
PHP Fatal error:  Uncaught Error: Failed opening required 'D:\_GAVS_nuovo_sito\project-root\app\Config/../../system/Boot.php' (include_path='.;C:\php\pear') in D:\_GAVS_nuovo_sito\project-root\spark:85
Stack trace:
#0 {main}
  thrown in D:\_GAVS_nuovo_sito\project-root\spark on line 85

Fatal error: Uncaught Error: Failed opening required 'D:\_GAVS_nuovo_sito\project-root\app\Config/../../system/Boot.php' (include_path='.;C:\php\pear') in D:\_GAVS_nuovo_sito\project-root\spark:85
Stack trace:
#0 {main}
  thrown in D:\_GAVS_nuovo_sito\project-root\spark on line 85

Honestly I have no idea what I did wrong...any hint or help? Thanks a lot


  Ajax post failing with TypeError
Posted by: PaulC - 05-10-2025, 06:25 AM - Replies (4)

I have defined the route and when I actually fire the JS I end up with the following: (CI 4.6.0, on FireFox). Is this a CI problem please?
{
    "title": "TypeError",
    "type": "TypeError",
    "code": 500,
    "message": "CodeIgniter\\HTTP\\Request::fetchGlobal(): Argument #3 ($filter) must be of type ?int, true given, called in /var/www/html/gnb/ci460/system/HTTP/IncomingRequest.php on line 714",
    "file": "/var/www/html/gnb/ci460/system/HTTP/RequestTrait.php",
    "line": 258,
    "trace": [
        {
            "file": "/var/www/html/gnb/ci460/system/HTTP/IncomingRequest.php",
            "line": 714,
            "function": "fetchGlobal",
            "class": "CodeIgniter\\HTTP\\Request",
            "type": "->"
        },
        {
            "file": "/var/www/html/gnb/ci460/app/Controllers/TheBigPicture.php",
            "line": 148,
            "function": "getPost",
            "class": "CodeIgniter\\HTTP\\IncomingRequest",
            "type": "->"
        },
        {
            "file": "/var/www/html/gnb/ci460/system/CodeIgniter.php",
            "line": 933,
            "function": "interact",
            "class": "App\\Controllers\\TheBigPicture",
            "type": "->"
        },
        {
            "file": "/var/www/html/gnb/ci460/system/CodeIgniter.php",
            "line": 507,
            "function": "runController",
            "class": "CodeIgniter\\CodeIgniter",
            "type": "->"
        },
        {
            "file": "/var/www/html/gnb/ci460/system/CodeIgniter.php",
            "line": 354,
            "function": "handleRequest",
            "class": "CodeIgniter\\CodeIgniter",
            "type": "->"
        },
        {
            "file": "/var/www/html/gnb/ci460/system/Boot.php",
            "line": 334,
            "function": "run",
            "class": "CodeIgniter\\CodeIgniter",
            "type": "->"
        },
        {
            "file": "/var/www/html/gnb/ci460/system/Boot.php",
            "line": 67,
            "function": "runCodeIgniter",
            "class": "CodeIgniter\\Boot",
            "type": "::"
        },
        {
            "file": "/var/www/html/gnb/ci460/public/index.php",
            "line": 56,
            "function": "bootWeb",
            "class": "CodeIgniter\\Boot",
            "type": "::"
        }
    ]
}


Question Website Traffic Drop After Migrating to Magento 2.4.7?
Posted by: pmkkgems - 05-10-2025, 01:25 AM - Replies (1)

Hi everyone,

I recently upgraded my eCommerce website, PMKK Gems, from an older version of Magento to Magento 2.4.7. While the website is now running faster and smoother, I’ve noticed a big drop in organic traffic since the update.

We kept all the product data, design, and most of the URLs the same during the migration. Still, the drop in traffic is worrying. I think it might be due to some SEO settings, URL changes, redirects, or some missed configuration during the process.

Has anyone else faced the same issue after moving to Magento 2.4.7?
What are the most common SEO mistakes during a Magento migration that can cause traffic to drop?

I’d really appreciate any help or suggestions.
Thanks in advance!


  CI4 Auto-Discovery not working on dedicated server (cpanel)
Posted by: cypressit - 05-09-2025, 08:56 AM - Replies (1)

I am working on a prototype using Modules. Everything is working fine in xampp on my windows desktop. When I deploy it to my dedicated server, it cannot find the routes

Folder structure
app
     Config
         Autoload
         Routes
cits
     Blog
          Config
               Routes
          Controllers
               Blog

FILES:

app\Config\Routes
----------------------------------------------------------
service('auth')->routes($routes);
$routes->get('/', 'Home::index');


app\Config\Autoload
---------------------------------------------------------
public $psr4 = [
    APP_NAMESPACE => APPPATH,
    'Config' => APPPATH . 'Config',
    'Cits\Settings' => ROOTPATH . 'cits\Settings',
    'Cits\Blog' => ROOTPATH . 'cits\Blog',
];

\cits\Blog\Config\Routes
---------------------------------------------------------
$routes->group("blog", ["namespace" => "\Cits\Blog\Controllers"], function ($routes) {
    $routes->get("/", "Blog::index");
});
Error I receive:  Can't find a route for 'GET: blog'.

Any idea why this is not working.


  Why PHP is still worth learning in 2025:By the numbers
Posted by: php_rocs - 05-09-2025, 05:13 AM - Replies (1)

Excellent read (Dev.to): https://dev.to/dehemi_fabio/why-php-is-s...mbers-20mc


  My Library cannot see session
Posted by: PaulC - 05-08-2025, 09:18 AM - Replies (2)

Hi Team, (having resolved helper issue) the debugging show one of my libraries cannot see the session.
I have loaded the library (Template) and the session in the BaseController ie

PHP Code:
<?php

namespace App\Controllers;

use 
CodeIgniter\Controller;
use 
CodeIgniter\HTTP\CLIRequest;
use 
CodeIgniter\HTTP\IncomingRequest;
use 
CodeIgniter\HTTP\RequestInterface;
use 
CodeIgniter\HTTP\ResponseInterface;
use 
Psr\Log\LoggerInterface;

/**
* Class BaseController
*
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
* Extend this class in any new controllers:
*    class Home extends BaseController
*
* For security be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
    /**
    * Instance of the main Request object.
    *
    * @var CLIRequest|IncomingRequest
    */
    protected $request;

    /**
    * An array of helpers to be loaded automatically upon
    * class instantiation. These helpers will be available
    * to all other controllers that extend BaseController.
    *
    * @var list<string>
    */
    protected $helpers = ['url''form''functions''time''myvalidate''debug'];

    /**
    * Be sure to declare properties for any property fetch you initialized.
    * The creation of dynamic property is deprecated in PHP 8.2.
    */
    public $session;
public 
$db;
public 
$smail;
public 
$ajax;
public 
$template;
public 
$get;
public 
$make;
public 
$delete;

    /**
    * @return void
    */
    public function initController(RequestInterface $requestResponseInterface $responseLoggerInterface $logger)
    {
        // Do Not Edit This Line
        parent::initController($request$response$logger);

        // Preload any models, libraries, etc, here.

        $this->session = \Config\Services::session();
$this->db = \Config\Database::connect();

$this->smail = new \App\Libraries\Smail();
$this->ajax = new \App\Libraries\Ajax();
$this->template = new \App\Libraries\Template();
$this->get = new \App\Libraries\Get();
$this->make = new \App\Libraries\Make();
$this->delete = new \App\Libraries\Delete();

    }

My controller calls the Template lib which in turn tries to access the session.
I appreciate the libs do not extend BaseController, but I was hoping $this->template and $this->session would be available to everything.
I'm sorry but I appear to be in a morasse of object inheritance and am not sure what to do to fix this?
The error thrown is: Undefined property: App\Libraries\Template::$session
The code snippet from my Template lib is;
PHP Code:
public function render($name$admin false)
    {
        $ip_address real_ip();

        if (!$this->session->get('view_site') || is_ip_blocked($ip_address)) {
            return;
        
Any pointers appreciated, thx, Paul


  update the framework to the latest version
Posted by: Erepaing - 05-07-2025, 11:31 PM - Replies (1)

I am in the process of updating my CodeIgniter framework from version 4.1.3 to 4.1.4. The process requires me to update incrementally, step by step for each version. I initially attempted to use the "composer update" command, however, it only updated the libraries and not the framework itself. As a result, I am searching for a solution to effectively update the framework to the latest version.


  MVC vs MVCS vs CodeIgniter
Posted by: FlavioSuar - 05-07-2025, 01:58 PM - Replies (2)

Hi,
Reading this post Better than MVC.
What do you think? 
I saw some messages about using CI that way and makes sense to me...

Cheers.


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Setting baseURL in Regist...
by michalsn
26 minutes ago
Update from 4.6.0 to 4.6....
by FlavioSuar
Yesterday, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM
intermittent smtp failure...
by InsiteFX
05-11-2025, 11:30 PM
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
05-10-2025, 10:33 AM
CodeIgniter Shield 1.0.0 ...
by timesprayer
05-10-2025, 05:22 AM
Website Traffic Drop Afte...
by InsiteFX
05-10-2025, 04:23 AM
Magic login link not work...
by InsiteFX
05-10-2025, 04:16 AM
Is codeigniter 5 upco...
by InsiteFX
05-10-2025, 04:10 AM

Forum Statistics
» Members: 145,845
» Latest member: ncatiorg
» Forum threads: 78,388
» Forum posts: 379,448

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB