I get this error when attempting to access Admin on my site: Call to undefined function create_function()
Any advice?
Your host has updated PHP, and you are not fully compatible with it. If that's the only issue that came up, this might help https://custom.simplemachines.org/index.php?mod=4300
Since you can't get to admin, this might take some maneuvering though.
Hello & thank you, Lex! are you willing to do a quick zoom and screen share with me to show me how to do this?
Is anyone available? I do not want to mess this up. Just 10 mins of your time.
If not just attach your sources/subs.php
And just need to add it to end of file
before ?>
if (!function_exists('create_function'))
{
function create_function($args, $code)
{
return eval(sprintf('return function(%s) {%s};', $args, $code));
}
}
I could really use a quick lesson on this via zoom & screen share on my end.
We generally don't do 1 on 1 like that, someone might but most of the team likely will not.
What vbgamer45 suggested, should be fairly easy though - Even easier if you just take a copy of the file from your server, and attach it to your next post so someone else here can do the edits for you.
I am following the directions but I cannot find the board directory. Any advice?
What board directory?
Go to the location of your forum.
Go into the Sources directory
Find the file named Subs.php
This one (from the directions)
Manual Installation
This is for if you lose access to the package manager due to an error from a missing create_function():
Copy Subs-CreateFunction.php into your sources directory
Copy install.php to the board directory and execute it (remember to delete it afterwards!)
Equivalent to running the following PHP code
add_integration_function(
'integrate_pre_include',
'$sourcedir/Subs-CreateFunction.php
');
Quote from: Aleksi "Lex" Kilpinen on March 27, 2024, 03:59:27 AMWe generally don't do 1 on 1 like that, someone might but most of the team likely will not.
What vbgamer45 suggested, should be fairly easy though - Even easier if you just take a copy of the file from your server, and attach it to your next post so someone else here can do the edits for you.
I cannot locate the Board directory referenced at the link. Any advice?
It means the base forum directory
You don't have to mess with code, just downgrade php version to 8.0 in your host control panel.
create_function was removed in 8.0, so would still have issues.
It would be easier and faster if he just installs the MOD using the Package Manager (https://wiki.simplemachines.org/smf/SMF2.1:Package_manager)
Hmm, OP has links to two sites in sig, one doesn't load, other is 2.0.19 install. Shouldn't be having create_function errors in latter, unless from mod. 2.0.19 action=admin loads normally in php 8.0, 8.1, 8.2, 8.3.
Quote from: Sir Osis of Liver on March 27, 2024, 09:53:33 PMYou don't have to mess with code, just downgrade php version to 8.0 in your host control panel.
This may be helpful. I will give it a try
Quote from: Sir Osis of Liver on March 27, 2024, 10:44:30 PMHmm, OP has links to two sites in sig, one doesn't load, other is 2.0.19 install. Shouldn't be having create_function errors in latter, unless from mod. 2.0.19 action=admin loads normally in php 8.0, 8.1, 8.2, 8.3.
Untrue & unhelpful
Quote from: Sir Osis of Liver on March 27, 2024, 09:53:33 PMYou don't have to mess with code, just downgrade php version to 8.0 in your host control panel.
Darn it!
Lowest avl is 8.1
Downgrading to 8.0 will not fix this.
If you can go to your hosting control panel and download a copy of your Sources/Subs.php from the forum files to attach to your next post here, I'm sure someone can edit it for you like vbgamer45 suggested.
Quote from: vbgamer45 on March 26, 2024, 04:19:22 PMIf not just attach your sources/subs.php
And just need to add it to end of file
before ?>
if (!function_exists('create_function'))
{
function create_function($args, $code)
{
return eval(sprintf('return function(%s) {%s};', $args, $code));
}
}
Do note though, that 2.0 is officially only supporting PHP versions up to 8.0 - So you should really consider upgrading SMF.
Quote from: Uhura! on March 28, 2024, 03:23:22 PMQuote from: Sir Osis of Liver on March 27, 2024, 10:44:30 PMHmm, OP has links to two sites in sig, one doesn't load, other is 2.0.19 install. Shouldn't be having create_function errors in latter, unless from mod. 2.0.19 action=admin loads normally in php 8.0, 8.1, 8.2, 8.3.
Untrue & unhelpful
Not sure what you're objecting to. https://ourmomspot.net/community/ loads a 2.0.19 forum. https://www.ourparentingspot.net/ fails to load.
Just to clarify, there's only one call to create_function in 2.0.19 core, it's an error handler in Errors.php. The error you're getting when accessing Admin is not being caused by core code, so it must be from a mod or manual edit.
But do what Lex and vbgamer suggested, attach the file and someone will fix it.
@Uhura! - We really don't need back-to-back-to-back-to-back posts in the space of 3 minutes. Posts have an edit button, please use it.