Forum
Fatal error during installation on live site (iconv)
This problem was reported last week (Alistair Steger-Lewis), but I'm having trouble following the remedies proposed. The error message I get is:
Fatal error: Uncaught Error: Call to undefined function iconv() in /home/ikkrom/public_html/perch/core/lib/PerchUtil.class.php:796 Stack trace: #0 /home/ikkrom/public_html/perch/setup/PerchSetup_Installation.class.php(230): PerchUtil::urlify('ikkrom-org-uk') #1 /home/ikkrom/public_html/perch/setup/PerchSetup_Installation.class.php(111): PerchSetup_Installation->host_filename('ikkrom-org-uk') #2 /home/ikkrom/public_html/perch/setup/account/index.php(70): PerchSetup_Installation->write_config_file(Array) #3 {main} thrown in /home/ikkrom/public_html/perch/core/lib/PerchUtil.class.php on line 796
My PHP.ini has several 'iconv' options (all of which seem to be deprecated):
;iconv.input_encoding =
;iconv.internal_encoding =
;iconv.output_encoding =
Which (if any) should I activate, and with what value?
Similarly 'intl' has two options:
[intl]
;intl.default_locale =
; This directive allows you to produce PHP errors when some error
; happens within intl functions. The value is the level of the error produced.
; Default is 0, which does not produce any errors.
;intl.error_level = E_WARNING
There's no mention of 'iconv' in phpInfo() except in the 'Configure Command' section (as also reported by Alistair).
Neither 'iconv' not 'intl' are activated in PHP on my LOCAL server, and Perch runs there OK. This problem arose while installing on a live site (with licence).
Activate intl and you should be good to go. However, if you've developed the site locally, you shouldn't need to run setup on the production server - just deploy the files and database.
Thank you. I had wondered about just copying the files (and DB) from my local setup, but thought that would not take the licence into account.
It is still not clear to me what settings should be set for 'intl'. There appear to be several options, and I've tried most of them to no avail.
So I have uploaded all the local files and DB, and adjusted the config file as necessary. It is now working as expected EXCEPT that I have an error message appearing before the Perch content:
This warning appears four times, with a different line number at the end (1405, 1406, 1407, 1413). I can see that Perch is trying to write headers AFTER my main HTML page template has already written (non-Perch) page content. This didn't happen on the local version.
As long as it's enabled. The settings don't matter as far as I'm concerned.
You should make sure the Perch runtime is included before anything else is output, including whitespace.
Thank you. As far as 'intl' goes, I seem to have circumvented that problem by uploading the files etc. from my local version. If it's a problem confined to the Perch Setup is it really necessary to require an (apparently) uncommon 'php.ini' setting just for the Setup? (I concede you know far more about this than I do!)
As to including the Perch runtime before anything else is output, I have now moved the Perch runtime include to the first line of my master (HTML) template, and removed it from the individual Perch pages. This seems to have worked (subject to a bit more testing). Not every page on the site uses Perch.
The Perch 'Getting Started' instructions that I used for my local version told me to put the Perch runtime include at the start of my Perch page(s), which I did, and it didn't cause a problem locally. Surely there can't be a different rule about headers for my local server (Apache running in Windows 10)? My remote server is a virtual machine running Apache on Centos 7.
You’ll hit that problem whenever you try to generate a slug, not just in setup.
Without knowing how your two respective servers are configured, I could only make guesses as to why the two environments behave differently. The fundamentals of HTTP don’t change however, and you always need to output response headers before you start the response body.
Thank you.
It looks as if I'll have to persevere with this one eventually, then. All my attempts so far to enable 'intl' have failed to solve the Fatal Error problem in Setup, but now I've no way of testing that (I don't want to run Setup again). I'll wait and see if it happens again. (I have no idea when I might be needing to generate a slug, or even what it is),
Yes I'm familiar with needing to output headers before content. The solution seems to have worked in all pages, so I'll leave it as it is. It means (presumably) that every page has a Perch overhead even if not needed, but I'm hoping this won't be too heavy.
I've not knowingly configured my local server to be different from the remote, so I've no idea what the differences might be either.