-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install won't run. #2
Comments
I actually found the problem. The opening PHP tag in Module.php was <? instead of <?php |
You will also need short tags turned on in your php environment, most of On Wed, Aug 14, 2013 at 10:00 AM, Brandon Walker
|
The exact path is . |
After fixing Module.php go to this Url : http://your-vhost/install (if you didn't make a vhost yet, it will go to /install) |
After running composer to get everything set-up, I go to the application URL and it outputs a bunch of PHP code into the browser... It looks like it's just printing the entire contents of the Module.php file for the speck-install module. I've copied and pasted what shows up below...
array( 'namespaces' => array( NAMESPACE => DIR . '/src/' . NAMESPACE, ), ), ); } public function getControllerConfig() { return array( 'invokables' => array( 'speck_install' => '\SpeckInstall\Controller\InstallController', ), ); } public function getServiceConfig() { return array( 'factories' => array( 'SpeckInstall\Mapper\Install' => function ($sm) { $mapper = new \SpeckInstall\Mapper\Install; $config = $sm->get('config'); if(isset($config['db'])) { $mapper->setDbAdapter($sm->get('Zend\Db\Adapter\Adapter')); } return $mapper; }, ), ); } public function getConfig() { return array( 'router' => array( 'routes' => array( 'install' => array( 'type' => 'Literal', 'options' => array( 'route' => '/install', 'defaults' => array( 'controller' => 'speck_install', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'schema' => array( 'type' => 'Literal', 'options' => array( 'route' => '/schema', 'defaults' => array( 'action' => 'schema', ), ), ), ), ), ), ), 'view_manager' => array( 'template_path_stack' => array( DIR . '/view' ), ), ); } public function onBootstrap($e) { if($e->getRequest() instanceof \Zend\Console\Request){ return; } $app = $e->getParam('application'); $em = $app->getEventManager(); $sm = $em->getSharedManager(); $em->attach(MvcEvent::EVENT_DISPATCH, array($this , 'install'), 100); //install event listener $sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'SpeckCatalog' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'SpeckContact' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'ZfcUser' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'SpeckAddress' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'SpeckCart' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'SpeckUserAddress' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'SpeckRandomProducts' ); }); //$sm->attach('SpeckInstall\Controller\InstallController', 'install.create_tables', function ($e) { return $this->createTables($e, 'SpeckOrder' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.setup_multisite', array($this, 'setupMultiSite')); $sm->attach('SpeckInstall\Controller\InstallController', 'install.setup_multisite', function ($e) { return $this->createTables($e, 'SpeckMultisite' ); }); $sm->attach('SpeckInstall\Controller\InstallController', 'install.setup_multisite', function ($e) { $name = $e->getParam('website_name'); $query = "insert into
website
(website_id
,name
)VALUES(1, '{$name}')"; $e->getParam('mapper')->query($query); return array('true', 'SpeckInstall inserted site name - "' . $name . '"'); }); } public function createTables($e, $moduleName) { $mm = $e->getTarget()->getServiceLocator()->get('modulemanager'); $module = $mm->getModule($moduleName); if(null === $module) { return array(false, 'Missing module - ' . $moduleName . ' - Did you run composer install?'); } $reflection = new \ReflectionClass($module); $path = dirname($reflection->getFileName()); try { $create = file_get_contents($path .'/data/schema.sql'); if(!$create) { throw new \Exception('cannot find schema file'); } $mapper = $e->getParam('mapper'); $mapper->query($create); } catch (\Exception $e) { return array(false, "SpeckInstaller was unable to complete 'createTables' for {$moduleName} - " . $e->getMessage()); } return array(true, "SpeckInstaller ran 'createTables' for {$moduleName}"); } public function setupMultisite($e) { $multisite = $e->getParam('multi_site'); $mm = $e->getTarget()->getServiceLocator()->get('modulemanager'); $module = $mm->getModule('SpeckMultisite'); if(null === $module) { return array(false, 'setup multisite - Missing module - SpeckMultisite - Did you run composer install?'); } $reflection = new \ReflectionClass($module); $path = dirname($reflection->getFileName()); try { $config = include($path .'/config/module.SpeckMultisite.dist.php'); $content = "getMessage()); } return array(true, "stored SpeckMultisite config"); } public function createZfcUserTables($e) { $this->createTables('ZfcUser'); } public function install($e) { if($e->getRouteMatch()->getParam('controller') === 'speck_install') { return; } $response = $e->getResponse(); $response->setStatusCode(307)->getHeaders()->addHeaderLine('Location', '/install'); } }The text was updated successfully, but these errors were encountered: