Forum

Thread tagged as: Problem, Error

Error creating page that already exists

Hello,

Whenever I try to create a page in the admin area that I have already added to the project in code, I am getting the error "Sorry, that page could not be created."

  1. The page I created is the archive.php example from here: https://github.com/PerchCMS/PerchExample-rachelandrew_me/blob/master/blog/archive.php and I put it inside my /blog folder.

  2. Then in the admin area I go to add page and use the following:

- Page title: Archive - Navigation text: Archive - File name: /blog/archive.php - Parent page: Top level - Master page: Page already exists, or is a link only

Then on Submit I get the error mentioned above.

My DEBUG output

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='0e44bfcd5aae32b6d5ce77c020834e21' LIMIT 1
UPDATE perch2_users SET userHash='1a7e5e7ea051adc50977b373eb5b4fb1' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT *, (LENGTH(templatePath) - LENGTH(REPLACE (templatePath, "/", ""))) AS depth FROM perch2_page_templates ORDER BY depth, templatePath ASC
SELECT * FROM perch2_pages WHERE pageID=31 LIMIT 1
SELECT * FROM perch2_pages WHERE pageID='0' LIMIT 1
SELECT * FROM perch2_pages WHERE pageID='0' LIMIT 1
INSERT INTO perch2_pages(pageTitle,pageNavText,pageParentID,templateID,pageNew,pageCreatorID,pageModified,pageAttributes,pageDepth,pagePath) VALUES('Archive','Archive','0','',1,'1','2015-08-15 11:53:49','','1','/blog/archive.php')
Invalid query: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'templateID' at row 1
Setting alert: Sorry, that page could not be created. (error)
SELECT p.*, (SELECT COUNT(*) FROM perch2_pages WHERE pageParentID=p.pageID) AS subpages FROM perch2_pages p ORDER BY pageTreePosition ASC
SELECT *, (LENGTH(templatePath) - LENGTH(REPLACE (templatePath, "/", ""))) AS depth FROM perch2_page_templates ORDER BY depth, templatePath ASC
Queries: 11
Memory: 3.0035

My Site's diagnostics:

Perch: 2.8.8, PHP: 5.6.11, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.8), assets (2.8.8), categories (2.8.8), perch_blog (4.6), perch_forms (1.8.3)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms' );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/myusername/Sites/mywebsitename/perch
PERCH_CORE: /Users/myusername/Sites/mywebsitename/perch/core
PERCH_RESFILEPATH: /Users/myusername/Sites/mywebsitename/perch/resources
Image manipulation: GD
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
Resource folder writeable: Yes
HTTP_HOST: lia.com
DOCUMENT_ROOT: /Users/myusername/Sites/mywebsitename
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Could you please with that?

Many thanks in advance.

Proko Mountrichas

Proko Mountrichas 3 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it still happen with the current version?

Hi Drew,

Yes, I updated to 2.8.11 and get the exact same behaviour.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure why that's happening for you and no one else, but I'll put some extra checks into the code to help prevent it for the next version.

Thanks Drew but I'm not the only one to have this problem. There is at least one more case :) Maybe you'll want to compare my logs with this one: https://forum.grabaperch.com/forum/02-03-2015-cannot-create-page-where-page-already-existsis-link-only?page=1#reply-22516

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's likely whatever configuration option is causing the problem causes it for you both. But not for many thousands of others. I'll still add the extra checks to try and prevent it, whether it's for one user or two.