Google AppEngine Deploy Error (cloud-error-reporting) - php

I have an App (PHP 7.4) running on Google AppEngine Standard. Now i have created
a new Project inside CloudConsole wih same settings and want to deploy
this App to the new generated Project for testreason.
gcloud app deploy app.yaml --project=testapp-2022-08-14
But i am getting this error:
Fatal error: Unknown: Failed opening required '/srv/vendor/google/cloud-error-reporting/src/prepend.php' (include_path='.:/layers/google.php.runtime/php/lib/php') in Unknown on line 0
To activate the Cloud-Error-Reporting i followed this Documentation:
CloudErrorrEPORTING
my php.ini
auto_prepend_file = '/srv/vendor/google/cloud-error-reporting/src/prepend.php'
session.gc_maxlifetime = 259200
opcache.memory_consumption = 128
my app.yaml
runtime: php74
instance_class: F1
entrypoint: serve bootstrap.php
handlers:
...
env_variables:
...
runtime_config:
document_root: .
automatic_scaling:
max_instances: 20
any help is welcome

Using AppEngine's standard configuration with PHP 7.4 runtime, we encountered the same issue recently, and the value set for auto_prepend_file
registering the library in php.ini in the standard setting no longer works. As we checked the sample repository, we discovered that they suggested registering error handlers manually as a workaround if php.ini cannot be accessed.
In our case, registering the error handler manually, resolved the issue.
# This works for files in the root of your project. Adjust __DIR__ accordingly.
require_once __DIR__ . '/vendor/google/cloud-error-reporting/src/prepend.php';
Take a look at the sample repository and verify that your configuration is set up correctly as well.
https://github.com/GoogleCloudPlatform/php-docs-samples/tree/6609166f71b1049f45360480963c2327b00b7959/appengine/standard
Hope this helps!

Related

google.appengine.tools.devappserver2.errors.InvalidAppConfigError

Getting below error after runnnig command "dev_appserver.py C:\Newfolder"
google.appengine.tools.devappserver2.errors.InvalidAppConfigError: In env: flex, only the following runtimes are allowed: ('python-compat', 'java', 'java7', 'go', 'custom')
I have installed php version 8.0.6 , and i'm trying to run a sample php application on localhost using google app engine's sdk.
my app.yaml looks like this:
runtime: php8
env: flex
runtime_config:
document_root: Newfolder
I tried putting runtime as custom , php72, php55 and even php80(since my php version is 8.0.6)
but still am getting the same error
referring this link https://cloud.google.com/appengine/docs/standard/php/tools/using-local-server
If you want to use php in flex environment your app.yaml needs to look something similar to this:
runtime: php
env: flex
runtime_config:
document_root: web
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
The php version that app engine flex will use is the default PHP 7.3, but if you want to use another version you can specify it in the composer.json as this link says

Apache HTTP Server has stopped working in Xampp

I am using LiteCart opensource e-commerce platform. When i run xampp server, apache and mysql server starts without any error and warning. But when i open browser and hit the url to open my installed litecart application it gives me an error
I also checked for online solution but nothing happened.
Can anyone will help me in this.
Problem details:
Problem Event Name: APPCRASH
Application Name: httpd.exe
Application Version: 2.4.17.0
Application Timestamp: 561cc534
Fault Module Name: php5ts.dll
Fault Module Version: 5.5.37.0
Fault Module Timestamp: 576b2166
Exception Code: c00000fd
Exception Offset: 0005a5ba
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 64c6
Additional Information 2: 64c64714e3c644daeb62f47ad597dc84
Additional Information 3: 36e8 Additional
Information 4: 36e8add2564fc225e8a656ba7214b7ab
To fix this problem:
Stop the Apache web server from the XAMPP control panel
Choose httpd.conf from config menu on XAMPP control panel
Insert this code to the end of the file:
<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>
I guess, It's a memory problem.
Search “memory_limit” in your php.ini, and change the value of it.
If no “memory_limit” found, add the following line at the end of php.ini:
memory_limit = 128M ; /* Change the 128M to your needs */
Save file.
Restart Apache.
This happens because of errors in you java code.
First of all check your tomcat or GlassFish logs.
Then just debug your code, and you will find your problem.

How to load php_redis.dll when running post deployment script in Kudu Console

I have a webapp running on Azure App Service. I am trying to test a Post deployment script in Kudu Debug CMD console.
php -d extension=php_redis.dll -f postdeploy.php
Here is my postdeploy.php file
<?php
ini_set('error_reporting', -1);
ini_set("display_errors", 1);
function exception_handler($exception) {
echo "Uncaught exception: " , $exception->getMessage(), "\n";
}
set_exception_handler('exception_handler');
$redis = new Redis();
...
?>
I get the following error
Fatal error: Class 'Redis' not found in D:\home\site\deployments\tools\PostDeploymentActions\postdeploy.php on line 13
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Program Files (x86)\PHP\v5.6\ext\php_redis.dll' - The specified module could not be found.
in Unknown on line 0
I uploaded the proper version of php_redis.dll to the PostDeploymentActions folder. This is the same binary that the webapp is using via the app setting in portal PHP_EXTENSIONS = bin\php_redis.dll. However, I am not sure how to load this for this script.
Is there a way that I can load the php_redis.dll in Kudu post deployment script?
I tried php -d extension=./php_redis.dll -f postdeploy.php, php -d extension=%~dp0php_redis.dll -f postdeploy.php and other weird combinations with no luck.
Please try to add the PHP extension via ini settings, refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-php-configure/#how-to-enable-extensions-in-the-default-php-runtime at the Configure via ini settings section.
Generally:
Add an App Setting to your Web App with the key PHP_INI_SCAN_DIR and value d:\home\site\ini
Create an configuration file in d:\home\site\ini called extensions.ini
Add configuration settings to the extensions.ini file using the same
syntax you would use in a php.ini file. For example: extension =
php_redis.dll.
Restart Web Apps service.
Via this approach, you can configure the PHP extension into Kudu console site's PHP runtime. And configure via the App Settings will only configure the extension into IIS.
Any further concern, please feel free to let me know.

Symfony2.8 : installation not complete

I downloaded Symfony2 et when I create a project /var/www/html# php ../symfony.phar new MyProject 2.8
At the end, I have this message :
Preparing project...
✕ Symfony 2.8.2 was successfully installed but your system doesn't meet its
technical requirements! Fix the following issues before executing
your Symfony application:
* date.timezone setting must be set
> Set the "date.timezone" setting in php.ini* (like Europe/Paris).
After fixing these issues, re-check Symfony requirements executing this command:
php Projet_miage/app/check.php
Then, you can:
* Change your current directory to /var/www/html/Projet_miage
* Configure your application in app/config/parameters.yml file.
* Run your application:
1. Execute the php app/console server:run command.
2. Browse to the http://localhost:8000 URL.
* Read the documentation at http://symfony.com/doc
But why ?
(I have xampp and I am on Ubuntu)
Because to make your application working properly, Symfony need some specific PHP configuration.
Find your php.ini by running:
php --ini
This will output something like :
Configuration File (php.ini) Path: /path/to/php
Loaded Configuration File: /path/to/php/php.ini
Then, open it:
nano /path/to/php/php.ini
Find the line date.timezone and change it to :
date.timezone = "Europe/Paris"
Of course, if "Europe/Paris" is not your timezone, you can replace by yours.
Please set the timezone in your php.ini
date.timezone = " Europe/Paris"
Restart xampp after that

Cannot find save handler 'redis'

I am running a PHP 5.4 hosted Web App on Azure. To manage session handling I have configured a Redis cache instance on Azure.
I have set the session save path & handler:
session.save_handler = redis
session.save_path = "tcp://kbcache.redis.cache.windows.net:6379?auth=***"
I have also configured the Redis extensions:
PHP_EXTENSIONS bin\php_igbinary.dll
APPSETTING_PHP_EXTENSIONS bin\php_igbinary.dll
PHP_EXTENSIONS02 bin\php_redis.dll
APPSETTING_PHP_EXTENSIONS02 bin\php_redis.dll
However when I browse to my website I receive the message:
Warning: session_start(): Cannot find save handler 'redis' - session
startup failed in D:\home\site\wwwroot\index.php(22) : eval()'d code
on line 2
What am I missing?
[Update Pre post]
When deployed PHP project, we need enable extensions on Azure.
Please see my website folder structure:
I copied the DLL files into folder named ext. And those dlls' version should be VC9 and non-thread-safe (nts) compatible.
And I created a extension.ini into folder name ini. The content as following :
extension=d:\home\site\ext\php_igbinary.dll
extension=d:\home\site\ext\php_redis.dll
zend_extension=d:\home\site\ext\php_xdebug-2.3.3-5.4-vc9-x86_64.dll
session.save_handler = redis
session.save_path = "tcp://**.redis.cache.windows.net:6379?auth=**
At last, I add the "PHP_INI_SCAN_DIR" Configurtation Panel on Azure portal:
It works for me.
Actually, I tried PHPRedis extension on my environment, it works fine.
Form your description, I think you made configuration of Redis extensions complicated.
I followed those steps:
1.Switch to PHP version 5.4
2.Download PHPRedis extension form this page.
Since I used PHP which version is version 5.4 TS, I downloaded phpredis_5.4_vc9_ts
3.After unzipped the download file, Please copy those DLL file into your PHP ext folder. It seems that you need pay attention to this point.
Add this code into your PHP.ini file
extension=php_igbinary.dll
extension=php_redis.dll
session.save_handler = redis
session.save_path = "tcp://**.redis.cache.windows.net:6379?auth=**
4.Create a Page and test Redis Code:
$redis=new Redis();
$redis->pconnect('tcp://**.redis.cache.windows.net', 6379);
$redis->auth('**+**=');
$redis->set('key', 'hello ');
$redis->append('key', 'world ');
echo $redis->get('key');
had similar issues. make sure redis dll file is there and enabled in php.ini also make sure that redis folder has full write permissions.

Categories