I am having too many issues setting up laravel with netcup WCP

  • Hello,

    I am facing too many issues with netcup's webhosting plan.

    1. First, I can't change the base directory to httpdocs/public. I fixed it with .htaccess rewrite to /public.

    2. Second, storage symlink is causing errors (symlink not allowed or something). I glued it with .htaccess as well (pointing /storage to /httpdocs/storage/public)

    3. Third, php artisan config:cache causes open_basedir error. I deleted the bootstrap/cache/config.php to temporarily fix it.

    All of these fixes doesn't look good to me. Especially the third one. Any assistance is much appreciated, thank you.

  • Zur hilfreichsten Antwort springen
  • You definitely have to use the second option for open_basedir in the PHP settings (the one starting with {WEBSPACEROOT}). This should solve some of your problems.

    As for your first problem, what happens if you try this? Does the WCP not accept this setting or does it just not work as expected? In the second case the open_basedir setting might solve this already. Else you could try something htpdocs/yourproject/public or even /projects/yourproject/public

    I don't use Laravel myself. I use Symfony which uses a similar directory structure with public as document root. Works without any problem with just changing the document root and the open_basedir setting for PHP, leaving all other settings at default values.

  • You definitely have to use the second option for open_basedir in the PHP settings (the one starting with {WEBSPACEROOT}). This should solve some of your problems.

    As for your first problem, what happens if you try this? Does the WCP not accept this setting or does it just not work as expected? In the second case the open_basedir setting might solve this already. Else you could try something htpdocs/yourproject/public or even /projects/yourproject/public

    I don't use Laravel myself. I use Symfony which uses a similar directory structure with public as document root. Works without any problem with just changing the document root and the open_basedir setting for PHP, leaving all other settings at default values.

    pasted-from-clipboard.png
    tab it is greyed out!

  • I've found the issue with the third one, cache was producing directory starting from /domain.com/httpdocs
    and i replaced them with /var/www/vhost...../domain.com/httpdocs...

    Now I've got new issue..

    I can access other files (outside of public). And if I try to change the document root from customercontrolpanel.de/produkte.php to /domain.com/httpdocs/public... the open_basedir issue occurs for storage/... folder because it is out of the scope of the document root.

  • If you really changed the open_basedir setting, you should be able to access all folders of your webspace in PHP. Maybe you use an absolute path like "/storage"? This absolute path obviouly does not lie within your webspace. It DOES lie within your webspace only if you access it via CLI, because of the chroot environment. But you need to use a different absolute path or maybe a relative path like ("../storage/...")to access the storage folder.

    • Hilfreichste Antwort

    Ok fixed all the issues::
    figured it out myself

    1. changing docroot: from customercontrolpanel.de/produkte.php -> administration and configuration of domain -> edit settings -> docroot (cannot change it from plesk directly)

    2. symlink was not working because of the weird base_directory. I'm not sure why, but my cli uses '/domain.com/httpdocs' as webroot (__DIR__) but the website (accessed from web) uses '/var/www/vhosts/hosting___.___.netcup.net/domain.com/httpdocs/' as webroot (__DIR__). And if we try to use opposite, it doesn't work for either place. Then I used relative symlink public > ln -sr ../storage/app/public storage. It worked like a charm

    3. For the same reason as (2), after using php artisan optimize or php artisan config:cache, I updated all the strings using '/domain.com/httpdocs' to '/var/www/vhosts/hosting___.___.netcup.net/domain.com/httpdocs/'. Fixed

    Thank you

    We need the netcup support to fix these. The support is kind of slow and doesn't reply to replies :)

  • Prashanna 18. Februar 2025 um 18:21

    Hat einen Beitrag als hilfreichste Antwort ausgewählt.