Jo J
Members-
Posts
46 -
Joined
-
Days Won
1
Jo J last won the day on September 30 2024
Jo J had the most liked content!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Jo J's Achievements
Jr. Member (3/6)
33
Reputation
-
No problem.👍
-
I'm just guessing based on the error messages...it looks like PHP is encountering something unexpected before headers are sent. Other things to check between old & new host: compare php.ini (or your host's PHP config phprc); .htaccess (or nginx.conf); charset headers (ensure its UTF-8)
-
You might have a whitespace (BOM) at the top of your config.php. Do you have anything to check it (like a hexdump)?
-
That looks like maybe your config.php has something encoded in line 1 that's invisible?
-
Have you tried clearing the /site/assets/cache folder too? Or maybe even redoing the mysql excluding the caches table (edit: but include its structure--just not the data).
-
I moved the pages out of under the Admin level & to the normal Pages level. and this worked: public function init() { parent::init(); $this->addHookAfter('Pages::saved', $this, 'redirectAfterSave'); } public function redirectAfterSave(HookEvent $event) { $page = $event->arguments[0]; if($page->template->name === self::module_template) { $app_url = $this->config->urls->admin . 'myapp/'; $this->wire('session')->redirect($app_url); } } I need to do more reading on the Admin mechanics.
-
I've created a process module that saves pages under the Home > Admin > MyPages level in the admin. The module has a list of those pages created with links to allow further editing via PW's normal Page Edit. Upon clicking it, the form opens for editing. To stay away from the Admin territory (hidden by default), I'd like to redirect back to the module's home after saving my edits but am not successful so far. I've been trying a bunch of ways I see here in the forum & the docs. Among some that do not appear to trigger (from my ProcessMyApp.module.php) are: 1) Derived from my understanding of API doc init() { parent::init(); //$this->wire()->processPageEdit->setRedirectPath('/myapp/'); $this->wire()->processPageEdit->setRedirectUrl($this->config->urls->admin . '/myapp/'); } 2) Derived from Ryan's /site/modules/RedirectPageEdit.module here init() { parent::init(); $this->wire()->session->addHookBefore('redirect', $this, 'redirectAfterSave'); } 3) Also derived from my understanding of API doc init() { parent::init(); $this->wire()->addHookAfter('ProcessPageEdit::processSaveRedirect' , $this, 'redirectAfterSave'); } The redirectAfterSave: public function redirectAfterSave(HookEvent $event) { $process = $event->object; $page = $process->getPage(); bd($event,'Tracy no see'); if($page->template->name === self::module_template) { $event->arguments = array($this->config->urls->admin . 'myapp/'); } } What could I be overlooking? Tried in Processwire 3.0.243 & 3.0.244
-
@Dave NicholsI too am not clear, but if you want to remove anchor tags from a body I would do something like this: in ready.php wire()->addHookBefore('Pages::saveReady', function(HookEvent $event) { $page = $event->arguments(0); if ($page->name == 'parent-name') { $body = $page->body; // Use regex to remove anchor tags but keep the inner text $bodyWithoutAnchors = preg_replace_callback( '/<a[^>]*>(.*?)<\/a>/is', // Match <a> tags with content function ($matches) { return $matches[1]; // Return the inner text }, $body ); // Update the page body if ($body !== $bodyWithoutAnchors) { $page->body = $bodyWithoutAnchors; } } }); Backup your database & test with care as the above pattern will unlink ALL "<a>" tags. you may want to adjust the pattern to the children accordingly.
-
Jo J started following How to deal with video in 2025 and Creating 20 million pages
-
Can anyone advise / assist with a site recovery?...
Jo J replied to creativeguy's topic in General Support
If you have access to a front-end template or a script that can execute PHP within your ProcessWire environment...add this code temporarily. echo wire('config')->urls->admin; This will output the admin URL, e.g., websiteurl.com/processwire/. -
@bernhardIn this test, I didn't want to install benchmark tools, so I just used PHP (code below) with the following results: test 1) Elapsed Processwire Boot time Apache/2.4.62: 0.1405s Page load time: 6.53 ms Database query time: 0.5 ms Memory used: 325.21 KB Elapsed Processwire Boot time nginx/1.26.1: 0.1175s Page load time: 4.68 ms Database query time: 0.65 ms Memory used: 256.13 KB test 2) Elapsed Processwire Boot time Apache/2.4.62: 0.2145s Page load time: 6.42 ms Database query time: 0.45 ms Memory used: 325.21 KB Elapsed Processwire Boot time nginx/1.26.1: 0.1512s Page load time: 4.86 ms Database query time: 0.64 ms Memory used: 256.13 KB test 3) Elapsed Processwire Boot time Apache/2.4.62: 0.1809s Page load time: 48.97 ms Database query time: 0.7 ms Memory used: 325.21 KB Elapsed Processwire Boot time nginx/1.26.1: 0.0909s Page load time: 4.65 ms Database query time: 0.64 ms Memory used: 256.13 KB <?php $home = $pages->get('/'); /** @var HomePage $home */ $start_time = microtime(true); $start_memory = memory_get_usage(); $start_query_time = microtime(true); $pages = $pages->find("template=basic-page"); $query_time = microtime(true) - $start_query_time; ?> ?><!DOCTYPE html> <!-- STANDARD >main.php body--> <?php $end_time = microtime(true); $page_load_time = $end_time - $start_time; $end_memory = memory_get_usage(); $memory_used = $end_memory - $start_memory; $elapsed = Debug::stopTimer($timer, 's'); // Debug::startTimer in index.php ?> <div> <p>Elapsed Processwire Boot time <?php echo $_SERVER['SERVER_SOFTWARE'] . ': ' . $elapsed ?><br> Page load time: <?php echo round($page_load_time * 1000, 2); ?> ms<br> Database query time: <?php echo round($query_time * 1000, 2); ?> ms<br> Memory used: <?php echo round($memory_used / 1024, 2); ?> KB</p> </div> </body> </html> Breakdown of results: Elapsed ProcessWire Boot Time: NGINX consistently shows lower boot times, indicating it may handle PHP requests more efficiently than Apache in this test case. Page Load Time: The page load time in the third test for Apache (48.97 ms) is an anomaly I can't explain. Caching? Network latency? Database Query Time: Apache and NGINX have similar query times Memory Used: Memory usage is relatively low, and the difference between the two servers is not substantial.
-
Just wondering, if access to PHP files other than index.php in the site root is blocked (e.g., via the PW default .htaccess in the root), wouldn't this suggest that any .htaccess rules in a module subdirectory (like abc.om/site/modules/Module-name/.htaccess) would not have any effect on the overall operation of your ProcessWire site in Apache?
-
Wow good point. From here on, it might be wise to check if a module has its own htaccess file. I haven't come across one yet.
-
Undefined array key "SCRIPT_NAME" in wire/core/ProcessWire.php on line 1175
Jo J replied to kylxbn's topic in General Support
I vaguely recall this happening to me too. But that was a while back for me to know how it got fixed. Have you tried checking your httpHosts in config is complete? $config->httpHosts = array('localhost','yourdomain.com') or ensure you have the correct index.php & .htaccess that goes with ProcessWire 3.0.229?