Project:Support desk/Archives/PHP/001

= 2006 =

(RESOLVED) Add Groups
Does simply adding a group in LocalSettings.php cause MediaWiki to allow users to be added?


 * Yes. 86.138.46.182 17:32, 20 May 2006 (UTC)

And how to add a group? I can't find anything about adding groups to mediawiki.


 * I found that you can add groups simply by creating permissions for them in localsettings.php. For example entering:

"$wgGroupPermissions['internaluser']['read']  = true;"
 * Will create the group "internaluser", and also provide them with read access.


 * This is not very correct. It's correct that this way a user group "internaluser" is created. But this group has the user rights of the standard group "user" as well, so you don't need to give them read access additionally – except when you denied read access to the standard "user" group (which is not very senseful :-) ). If you want to give standard users less rights than they have in a standard installation, but to have special users who have these rights again, first deny the right to the "user" group, then give the right back to the special group, e. g.:

$wgGroupPermissions['user']['createpage']  = false; $wgGroupPermissions['internaluser']['createpage'] = true;
 * At least this is the way how it works in my 1.9.x installations. Regards -- 89.55.176.121 08:15, 14 June 2008 (UTC)

(RESOLVED) Going direct to Edit page when article does not yet exist from link or search
Just set up a new Wiki last week, and during initial customization I found instructions on how to configure it to automatically bring up an edit page with text editor whenever a page is not found. Sounded efficient, so I did it. Since our users are all Wiki Newbies, it turned out not to be so good an idea, after all, but now I can't find the instructions in order to set it back! I would have sworn this info was in the FAQ, but during install and setup I was bouncing back and forth between meta, here, and some third-party sites trying to figure out what to do next, so I could very well be wrong. Can someone please tell me how to set this feature back to the default, and perhaps it should be included in the faq. Thanks.


 * It's ; remove the override line from LocalSettings.php or set it to false. robchurch | talk 12:57, 13 July 2006 (UTC)

(RESOLVED) Protect Namespace
Only sysops can add pages to Mediawiki namespace. Is it possible to create new namespace, where only sysops will have permission in adding and editing pages? Or change preferences for existing namespace, i.e. Help: ?
 * Setting user rights in MediaWiki and Hidden pages. Seb35 16:38, 28 June 2006 (UTC)

Thanks for fast answer! I've never use and don't know php language, but I found in includes/Title.php this code: if( NS_MEDIAWIKI == $this->mNamespace &&		   !$wgUser->isAllowed('editinterface') ) { wfProfileOut( $fname ); return false; } I copied it again, and changed NS_MEDIAWIKI in i.e. 100 - number of my custom namespace. And it works! - Only sysops can add and edit pages in this namespace, but everyone can read it. I would like to ask you - is it good and safe solution? 21:35, 28 June 2006 (UTC)


 * Yes, but you will lose the change when you next upgrade your copy of MediaWiki, unless you take care. Make sure you note the changes you have made to a separate (new) file so that you can re-apply them after an upgrade. Also be sure to lock your wiki when you perform an upgrade, otherwise there will be a period of time between upgrading to the new version and re-applying your fix when these pages will be editable by everyone! Note that subsequent versions of MediaWiki may not work in the same way, so your fix is not guaranteed to work in the future, however I don't know of any method of achieving the above using the existing settings so unless I am mistaken then hacking the code is the best way, for now.   --HappyDog 12:12, 29 June 2006 (UTC)

= 2007 =

(RESOLVED) Change the value of $wgLogo to point to the URL of your own logo image does not work.
I changed the URL to point my Logo.jpg but it only shows on random pages.

88.115.194.214 12:00, 27 November 2007 (UTC)


 * Reconfigure your localsettings file. --' Truetech    (Talk)  ''  04:04, 12 August 2008 (UTC)

= 2008 =

(OUTDATED) Need help: PHP has encrusted an Access violation at 01EDAE66

 * MediaWiki: ?
 * PHP: 5.2.1
 * MySQL: 5.0.27
 * URL: http://cstx.gov/intranet

PHP has encrusted an Access violation at 01EDAE66

web sever: Microsoft-IIS/5.0

Dear friends,

I am a new mediawiki administrator, the previous one installed it and left. the wiki is set as a intranet site. recently, our wiki is down so often with error message "PHP has encrusted an Access violation at 01EDAE66", I searched google, mediawiki sites for several days, but did not have any clue. any body has the same experience? any suggestion is appreciated!

Thanks.

Susan


 * That's a system crash which probably means PHP or IIS is not configured or set up properly --Nad 09:38, 8 February 2008 (UTC)


 * We installed other components in e107 with wiki together, including Forum, call serivces, etc, it works fine, they are installed in a same server with same PHP and IIS setting, this problem happens just on WIKI. Could you please give me more detail information, or I have to reinstall php, wiki? appreciate.--Susan9508 14:15, 8 February 2008 (UTC)

(RESOLVED) PHP problems, possibly doe to the way I have to edit the software

 * MediaWiki: 1.11.1
 * PHP: 5.1.4 (cgi-fcgi)
 * MySQL: 5.0.45-log
 * URL: WikiVerse Might have to use this one

I have a Wiki that I wanted to add a user group to. After a considerable amount of confusion about LocalSettings.php, I decided to just try it, and revert the changes if it failed. What ended up happening was the group was successfully created, but it added repeated lines of "Warning: Cannot modify header information - headers already sent by (output started at /home/content/g/a/e/gaeamil/html/wikiverse/LocalSettings.php:2) in /home/content/g/a/e/gaeamil/html/wikiverse/includes/WebResponse.php on line 10". Also, no redirects work. I don't know about page redirects, but neither an edit nor typing in the URL without the whole ?title= bit allows you to reach a page. The second link above can send you right to the main page. I reverted every edit, and tried replacing WebResponse.php with a fresh version just downloaded from here, even though I never edited it. It may be caused by the fact that I have not found a way to replace files on my server without first deleting the old copy, thus making a gap which could have messed up the Wiki. I really wish I had editing capabilities, but I do not. Can someone help me get my wiki back to the way it was? Thank you.

—204.132.36.104 06:53, 15 February 2008 (UTC) &mdash;(Gaeamil, not logged in.)


 * This can be due to a space or a line break at the start of your LocalSettings.php, that will start the output and disallow any newer header to be send, be sure that there is no space nor line break (and maybe no BOM caracter). i Alex  20:09, 15 February 2008 (UTC)


 * Also spaces at the end after the ?> will cause that problem, it's best to simply remove the ?> completely. --Nad 21:25, 15 February 2008 (UTC)


 * I'll try these. When I downloaded the file, however, the line break was already there.  Maybe it's my download algorithm or something stupid like that.  Or perhaps I hit enter and never realized.
 * OK, now it says "Parse error: syntax error, unexpected $end in /home/content/g/a/e/gaeamil/html/wikiverse/LocalSettings.php on line 126", but when I look at the file, there is no "$end". -- Gaeamil --204.132.36.53 23:03, 15 February 2008 (UTC)


 * Could you please paste lines 124-126 of your LocalSettings.php file here? I'm guessing it is due to some syntax error. --Skizzerz talk - contribs [[Image:Tournesol.png|20px]] MediaWiki Support Team  15:56, 17 February 2008 (UTC)


 * I'll see... I use Notepad to edit it, and it doesn't split the lines very well.  I'll just re-upload the LocalSettings file and link it, OK? LocalSettings, directly copied from the wiki--204.132.36.53 00:28, 18 February 2008 (UTC)

Wait, you use Notepad to edit the file? That may explain your issues then. Notepad usually adds a BOM character, which messes up the PHP file. Try using a different text editing program (I use Notepad++, but it's up to you really) and see if that helps. --Skizzerz talk - contribs  MediaWiki Support Team  01:04, 18 February 2008 (UTC)
 * Er, I don't have another. Perhaps I could use a Hex editor.  It shows the ASCII version...  I just need to know what needs to be done to get this back to how it was before.--Gaeamil --204.132.36.53 01:43, 18 February 2008 (UTC)
 * Notepad++ is downloadable here, or if you can't/don't want to download and install a new program, Windows WordPad does not attach BOMs to files. Also, you will need to use a hex editor to remove the BOM from the file. --Skizzerz talk - contribs [[Image:Tournesol.png|20px]] MediaWiki Support Team  04:06, 18 February 2008 (UTC)
 * OK, so you know, I truly have no clue what I'm doing here. Is it possible to just get someone to fix the file, or at least give me a full step-by-step? --Gaeamil--204.132.36.104 07:27, 18 February 2008 (UTC)

Had a new idea: I deleted and reinstalled the Wiki software. Dirty, but effective. --Gaeamil--204.132.36.47 23:38, 1 March 2008 (UTC)

(RESOLVED) Setting header 
how can I set 

so Internet explorer will see there is feeds on my site?

--194.182.67.194 12:51, 20 February 2008 (UTC)  mgrabovský  | talk  (DJ Jeri)   MW Support Team  13:48, 21 February 2008 (UTC)
 * Just copy copy the code from User:DJ Jeri/LinkTag to the file named LinkTag.php, then save it to your extensions directory and at the end of your LocalSettings.php add following line:

(RESOLVED) Generating New Pages with PHP Script

 * MediaWiki: 1.11.1
 * PHP: 5.2.0
 * MySQL: 5.0.26
 * URL: http://playground.bradley.edu/wiki/

I need to create a batch of new pages using data from a separate MySQL database. I have a script that extracts the appropriate data and creates the wikitext, but I don't know of a way to create new pages other than copying and pasting the wikitext into the web interface. Is there a way to create new pages via PHP scripting?

Thanks. —98.214.108.155 02:01, 25 February 2008 (UTC)


 * Yes, but you will probably have to write a bot. See Wikipedia:Creating a bot for different frameworks, including one in PHP.  Mønobi 03:14, 25 February 2008 (UTC)


 * Pywikipediabot's pagefromfile.py script can do exactly this; http://botwiki.sno.cc or sourceforge.net should have info or a downloadable copy. --Carlb 01:15, 26 February 2008 (UTC)


 * Hello. If I had to create, say, 15 or 1500 pages, I would do this directly by MySQL. The procedure ist not so difficult, you have to use the INSERT syntax two times:
 * INSERT INTO text SET old_text = "..... put here your new text (which may not contain double quotes) ...";
 * INSERT INTO page SET page_title = "..... put here your page title ...";
 * YOU NEED: SSH access, MySQL access.
 * First make a copy / dump of the database. (I can do all this for you if you want me to.)
 * Question in return: Does email notification work?? --Detlef Lindenthal 20:30, 26 February 2008 (UTC)

(RESOLVED) Pages imported by ImportTextFile.php NOT searchable

 * MediaWiki: 1.8.3
 * PHP: 5.2.0
 * MySQL: 5.0.27
 * URL:

I am using ImportTextFile.php to import a number of pages and they show up in Recent Changes.

But if I do a search on some text that I know is in the pages, the results are NOT showing them.

Is there a way that I can ensure that these pages are also searchable?

Thanks.

—68.147.72.69 06:34, 15 March 2008 (UTC)


 * Run the updateSearchIndex.php maintenance script. Emufarmers 02:23, 21 March 2008 (UTC)

That didn't work for imported pages as these pages were not selected during the run of the updateSearchIndex.php. The problem seems to be in the SELECT statement in updateSearchIndex.inc where "iaisrecentchanges" and "iaispage" tables are matched up to find the pages to be updated. The original SELECT statement is SELECT ... FROM $recentchanges JOIN $page on    rc_cur_id=page_id AND rc_this_oldid=page_latest and since an imported page has a clean slate of attributes, they are NOT selected.

Looking at the actual attributes in the imported pages, rc_last_oldid is always set to 0, thus by changing the SELECT statement to SELECT ... FROM $recentchanges JOIN $page on     rc_cur_id=page_id AND (rc_this_oldid=page_latest OR rc_last_oldid=0) then those imported pages are also selected.

I also believe that newer versions of mediawiki might have fixed this.

68.147.72.69 16:21, 25 March 2008 (UTC)

(RESOLVED) $wgShowExceptionDetails
Hello, i'm the administrator of spiriwiki.com and have a problem with the on the right. I get the error:

Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information.

But.. I already did that. Still i got this error ?!? Great thanks. —Spiriwiki.com 09:41, 26 March 2008 (UTC)
 * Have you tried Clearing your browsers cache? 172.212.163.21 16:52, 28 March 2008 (UTC)

(RESOLVED) Using deleteOldRevisions.php
It took me a while, but I finally figured out how to use this:
 * Run PuTTY
 * cd yourdomain
 * cd yourwikidirectory
 * cd maintenance
 * If you're using php5 then type in:  /usr/local/php5/bin/php deleteOldRevisions.php --delete
 * If you're using php4 then you can just type: php deleteOldRevisions.php --delete

This procedure will work for all of the scripts in the maintenance directory. Make sure you download and look at the script before running it to see if it has any notes or usage guidelines. David Shenk 18:30, 23 March 2007 (UTC)

(OUTDATED) Error using $wgWhitelistRead
Dear,

My MediaWiki is function, but I need to restricted access to other users. Using $wgWhitelistRead I could do it but my main page isn't load with anonymous access. Ps. my main page are in portuguese name "Página principal" and these (I think) it's my problem.

Juliana Calado —200.195.42.2 16:32, 23 April 2008 (UTC)

(RESOLVED) Permission to show recent Changes for anonymous users

 * MediaWiki: 1.12.0
 * PHP: 5.2.0-8+etch10 (apache2handler)
 * MySQL: 5.0.32-Debian_7etch5-log
 * URL: BromWiki

Hi Folks,

I have just upgraded my old 1.4 mediwiki to the recent version 1.12.0 and still having some minor troubles to fully understand the new user permission system. I have left most permission to the default settings. My changes in the LocalSettings.php are as followed: $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['user']['edit'] = false; $wgGroupPermissions['emailconfirmed']['edit'] = true; $wgGroupPermissions['sysop']['edit'] = true; /** Show the amount of changed characters in recent changes */ $wgRCShowChangedSize			= false;
 * 1) Restrict editing by all non-sysop users

My question: How can I get anonymous users to see the recent changes ? When I log in, I can see them, but a default visitor sees nothing.

I did not change the DefaultSettings.php, so $wgGroupPermissions['*'   ]['read']            = true;

is still the rule. Which variable do I have to change ?  THX allready in advance, Timm from germany

—85.216.119.59 17:19, 28 April 2008 (UTC)


 * Although I do not know exactly what you have to change, I went to your site. On the recent changes page, there was the text "Below are the last 0 changes in the last 0 days."  So somewhere it's set to show the 0 most recent changes.  And so it does. Clicking "show last 50", for example, causes the changes to appear. Smaug  [[Image:Tournesol.png|20px]] 20:51, 28 April 2008 (UTC)


 * Hi Smaug, THX for your answer
 * Maybe I did not express exactly what I meant. I know of course that button, but is there a variable where I can set that default value to for instance 7 days ? If I remember correctly in the older versions by clicking on the "recent changes" button as a anonymous user the wiki has allways shown the changes of the last week. A lot of those folks who are visiting my wiki are not very familiar with this software. And if they just click "recent changes" and see nothing, they leave. I have checked the manual here allready but I cannot find any that helps.
 * Timm


 * Hi to all, I found the solution. One needs to edit the LocalSettings.php and add the following lines:

$wgDefaultUserOptions = array( 	'rcdays' 		=> 7, 	'rclimit' 		=> 50, );
 * Greetings, Timm
 * --85.216.119.59 16:41, 29 April 2008 (UTC)

(RESOLVED) White screen of death

 * MediaWiki: 1.12
 * PHP: 5.1.6-15 el5
 * MySQL: 5.0.22
 * URL:

I am getting a whitescreen when I finished installing the DB and copied the Localsetting.php file. I am Running RHEL 5.1, have installed the MySQL and PHP through YUM installer, have also installed dotproject, working fine except when the php is used?

I am suspecting the php is at fault but is new to it so can't exactly say what is cooking there.

PLEASE CAN ANYONE HELP?

THANKS! —165.146.96.91 08:13, 9 May 2008 (UTC)


 * You probably have a PHP error. You can check the PHP logs of your webserver or turn on the display_errors PHP setting to figure out what the error is.  See Manual:Errors and Symptoms for more information.  --Cneubauer 19:43, 2 June 2008 (UTC)

(RESOLVED) I accidentally deleted the LocalSettings.php folder
Hi, I accidentally deleted the LocalSettings.php folder, and I think that's why that I can't replace the Media Wiki image on the top left corner... How can I get it back?

I changed it on the /includes/common/images/wiki.png and doesn't do anything.
 * I wonder if your wiki will do anything if you have deleted LocalSettings.php? --89.55.165.22 06:16, 17 May 2008 (UTC)


 * LocalSettings.php is a file, not a folder. Do you mean you deleted the folder it was in? I'm not going to try it out, but I think if a wiki has no LocalSettings.php it will not work.  Anyway, if you are missing a LocalSettings.php and it's not in the folder where it is supposed to be, I guess I would say just download a new one. Smaug  [[Image:Tournesol.png|20px]] 18:24, 17 May 2008 (UTC)

(RESOLVED) How to force all users to use the monobook style

 * MediaWiki: 1.11
 * PHP: 5.2.3
 * MySQL: 5.0.41

Hi there I was wondering if there's an easy way to force all users to use the monobook style, making impossible for them to change the style at the user's preferences. Leaving the style as it's defined in the LocalSettings.php file. Thanks in advance. —Juanan 22:40, 26 May 2008 (UTC)


 * Put some thing like

$wgSkipSkins = array("chick", "cologneblue", "myskin", "nostalgia", "simple", "standard");

into LocalSettings.php, with all the skins included in the array aside from monobook skins. Then users won't have any other option. Smaug  20:36, 27 May 2008 (UTC)

(RESOLVED) Must be logged in to edit pages. How?
How do I set my wiki so that guests can't edit the pages. They must be logged in. —The preceding unsigned comment was added by 203.9.156.1 (talk • contribs) 23:44, 28 May 2008 (UTC). Please sign your posts with ~ !


 * See Manual:Preventing access. Regards -- 89.55.190.92 08:08, 29 May 2008 (UTC)

(OUTDATED) no Starter StartProfiler.php

 * MediaWiki: 1.12.0
 * PHP: 5
 * MySQL: 4

In this release package there is no Starter StartProfiler.php, I had to download it from SVN. —24.180.104.11 18:49, 1 July 2008 (UTC)

(RESOLVED) Error Message with LocalSettings.php

 * MediaWiki: 1.12.0
 * PHP:
 * MySQL:
 * URL: Test Wiki

Whenever I change LocalSettings.php to install extensions, change the logo, or enable uploading, my wiki stops loading and instead gives me this error message:

Error, Setup.php must be included from the file scope, after DefaultSettings.php.

The only way to undo this is to delete LocalSettings.php and recreate it, or re-upload it from the backup on my computer. And the main point of my wiki is to test new wiki coding and extensions.

—68.38.50.111 01:59, 24 July 2008 (UTC)

Either reinstall the wiki or get your own domain name. Free hostings are usually a bad idea for wiki sites because a lot of problems occur. --' Truetech    (Talk)  ''  03:36, 12 August 2008 (UTC)

(RESOLVED) Lifetime of wgUser (and similar globals)

 * MediaWiki: 1.12.0
 * PHP: 5.2.5 (cgi-fcgi)
 * MySQL: 5.0.24-community-nt

When is $wgUser defined? I'd like to be able to access it in LocalSettings.php to conditinally enable some extensions, but get an error when I attempt to use it ("not an object"). Is there an alternative way to check the wgUser and conditionally include/require/enable an extension based, for example, on what group the user is in? Thanks!

—Aldaron 20:00, 27 July 2008 (UTC)
 * $wgUser, like all others global objects, is defined in includes/Setup.php which is included after LocalSettings.php. Extensions can use rights to allow only some users to use them though. <font color="#66A7CC">i <font color="#9966CC">Alex  19:19, 3 August 2008 (UTC)


 * Thanks, that's what seemed to be happening. I'm missing how to determine what rights the current user has without having $wgUser defined. How would I go about determining that in LocalSettings.php? --Aldaron 17:47, 4 August 2008 (UTC)
 * Try prowling in includes/defaultsettings.php file. --'<font face="freestyle script"> Truetech  <font face="Imapct">  (Talk)  ''  03:26, 12 August 2008 (UTC)

(RESOLVED) How can I make DefaultSettings.php to Localsttings.php?
I have a question: How can I make DefaultSettings.php to Localsttings.php?
 * You can't. They are two totally different system files. BAD idea to alter. --'<font face="freestyle script"> Truetech  <font face="Imapct">  (Talk)  ''  04:06, 12 August 2008 (UTC)