red888
red888

Reputation: 31662

zend 2 not loading with apache on my computer

Trying to setup zend with apache on my latop running linux mint 16. I'm not sure what I could have missed in the setup, but when I navigate to localhost I just get a blank page.

Install apaache,php, enabled mod_rewrite:

apt-get install apache2
apt-get install php5
apt-get install libapache2-mod-php5
a2enmod rewrite

Copied my zend app (built with the skeleton) to /var/www/t1 (t1 is the app's folder)

Edited: /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    DocumentRoot /var/www/t1/public
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/t1/public/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

RewriteEngine off

<Location />
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ /index.php [NC,L]
</Location>

    LogLevel warn

</VirtualHost>

Restarted apache

service apache2 stop
service apache2 start

When I browse to http://localhost I just get a blank page.

edit: After turning on error reporting I found the error was:

Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in /var/www/t1/config/autoload/global.php on line 19

This was because I forgot to install the mysql module so after doing that it solved the issue.

sudo apt-get install php5-mysql

Upvotes: 0

Views: 180

Answers (1)

Ocramius
Ocramius

Reputation: 25440

You probably need to add ini_set('display_errors', 1') and ini_set('error_reporting', E_ALL) at the top of your public/index.php, or do that in your php.ini. You are probably having an exception which is happening before ZF2 can catch it (setup related).

That will in first place allow you to see what the error is, and then it is usually trivial to fix it and move on.

Upvotes: 3

Related Questions