Home » Php » php – Zend Framework – 500 Internal Server Error

php – Zend Framework – 500 Internal Server Error

Posted by: admin July 12, 2020 Leave a comment

Questions:

Today I create my first project with Zend Framework but when I try to connect to my project I see only “500 Internal Server Error”. I add some new rows in httpd.conf file:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot C:\AppServ\www\data1\public
ServerName my_ip
</VirtualHost>

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot C:\AppServ\www\data1\public
ServerName http://my_ip
</VirtualHost>

And that is my htaccess file:

RewriteEngine On
#RewriteBase data1/public/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|html|pps)$ index.php [NC,L]

order allow,deny
allow from all

I read more topics for this problem but for now problem is not solved.

That is my error.log file(from server):

[Wed Aug 08 01:46:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:/AppServ\php5        \ext\php_exif.dll' - \xd3\xea\xe0\xe7\xe0\xed\xe0\xf2\xe0 \xef\xf0\xee\xf6\xe5\xe4 \xf3\xf0\xe0 \xed\xe5 \xe5 \xed\xe0\xec\xe5\xf0\xe5\xed\xe0.\r\n in Unknown on line 0
[Wed Aug 08 01:46:02 2012] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Wed Aug 08 01:46:02 2012] [notice] Server built: Jan 18 2008 00:37:19
[Wed Aug 08 01:46:02 2012] [notice] Parent: Created child process 2392
[Wed Aug 08 01:46:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Wed Aug 08 01:46:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:/AppServ\php5\ext\php_exif.dll' - \xd3\xea\xe0\xe7\xe0\xed\xe0\xf2\xe0 \xef\xf0\xee\xf6\xe5\xe4\xf3\xf0\xe0 \xed\xe5 \xe5 \xed\xe0\xec\xe5\xf0\xe5\xed\xe0.\r\n in Unknown on line 0
[Wed Aug 08 01:46:02 2012] [notice] Child 2392: Child process is running
[Wed Aug 08 01:46:02 2012] [notice] Child 2392: Acquired the start mutex.
[Wed Aug 08 01:46:02 2012] [notice] Child 2392: Starting 64 worker threads.
[Wed Aug 08 01:46:02 2012] [notice] Child 2392: Starting thread to listen on port 80.
[Wed Aug 08 01:46:15 2012] [alert] [client 46.40.124.225] C:/AppServ/www/data1/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
How to&Answers:

Thanks for posting the error log.

From the looks of it, you don’t have mod_rewrite loaded.

Find your httpd.conf file and locate the line:

#LoadModule rewrite_module modules/mod_rewrite.so

Remove the # sign from the beginning of the line.

Next, add a new section to httpd.conf that looks like this:

<Directory "C:/AppServ/www/data1/public">
    Options FollowSymLinks
    AllowOverride All
</Directory>

The AllowOverride directive is important. By default, .htaccess files are not processed unless allowed. This line allows .htaccess files in that named directory.

After making those changes, restart Apache and then try loading your ZF page again.

Answer:

First of all, a better debugging. Add

    ErrorLog "PATH_TO/zfapp-error_log"
    CustomLog "PATH_TP/zfapp-access_log" combined

to your virtualhost. Restart apache and reload your page. The files will be created in the specified path. There will be an exact error message wich will help you debug further.

Answer:

I just had the exact same problem and the solution by drew010 did fix it indeed!

However, it seems Apache config structure changed, so the method to enable the missing module is slightly different:

$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/rewrite.load ./rewrite.load

This confirms you have the right stuff going:

$ cd /etc/apache2/mods-enabled
$ cat ./rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

Cheers!