Cannot Seem to get php.ini to Work - AppEngine - php

I can't seem to get the Google App Engine to recognize my php.ini custom file as documented here.
I'm getting the error (within the logs of my app) where php_sapi_name() is disabled for security reasons by Google. However, it also states it can re-enabled with google_app_engine.enable_functions.
So my php.ini looks like this:
;enables function disabled by Google
google_app_engine.enable_functions = "php_sapi_name, php_uname"
Yet even after I add and upload the php.ini file, it shows the same error for newer requests. I did also browse my code through the App Engine dashboard to check to see whether the php.ini file was updated, and it was.
Any pointers would be much appreciated.

Depending on how you upload, there is a chance that this creates a new Application version for your specific app.
If it does this, you won't see the change, because the default version won't change, so you're still hitting the old version, even if the console shows you the most recent one.
Going to your console, under "Compute Engine -> App Engine -> Versions" you can see, manage, and change your default version.

Related

How to disable the cache on server side for php file on Apache?

this question is similar to: disable php files caching for debugging
Currently, I try to debug a PHP website but I discover that there is some cache problem. When I update a PHP file, the update may or may not be available right now. I even deleted the index.php and the Website was still working.
This is not a browser cache problem because I use Chrome Incognito + Chrome Developer with "Disable Cache" checked + "Empty cache and Hard reload".
I think the problem come from the fact that PHP were upgraded to 7.3.XX (from 5.X) and there's a OPcache module enabled by default.
Is there a way to ignore this module. This website is on a shared hosting plan so I may not be able to edit config files.
EDIT: OPcache was not activated in the Cpanel. I also downgrade to PHP 5.6 and the problem is still here.
New observation: Before the PHP downgrade, I got a info.php file that print the phpinfo(). It was and is still showing 7.3 as version (cache?). I created a copy of that file and named it info2.php. This one is showing 5.6 as as PHP version. So there is still a cache somewhere.
Also, is this possible that the .htaccess file is also cached?
If your hoster has enabled user.ini files you can drop an ini file in your project directory containing:
opcache.enable=0
PHP Manual - Opcache config

MediaWiki 1.27 VisualEditor extension not loading

We are running a private MediaWiki server used at our workspace for internal documentation. We recently installed the VisualEditor extension, along with the prerequisite Parsoid (v0.8.0) service and Stunnel (as our wiki is served through HTTPS). However, we are having the issue where the "Edit" tab for the visual editor will appear when a page is loaded, then suddenly disappear after about half a second.
We double checked that the extension settings in LocalSettings.php were properly set to automatically enable the VisualEditor interface, and make it default.
We first looked at the error logs for MediaWiki, as well as Parsoid, and there is nothing out of the ordinary. We made sure that the wiki API was available, and that Parsoid could reach it, and was working. We have also looked at the debug console in the browser for error messages, which was also silent as to the nature of the issue. We have tried all of the listed troubleshooting steps on both the Parsoid and VisualEditor pages, and all of the checks point to the service running without error.
When we inspected the source for the page, we noticed that the html tag had been assigned the class type "ve-not-available", which made us think that the extension was potentially loading (at least enough to assign this class), but that something was preventing it from working properly. It's just that something has left zero footprint in any logs or files that we can find.
We would like to know where to look next to potentially help diagnose the problem.
If I recall correctly, this issue has something to do with the Visual Editor not recognizing the current skin being compatible. Are you using a custom skin?
If so, try adding the following to your LocalSettings.php;
$wgVisualEditorSupportedSkins = ['MySkin'];

How to see the errors in php code in chrome

My php code is in the hostgator server and since I have to write a few scripts I don't have to install the wamp/lamp server.
I did a bit digging and found extensions namely PHP console. I added it and tested once, it showed me the line number of the errror.
But after a few hours when I tested the extension it is not working anymore for the same script and the same error.
I also tried another popular extension called Xdebug helper. But that also seems to be not working.
To test I have removed a semicolon in my working script and the link is : http://arqamahmad.com/music_app/getmusic.php
PS : I am using a shared hostgator server and I have done my research on the .htaccess and php.ini files. Nothing is helpful. The PHP console extension was the best but there seems to be some problem to that.
Answer : I had to add a php.ini file inside public_http making allowing the php debug mode on then only it the extensions work.
For Firefox, there is FirePHP (http://www.firephp.org/) in combination with Firebug. There is a similar extension for Chrome, but I haven’t tested that (https://github.com/itsgoingd/clockwork-chrome).
The general thing is that you need to somehow transfer your error messages from PHP back to the client. If you don’t want to use a browser extension for that, you can also use an approach chosen by many frameworks (e.g. Symfony): add an admin module in your page, where the error messages are displayed (you need to intercept errors on the servers for that, by registering a custom error handler).
Edit: This of course requires PHP to output error messages at all, which depends on (among others) the php.ini settings like error_reporting, which need to be set to a level that the errors you desire for reporting will trigger the error handler functions.
Concerning your remark about Xdebug: to use Xdebug helper, Xdebug (a PHP extension for debugging) needs to be available on the server, which it usually is not on production systems.
Since php is executed on the server side, no browser add-on will help you. You need to add a few lines of code to the php file to show the errors.
Here's a link for you: https://stackoverflow.com/a/21429652/6735510

On Windows 8 and Internet Information Service 8.5 - how to setup PHP?

Let me begin by saying that I am very new to Microsoft's Internet Information Service. I need to setup IIS on my PC and it should also execute PHP files. So far I got everything installed and running - the latest PHP and enabled IIS service. I can view the Default Webpages (*.html) files ONLY. It will not execute PHP files. If I try to request any PHP files, I get 403 error.
I have been researching online and seems to be more confused about setting up PHP (extension) on IIS. Some websites say you need to configure PHP through its MANAGER. Others say I need to add Role and FastCGImodule through IIS manager. According to Microsoft I need to rename php.ini-development to php.ini and point php to some DLL file.
I am using Windows 8, IIS 8.5 and PHP 5.6. I hope someone could point me in the direction.
You can set this up manually or with the IIS Manager. I would set this up my own, so you know whats going on.
You will need to setup the CGI role feature. This includes FastCGI. Here is some information how to do that: http://www.iis.net/configreference/system.webserver/cgi
Then you will need the PHP package somewhere. Lets say in C:\PHP. You can change that if you want.
You will need the fastCGI settings. You can easily set this up by commandline:
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='C:\php\php-cgi.exe',activityTimeout='1200',requestTimeout='1200',arguments='-c%20C:\php\php.ini']
This example uses a timeout of 20min.
This will set the handler:
%windir%\system32\inetsrv\appcmd set config /section:handlers /+[name='PHP_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='"C:\php\php-cgi.exe|-c%20C:\php\php.ini"',responseBufferLimit='0',resourceType='Either']
php.ini setup:
[cgi-fcgi]
fastcgi.impersonate=1
cgi.force_redirect=0
cgi.fix_pathinfo=1
For write access you will need to grant "modify" access for the the IURS.
More Information: http://php.net/manual/de/install.windows.iis7.php
I did try the answer posted to heart, but I kept running into problems. In fact, I also followed the Microsoft step by step PHP setup tutorial to the TEETH. I still couldn't get PHP working on my IIS. Although Microsoft warned against using Windows Platform Installer(WPI), I downloaded WPI and ran the installer. Under frameworks, I found PHP 5.6 and clicked on Add button. Then, clicked on the Install button. It took only about 30 seconds to install. Just to be sure. I checked IIS manager and there it was PHP Manager. After opening PHP manager I noticed that all the settings were there and enabled and it already had 15 different extension enabled. Plus, it also had about 35 extension disabled, but it gives you option to enable them right there.
Now, my PHP files are rendered as expected. I even did phpinfo(); and the browser displayed all the PHP settings and information. :)

Installing PHP FileInfo Extension on Azure

Over the past two days, I have been scouring the web to figure out a way to enable the fileinfo extension for PHP 5.5 on Azure. I am in need of this feature in order to be able to check the type of files uploaded through a form. In my research, I have run into the following information:
First, I have found that, with PHP 5.5 (which I have running on my Azure instance), fileinfo should be enabled by default. That is the first concerning thing - as it is not.
Second, I have run into this resource. I followed the directions and created an App Settings variable entitled PHP_EXTENSIONS with a value of bin\php_fileinfo.dll. To see the structure of the website, visit the production repo here. This did not work.
In addition, I also found in the comments of the above forum that it may work if PHP_EXTENSIONS were changed to PHP_Extensions. I tried this, and still no luck. I also attempted using a backslash rather than a forward slash (as suggested in this forum) for the path to the dll, but that, too, was unhelpful.
Finally, in the event that the extension was present in Azure, but just not activated via php.ini, I used this forum to create a .user.ini to add the following line to php.ini that I assumed was likely commented out on the server:
extension=php_fileinfo.dll
Surprise! This, too, was unsuccessful.
I'm hoping there's someone out there who's had a similar problem with enabling PHP extensions in Azure that may be able to shed some light on this bleak situation. Many thanks!
Probably you are using the wrong php_fileinfo.dll. I had to download the exact same version of PHP that was running on Azure, grab the .dll, upload it and it worked.

Categories