Akeneo(Symfony2)项目PHP未解析及Doctrine ORM依赖冲突求助
Hey there, let's tackle these two issues you're facing with your Akeneo Community Edition (based on Symfony 2) installation one by one:
Issue 1: PHP Code Displays Instead of Being Parsed on Homepage
When your browser shows raw PHP code instead of rendering the page, it means your web server isn't configured to pass .php files to the PHP interpreter. Here's how to fix this:
For Apache Users:
- Enable the PHP module: Run the command (replace
php5.6with your installed PHP version, since Akeneo 1.6 requires PHP 5.4-5.6):sudo a2enmod php5.6 sudo systemctl restart apache2 - Check virtual host configuration: Ensure your site's virtual host includes directives to handle PHP files and recognize
index.phpas a default index:AddType application/x-httpd-php .php DirectoryIndex index.php index.html - Allow .htaccess files: If you're using Symfony's default
.htaccessin theweb/directory, make sure your virtual host grants override permissions for the web root:<Directory /path/to/your/akeneo/web> AllowOverride All Require all granted </Directory> - Restart Apache after making any configuration changes.
For Nginx Users:
- Update your Nginx server block to forward PHP requests to PHP-FPM. Adjust paths and PHP version to match your setup:
server { listen 80; server_name your-domain.com; root /path/to/your/akeneo/web; index index.php; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } - Restart Nginx after updating the config:
sudo systemctl restart nginx
Issue 2: Dependency Conflict with doctrine/orm
The error message makes it clear: your Akeneo version (v1.6.22) has a strict requirement for doctrine/orm 2.4.7, but running composer require doctrine/orm without specifying a version makes Composer try to install the latest stable version—this conflicts with Akeneo's required version. Here's how to resolve this:
Solutions:
- Install the exact required version: Use this command to install the version that matches Akeneo's dependency:
composer require doctrine/orm:2.4.7 - Verify existing dependencies: Akeneo's
pim-community-devalready includesdoctrine/ormas a dependency, so you might not even need to install it manually. Check if it's already present:composer show doctrine/orm - Update dependencies safely: If you need to refresh your dependencies, use this command to ensure Akeneo's required versions are respected:
composer update akeneo/pim-community-dev --with-dependencies - Check minimum-stability setting: Your
composer.jsonhas"minimum-stability": "stable", which is fine since 2.4.7 is a stable version. This isn't the cause of your conflict here.
Your composer.json Reference:
{ "name": "akeneo/pim-community-standard", "description": "The \"Akeneo Community Standard Edition\" distribution", "license": "OSL-3.0", "type": "project", "authors": [ { "name": "Akeneo", "homepage": "http://www.akeneo.com" } ], "autoload": { "psr-0": { "": "src/", "Context": "features/" }, "psr-4": { "Pim\\Upgrade\\": "upgrades/" } }, "require": { "akeneo/pim-community-dev": "~1.6.22", "symfony/requirements-checker": "^1.1" }, "require-dev": { "doctrine/migrations": "1.2.2", "doctrine/doctrine-migrations-bundle": "1.1.0" }, "repositories": [ { "type": "vcs", "url": "https://github.com/akeneo/pim-community-dev.git", "branch": "master" } ], "scripts": { "post-install-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget", "php app/console fos:js-routing:dump --target=web/js/routes.js" ], "post-update-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget", "php app/console fos:js-routing:dump --target=web/js/routes.js", "Pim\\Bundle\\InstallerBundle\\ComposerScripts::copyUpgradesFiles" ] }, "config": { "bin-dir": "bin" }, "minimum-stability": "stable", "extra": { "symfony-app-dir": "app", "symfony-web-dir": "web", "symfony-assets-install": "relative", "incenteev-parameters": { "keep-outdated": true, "file": "app/config/parameters.yml", "env-map": { "database_host": "PIM_DATABASE_HOST", "database_port": "PIM_DATABASE_PORT", "database_name": "PIM_DATABASE_NAME", "database_user": "PIM_DATABASE_USER", "database_password": "PIM_DATABASE_PASSWORD" } }, "branch-alias": { "dev-master": "1.7.x-dev", "dev-1.6": "1.6.x-dev", "dev-1.5": "1.5.x-dev", "dev-1.4": "1.4.x-dev", "dev-1.3": "1.3.x-dev", "dev-1.2": "1.2.x-dev", "dev-1.1": "1.1.x-dev", "dev-1.0": "1.0.x-dev" } } }
内容的提问来源于stack exchange,提问作者Paul
相关产品推荐
相关产品推荐

