Roots Discourse

ACF builder error on server side

Hi, I’m getting a PHP error only on server side. Is just Sage 9 (no Trellis/Bedrock this time).

It seems that class FieldsBuilder was not found, despite use StoutLogic\AcfBuilder\FieldsBuilder at the top of the file.

This is the complete warning (note in #7 that line 16 of /app/fields/options.php is causing the error)

**Fatal error** : Uncaught Error: Class 'StoutLogic\AcfBuilder\FieldsBuilder' not found in /var/www/vhosts/x-madrid.site/httpdocs/wp-content/themes/xmadrid/app/fields/options.php:16 

Stack trace: 

#0 /var/www/vhosts/x-madrid.site/httpdocs/wp-content/themes/xmadrid/app/setup.php(141): require_once() 

#1 [internal function]: App\{closure}('/var/www/vhosts...', 0)

#2 /var/www/vhosts/x-madrid.site/httpdocs/wp-content/themes/xmadrid/vendor/illuminate/support/Collection.php(932): array_map(Object(Closure), Array, Array)

#3 /var/www/vhosts/x-madrid.site/httpdocs/wp-content/themes/xmadrid/app/setup.php(142): Illuminate\Support\Collection->map(Object(Closure))

#4 /var/www/vhosts/x-madrid.site/httpdocs/wp-includes/class-wp-hook.php(286): App\{closure}('')

#5 /var/www/vhosts/x-madrid.site/httpdocs/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)

#6 /var/www/vhosts/x-madrid.site/httpdocs/wp-includes/plugin.php(465): WP_Hook->do_action(Array) 

#7 /var/www/vhosts/x-madrid.site/httpdocs/wp-settings.php(525): do_action('ini in **/var/www/vhosts/x-madrid.site/httpdocs/wp-content/themes/xmadrid/app/fields/options.php** on line **16**

So, the new object constructor doesn’t find the class. This is the line in context:

https://bitbucket.org/dbartolome/xmadrid/src/ade935ea40971b69f4ad145eca3d48f4e7bc7306/app/fields/options.php#lines-16

What could be the cause of the error? Why does it happen only on the server side? (the theme is identical locally and on the server).

I have no much PHP skills. Any help appreciated!

Hey @aitor,

I’m getting an access denied error on the bitbucket link you shared.

The first thing that comes to mind if it’s working on your local dev setup but not your server is that you may not have the composer dependencies (including acf-builder) installed on the server. Have you run composer install --no-dev on the server or uploaded your vendor folder?

1 Like

Hi Matt. I’ll go to check it (including repo access). Thanks!

Vendor was git ignored! Thank you for your time, @mmirus. All works now.

1 Like