Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
Symfony 3 / Apache - Post request gives Error 500

I have a Symfony 3 API and I'm trying to register a user but I have an error 500 when executing a POST request (GET request works). It's probably a problem with my Apache configuration because I don't have any errors in my logs files. A var_dump('ok') at the top of my function also give me error 500.

My Apache configuration:

<VirtualHost *:80>
    ServerName subscription.api.local
    ServerAlias www.subscription.api.local

    DocumentRoot /var/www/subscription_backend/web
    DirectoryIndex /app.php

    <Directory /var/www/subscription_backend/web>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        FallbackResource /app.php
    </Directory>

    <Directory /var/www/subscription_backend>
        Options FollowSymlinks
    </Directory>

    <Directory /var/www/subscription_backend/web/bundles>
        FallbackResource disabled
    </Directory>

    ErrorLog /var/log/subscription-error.log
    CustomLog /var/log/subscription-access.log combined
</VirtualHost>

Line added in my hosts file:

127.0.0.1 subscription.api.local www.subscription.api.local

My projet is in ~/Projects/subscription_backend directory and I use a symbolic to /var/www/subscription_backend :

sudo ln -s  ~/Projects/subscription_backend /var/www/subscription_backend

Permissions of "~/Projects/subscription_backend directory": enter image description here

Permissions of "/var/www/subscription_backend directory": lrwxrwxrwx 1 www-data www-data 55 avril 19 21:45 /var/www/subscription_backend -> /home/khan/Projects/subscription_backend/

What's wrong with my configuration ? Why GET request works but not POST ?

Thx

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Finally, i solved the problem.

First,fix permissions https://symfony.com/doc/3.3/setup/file_permissions.html:

cd ~/Projects/subscription_backend

rm -rf var/cache/*
rm -rf var/logs/*
HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data [n]ginx' | grep -v root | head -1 | cut -d\  -f1)

sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
composer install

Then install memcache extension:

sudo apt-get install memcached
sudo apt-get install php-memcached
sudo apt-get install php-memcache
sudo service apache2 restart

Clear cache:

bin/console c:c
bin/console c:c --env=prod
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!