Mediawiki, problems with Parsoids [duplicate] - php

A lot of people have the same error for many different reasons, so, after trying a composer update, I've tried to investigate it starting from the browser and reconstructing step by step what is happening. It's really hard for me and I would really appreciate help from a PHP Developer!
From Chrome Developer Tools I could find the Ajax request in the background and the called url on the server
By playing with the url I realized that changing the action name returned a different error code, which let me understand that the current call is just a generic API in the middle between the browser and whatever is "apierror-visualeditor-docserver-http"
The Ajax call
{mysite}
/ api.php
? action=visualeditor
& paction=parse
&page=Cosa_c%27%C3%A8_da_fare%3F
Example
https://www.tematichedigenere.com/api.php?action=visualeditor&paction=parse&page=Cosa_c%27%C3%A8_da_fare%3F
The response from the Ajax call
The serverside call to rest api
Then I can see from the Apache server's log that the api page contacts the following url (returning 500)
GET
//rest.php/
{mywebsiteurl}
/v3/page/html/
Cosa_c%27%C3%A8_da_fare%3F/27246
?redirect=false
&stash=true
example
"GET //rest.php/www.tematichedigenere.com/v3/page/html/Cosa_c%27%C3%A8_da_fare%3F/27246?redirect=false&stash=true HTTP/1.0" 500 5621 "-" "VisualEditor-MediaWiki/1.38.2"
Another example of log (returning 404)
{an IP} - -
[04/Dec/2022:14:16:12 +0000]
"POST
/rest.php/
{mywebsiteurl}/v3
/transform/html/to/wikitext
/Riflessioni_sulla_sessualizz._femm._collegate_-_bozza%2Fprova
HTTP/1.0"
404
467
"-"
"VisualEditor-MediaWiki/1.38.2 X-Middleton/1"
Maybe the initial double / is wrong?
Anyway if I call the uri directly from my browser https://tematichedigenere.com/rest.php/www.tematichedigenere.com/v3/page/html/Cosa_c%27%C3%A8_da_fare%3F/27246?redirect=false&stash=true
The server does a antirobot check but I'm not sure that was the problem.
I've realized that the 500 error code hides a more complex real error which is returned by accessing directly the url from the log.

As you say, the visualeditor API is mostly just a proxy to the Parsoid API. The double / is wrong (check your $wgVirtualRestConfig settings maybe), I don't think it actually matters though. The error sounds like you are using incompatible library versions - make sure MediaWiki core and the VisualEditor extension are for the same release, and that the parsoid Composer library is up to date.
Update from OP:
the issue was solved. I simply had to delete the folder /vendor/wikimedia/parsoid and copy it from the fresh install. I couldn't see there were disalignment because of a problem in the compare tool. I got a lot of help in the IRC channel (not in Phabricator and not in Mediawiki forums, it seems IRC is really helpful for MW products).

Related

Django GUnicorn in production is calling setup.php

I was checking my logs with supervisor and I got this
Not Found: /phpmyadmin/scripts/setup.php
WARNING:django.request:Not Found: /phpmyadmin/scripts/setup.php
does someone know why this is trying to reach a php file?
I'm running django 11.06 with gninx and gunicorn.
Consider this as a request from a random client or an automated bot for finding any vulnerability or something; logs showing 404 is not bad as long as your URL config does not match the request anyway

CakePHP : REST API 404 Error

I have build a REST server and trying to make my java application communicate to it.
But I keep getting a 404 error.
When I type in the url in my browser along with the function name like:
[url]/controller/functionname/1.json
it works fine, returning me the right data.
Without the function name:
[url]/controller/1.json
I get this error:
"action 1.json not defined in controller".
I've checked my .htaccess file and routes against a previous version I had build which was working just fine. I can't figure out what the problem might be. Any suggestions?
And oh, I should mention, the earlier version that I talked about was build on windows and this one on ubuntu.

Symfony2 app.php receiving POST request as GET app_dev.php works fine

So I'm creating a route that requires posting. The route is as follows:
my_route:
path: /myroute/login
defaults: { _controller: "MyBundle:Default:login"}
methods: [POST]
So I use postman to hit app_dev.php/myroute/login and I get the correct response that I am looking for, currently the page just returns "hello world". Now when I change postman to just hit app.php/myroute/login I get an error saying:
The server returned a "405 Method Not Allowed".
I'm really confused as to why it says method not allowed so I tailed the prod.log file and got the following:
Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: "No route found for "GET /myroute/login": Method Not Allowed (Allow: POST)"
I'm sending the requests in postman as POST requests but somehow symfony is only seeing them as GET requests. Again I can change the url to app_dev.php/myroute/login and hit send and it works. I thought it was a caching issue so I tried the following to clear the caches:
$ php app/console cache:clear --env=prod --no-debug
This still doesn't clear my problem so I even removed all the files from app/cache/prod as well. I can't find anyone having issues that are similar to this so I'm hoping someone can point me in the right direction. I also thought it might be
After some more digging I discovered what the issue was. So I thought that maybe it was postman that was sending the incorrect method so I googled around for that which lead to this
Postman sending POST as GET
which lead to a question about htaccess files:
Redirect POST htaccess
So first off I set postman to hit app.php/myroute/login and xdebug showed the request method as GET. I moved the .htaccess file and hit the same url and the request method showed up as POST. Instead of hitting that url I moved my .htaccess file back and pointed at just /myroute/login and everything lit up. This was an extremely annoying exercise so I hope that this will save someone else in the future looking for the same problem.
for me the case was my mistake, i.e. i was sending to http instead of https

how to configure facebook api in localhost in xampp or wamp server? what is php.ini settings requirement to use it?

I m new to use of facebook api after some googling i found facebook api from this link:
https://github.com/facebook/facebook-php-sdk
after download this package i try to execute example code from this package but it returns an error like:
Fatal error: Uncaught CurlException: 6: Could not resolve host: graph.facebook.com; Host not found thrown in D:\xampp\htdocs\testing\phpdemo\fb\src\base_facebook.php on line 994
to solve this problem i try too much googling but i doesnt get positive result from there.
If anybody know what kind of possibilities for this problem then please help.
here is may be two posibilities like:
1) Do you have any firewalls? The problem is not about configuration is just CURL can't do requests to graph.facebook.com and possible any website. Try disable any firewalls that may be blocking your CURL requests
2) From my experience you can't use facebook APi local, however they have a free host provider,Heroku, try it. Also don't forget to replace YOUR_APP_ID and YOUR_APP_SECRET with your app Data.
You can get help here,https://stackoverflow.com/questions/16294630
From my experience you can't use facebook APi local, however they have a free host provider,Heroku, try it.
Also don't forget to replace YOUR_APP_ID and YOUR_APP_SECRET with your app Data.

Soap error when trying to use the API of Magento

I am looking for help with this problem and I hope someone give me that help. The error is the following:
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://example.com/index.php/api/?wsdl' : failed to load external entity "http://example.com/index.php/api/?wsdl" in
/var/www/presentacion/app/code/local/Pengo/Extension/Model/Something.php on line 28
And the code that I'm using to connect to it is something like this:
$this->_soap = new SoapClient(http://example.com/index.php/api/?wsdl);
and there is where it says is the error.
I have been serching in Google, PHP forums, here in StackOverflow and Magento itself but I don't find the solution anywhere.
What I had seen is that the WSDL is never get parsed or loaded as the error says and none of its functions.
I tried connecting like this:
$options['location'] = http://example.com/index.php/api/?wsdl;
$options['uri'] = 'urn:Magento';
$this->_soap = new SoapClient(null, $options);
like this it doesn't dispatch any error like the others but there aren't functions to use, like in the other case it doesnt' load and parse the WSDL.
I am a bit frustrated because I have been developing this like 1 month and now that I am making some tests it shows this message, I had test it when it was really empty and new and it worked fine.
So any help would be appreciated.
Thank you.
Nine times out of ten this error is Magento is telling you it can't load the WSDL file. Magento is telling you this. It's not your local client code that's complaining.
Magento uses the PHP SoapServer object to create its SOAP API. The SoapServer object needs to access the WSDL as well. Try running the following from your server's command line
curl http://example.com/index.php/api/?wsdl
If I'm right, the above will timeout/fail.
Because of some quirks in DNS, it's surprisingly common that a server won't be able to access itself via its domain name. If this is the case, the quickest fix is adding an entry to the server's hosts file. (Talk to your server admin if none of that made sense)
Well after all the things that I test the only one that worked for me, I don't know why but it worked, was doing this in two separate machines. I tried that because I read that somewhere and I just do it and my Magento and Webservice now works perfectly. Whenever I try to do this local it dispatch the same error.
I hope this can help someone in the future and they don't have to knock their head on the wall because of this problem.
Thank you all for your answers and comments.
Alan Storm is right on the Money here!
Make sure that you check your server Hosts File, and that it includes an entry for both domain and www.domain. Espicialy important if you are doing server rewrites.

Categories