Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in mecha-cms.de/engine/kernel/state.php on line 1 #2

Open
ghost opened this issue Apr 4, 2023 · 24 comments
Labels

Comments

@ghost
Copy link

ghost commented Apr 4, 2023

Good morning, Tovic,

the installer trough /start.php going not done. My hosting is great prepared for the installation, but It's nothing possible over /start.php.

I have PHP 7.3 or 7.4 and an Apache web server at my hosting.

Can you help me with this?

Many thanks, Tovic :-)

@taufik-nurrohman
Copy link
Member

The .\engine\kernel\state.php file should contain only the class definition. Also, why does it show an error on the first line? The first line is always a <?php opening tag.

Please paste the generated error log here in case it does exist.

@taufik-nurrohman
Copy link
Member

taufik-nurrohman commented Apr 4, 2023

Oh, could you try to disable the source code optimization and see if it works? It shows the error on the first line because the file content is compressed into a single line. Must be caused by the attribute syntax that it is being treated as a literal comment in PHP < 8.0.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

Hi,

I'm trying to install in an SSD hosting too, but that errors are visible:

✘ Could not pull mecha-cms/mecha due to network error.

✔ It looks like you are using a LiteSpeed web server. This web server is usually compatible with Apache web server configuration.

✔ Minimum PHP version required is 7.3.0. Your current PHP version is 7.4.33.

✔ PHP [dom](https://mecha.officiis.biz/start.php) extension is enabled.

✔ PHP [json](https://mecha.officiis.biz/start.php) extension is enabled.

✔ PHP [mbstring](https://mecha.officiis.biz/start.php) extension is enabled.

Always a network error and the installer without code optimizing still not worked.

@taufik-nurrohman
Copy link
Member

taufik-nurrohman commented Apr 4, 2023

Always a network error […]

Make sure allow_url_fopen option is enabled.

[…] and the installer without code optimizing still not worked.

What’s the new error message appears after you disable the code optimizer? I need the exact code line information from the uncompressed file.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

PHP is 7.3.x, allow url fopen is active and I have this error:

✘ Could not pull mecha-cms/mecha due to network error.

It's always only that error I show at Firefox browser under https://mecha.officiis.biz . I want to move, if the installation it's done, to the main domain under https://mecha-cms.de .

@taufik-nurrohman
Copy link
Member

Must be from my side. Why not try to install it the manual way? There’s an experimental website available to visit here: https://dev.mecha-cms.com. You can download the ZIP file directly from the home page.

The dev. prefix will be removed once everything is stable.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in mecha.officiis.biz/engine/kernel/state.php on line 1

So now, I'm trying with the code optimization. It's the same error, I think.

@taufik-nurrohman
Copy link
Member

taufik-nurrohman commented Apr 4, 2023

I need it without the code optimization to get the exact code line from the uncompressed file.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

Ah, ok, I want always to install my CMS via browser way :-) It's ok, I want to try this now. Wait, please just a moment, OK.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

Now, I had uploaded from your source the packet with mecha CMS and under https://mecha-cms.de I see that error:

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in /mecha-cms.de/engine/kernel/state.php on line 1

PHP is 7.4.x and allow url fopen is active.

@taufik-nurrohman
Copy link
Member

taufik-nurrohman commented Apr 4, 2023

Why it is always on line 1? Have you unchecked the “Minify PHP” input before downloading the package?

@ghost
Copy link
Author

ghost commented Apr 4, 2023

So now a new error by the name of:

Fatal error: Declaration of Page::__toString() must be compatible with File::__toString(): string in /home/mecha-cms.de/lot/x/page/engine/kernel/page.php on line 44

I have uploaded the mecha again, and I have unchecked the "Minify PHP".

@taufik-nurrohman
Copy link
Member

Okay, I know this part. For now, please go to .\engine\kernel\file.php then replace public function __toString(): string { with public function __toString() {.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

Ok, now it's all fine, and I have removed this site from Cloudflare, because it's not worked with Cloudflare. I think, that is by the side of Cloudflare, you know, Tovic.

In the next a couple of hours will be the DNS done and after that we will know more about my Mecha CMS website :-).

@ghost
Copy link
Author

ghost commented Apr 4, 2023

The new error is from Firefox browser and I don't know, what is that:

Content-Encoding-error in the last version of the browser. See: https://mecha-cms.de Thanks, Tovic!

@taufik-nurrohman
Copy link
Member

taufik-nurrohman commented Apr 4, 2023

It shows content encoding error because there’s an error when printing the response body. When this happen, usually a log file will be available as .\engine\log\error, .\engine\log\error-x or .\engine\log\error-y.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

Hi Tovic,

I have shown in the error.log file and have found that error:

[04-Apr-2023 19:27:29 Europe/Berlin] PHP Warning: Declaration of Page::name(...$lot) should be compatible with File::name($x = false) in /mecha-cms.de/lot/x/page/engine/kernel/page.php on line 99

I'm trying both PHP versions like 7.3.x and 7.4.x, and it's the same error. So I don't know what I can now do. Can you help me again with mecha? `

@taufik-nurrohman
Copy link
Member

Open ./index.php then change the TEST constant value to false:

define('TEST', false);

This does not happen with PHP 8.x.x though.

@ghost
Copy link
Author

ghost commented Apr 4, 2023

I have uploaded old files of mecha CMS of the version 2.6.3 to mecha-cms.de and now in the backend I have shown that error:

[30-Oct-2021 07:31:17 Europe/Berlin] PHP Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in ./lot/x/search/engine/r/route.php on line 1

How I can fix this? PHP is 7.4.x. Many thanks for the help, Tovic!

@taufik-nurrohman
Copy link
Member

taufik-nurrohman commented Apr 4, 2023

Please download the uncompressed version of mecha-cms/x.search extension so that I can know exactly where the code line is. FYI, the mecha-cms/y.normal layout is not yet compatible with Mecha 3.0.0.

@ghost
Copy link
Author

ghost commented Apr 5, 2023

Good morning, Tovic,

now it's everything fine with my mecha website. I have now uploaded your mecha version 2.6.3 with the default layout, which working fine. And thanks for all the help to me!

@taufik-nurrohman
Copy link
Member

Yeah, sorry about that. Version 3.0.0 is not yet stable and not ready for production. But once it stable, there will be more extensions and layouts available.

@taufik-nurrohman
Copy link
Member

@AlexL777HRO could you try again the start.php file with the latest update?

@ghost
Copy link
Author

ghost commented Apr 13, 2023

Hi, ok, thank you I will check it today at later evening :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant