I have upgraded to mthe latest version of PHPMaker (v2022.4). When generating my application I get a HTTP ERROR 500 (only on Ubuntu).On my dev machine, running Win 10, Apache 2.4, PostgreSQL, php 7.4, I do not get the error, however when I transfer my project to the linux machine (web server) I get the HTTP ERROR 500.
It is running Ubuntu 20.04, Apache 2.4, PostgreSQL, php 7.4.Permissions checked and it is not a permission problem.
When I switch “display_errors = on” in php.ini file, I get an “unexpected ‘|’ …” error on line 30 (of file LoggerInterface.php).
This file is in “mysite/vendor/psr/log/Psr/Log/LoggerInterface.php”.Any ideas would be welcome?
If you use PHP 8 on your PC but PHP 7.x on your production server, it may not work because Composer will try to download the latest version of packages supported by the PHP version running Composer.There are 3 ways to resolve: (choose one of the follows)
- Upgrade production server to PHP 8,
- Click Tools → Composer Packages, search “psr/log”, add, and change the version to “^1.1.4”,
- Downgrade the “psr/log” package in the generated project,
a. Open composer.json with a text editor and add “psr/log”: “^1.1.4” under the “require” section, e.g.
"require": {
"php": ">=7.3.0",
"psr/log": "^1.1.4",
...
b. Open a command prompt or PowerShell at the project folder and run “composer date”.
Thank you, however still not resolved. It seems that it is something on Ubuntu (Ubuntu 20.04, Apache 2.4, PHP 8.0.11) since it is working on my dev machine (Win 10, Apache 2.4, PHP 8.0.9). Yes, I have upgraded PHP on Ubuntu.I’m still getting the same error (even after the “downgrade” of “psr/log”).
If you have upgraded to PHP 8, it will work because PHP 8 supports the Union types:
Union types are specified using the syntax T1|T2|… Union types are available as of PHP 8.0.0.Make sure your server is actually running PHP 8.
Thank you, it is in fact running PHP 8.0.11, and I can confirm that did resolve the initial issue of “unexpected ‘|’ error”. However it still does not load the page, giving the “HTTP ERROR 500 - cannot load the resource…”. So upon further investigation, switcing on “display_rerros” in php.ini, I’m now getting the following error (NOTE that I only get this error on the Ubuntu Linux server - so it must be a “config” issue somewhere on Linux):
Fatal error: Uncaught Error: Class "ResourceBundle" not found in /var/www/mydomain.com/mysite/src/phpfn.php:5611 Stack trace: #0 /var/www/mydomain.com/mysite/src/Language.php(76)
So it’s complaining about this line of code (I don’t know why):
$locales = array_map("strtolower", \ResourceBundle::getLocales(""));
Thank you, much appreciated. I did activate the intl extension, however I forgot to check (phpinfo) that it is in fact available. However it was never installed, I guess it is to be expected when one rushes things.All is good now!
Hi,I continue to have this problem even though I downgrade the psr/log version on the server where I have to use 7.4 php.error message:
…/vendor/doctrine/event-manager/src/EventManager.php(32): syntax error, unexpected ‘|’, expecting variable (T_VARIABLE)composer.json:
{
"name": "hkvstore/phpmaker",
"version": "2023",
"type": "project",
"homepage": "https://phpmaker.dev/",
"license": "Commercial",
"authors": [
{
"name": "e.World Technology Limited",
"email": "sales@hkvstore.com"
}
],
"require": {
"php": ">=7.4.33",
"ext-intl": "*",
"slim/slim": "^4.10.0",
"slim/csrf": "^1.2.1",
"slim/http": "^1.2.0",
"slim/http-cache": "^1.1.0",
"slim/flash": "^0.4.0",
"slim/php-view": "^3.2.0",
"nyholm/psr7": "^1.5.1",
"nyholm/psr7-server": "^1.0.2",
"php-di/php-di": "^6.4.0",
"doctrine/dbal": "^3.4.4",
"monolog/monolog": "^2.8.0",
"firebase/php-jwt": "^6.3.0",
"phpmailer/phpmailer": "^6.6.4",
"hkvstore/htmlpurifier": "^4.14.3",
"hkvstore/phpthumb": "^2.1.4",
"mobiledetect/mobiledetectlib": "^2.8.39",
"soundasleep/html2text": "^2.0.0",
"defuse/php-encryption": "~2.3.1",
"timetoogo/pinq": "dev-master",
"dflydev/dot-access-data": "^3.0.1",
"delight-im/cookie": "^3.4.0",
"selective/samesite-cookie": "~0.3.0",
"imangazaliev/didom": "^2.0",
"symfony/polyfill-php80": "^1.26.0",
"symfony/polyfill-php81": "^1.26.0",
"jawira/case-converter": "^3.5.1",
"filp/whoops": "^2.14.5",
"giggsey/libphonenumber-for-php": "^8.12.45",
"hkvstore/dompdf": "~2.0.0",
"psr/log": "^1.1.4"
},
"autoload": {
"psr-4": {
"PHPMaker2023\\project2023\\": [
"src/",
"models/",
"controllers/"
]
},
"classmap": [
"src/UploadHandler.php",
"src/PasswordHash.php"
]
},
"config": {
"allow-plugins": true
}
}
arbei wrote:
If you use PHP 8 on your PC but PHP 7.x on your production server, it may not work because Composer will try to download the latest version of packages supported by the PHP version running Composer.> There are 3 ways to resolve: (choose one of the follows)
- Upgrade production server to PHP 8,
- Click > Tools → Composer Packages> , search “psr/log”, add, and change the version to > “^1.1.4”> ,
- Downgrade the “psr/log” package in the generated project,
a. Open composer.json with a text editor and add > “psr/log”:
“^1.1.4” > under the “require” section, e.g.
"require": {
"php": ">=7.3.0",
"psr/log": "^1.1.4",
…
>
> b. Open a command prompt or PowerShell at the project folder and run > "composer update"> .
>
I did.
1-) composer to downgraded 1.1.4 on tools > composer packages and re-generated all files.
2-) I ran composer update with powershell in localhost/app folder.
3-) I re-uploaded all files to web hosting area.IIS works fine as well.
When I upload it to hosting it gives this error:
Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.0.0”.By the way,
Computer IIS php version > 8
Hosting > 7.4
This was an old topic, many packages might have upgraded to PHP 8 already, you need to find out them and use older version which support PHP 7.4.Alternatively, you may try to manually add the platform setting in composer.json, e.g.
"config": {
"platform": {
"php": "7.4.0"
}
}
and run “composer update” again.