CakePHP on a Mac - Homebrew HTTPD - macos

I'm trying to run CakePHP 4 or 3.8 on macOS Catalina with Homebrew httpd and PHP 7.3.13
I run composer as mentioned on cookbook and installation goes well but, when try to run te app via browser I get this error:
safari screen
chrome screen
on error log message get "AH00052: child pid 10126 exit signal Illegal instruction (4)".
I have also the extensions intl, mbscript, pear, rewrite, etc enabled.
My virtual host is like this:
DocumentRoot "/Users/webdev/Sites/cakephp/webroot"
ServerName cakephp.localhost
<Directory "/Users/webdev/Sites/cakephp/webroot">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog "/Users/webdev/Sites/Error_Logs/error.log
the .htaccess file on root of app is:
RewriteEngine on
RewriteRule ^(\.well-known/.*)$ $1 [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
And in webroot folder is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I've already tried many suggestions but nothing solve the problem.
I don't know what to do more because, just CakePHP don't work and i've other apps like Laravel and work like a charm on this machine.
If anyone can help with solution, thanks in advance.

I figured out what being wrong in my case.
When I configured virtual host and hosts file to "something.localhost" server dropped connection.
Changed configuration to "something.something_else" in httpd-username.conf and /etc/hosts, all cake instances start working.
This works for me.

Related

Laravel version 5.7 root show index of page

Recently I am start using Laravel, and I develop a website in my local which works fine, but when I deploy it to a droplet in DigitalOcean, the root shows an index Of page.
Screen Capture is here
And when I navigate into the public folder, it shows a 500 error.
I have tried to include a few different .htaccess, which does not solve the problem. And my current .htaccess is below
DirectoryIndex index.php
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/index.php [L]
The line "Options -MultiViews" is actually part of the .htaccess code too.
Could anyone please help me to solve this problem?
Thank you in advance.
See more here
In the server config file is the AllowOverride set to All or None? If its set to none all .htaccess changes will be ignored.
<Directory /var/www/YOURAPP/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Don't forget to generate a key...
php artisan key:generate
https://laravel.com/docs/5.7/installation

Zend Server localhost and mod rewrite

I am using zend server and zend studio on my local windows machine php 7 with MySQL community installed.. I have went through several documents in order to set up my projects properly but I have ran into a issue.. I wanted to use the automatic upload and have the ability to enable back to local development. and have successfully done so.. my issue is that I had to deploy to localhost when I am not uploading to server in order to work with local..
mod re write is enabled and working.. but my first issue is that it seems to create 2 directories
The application name is orbit_cms
the application url: http://localhost/orbitcms
now I have a .htaccess in the folder orbitcms with the following.
RewriteEngine on
#Production
#RewriteCond %{REQUEST_FILENAME}.php -f
#RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]
#Development
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
then if I go to http://localhost/orbitcms/index.php it works,
but this will not
http://localhost/orbitcms/index
now if I put in the app folder name
http://localhost/orbit_cms/index it works
now zend writes a config when it deploys and here it is
Alias /orbitcms "C:\Program Files (x86)\Zend\ZendServer\data\apps\http\__default__\0\orbitcms\1.0.0_41/"
<Directory "C:\Program Files (x86)\Zend\ZendServer\data\apps\http\__default__\0\orbitcms\1.0.0_41/">
AllowOverride All
Options +Indexes +FollowSymLinks +ExecCGI
DirectoryIndex index.php
Require all granted
</Directory>
The other issue is the mod re write..
the production part does not work on localhost but the development one does.. any reason why?

Apache2 log not displayed for rewrite module and no rewrite

I've VPS in OVH and i developped website with j2ee and i associate apache with tomcat using mod_jk.
when i enter url http://ip_of_vps/myapp, i enter to website.
until now it's ok
now i add rewrite for access to website using only ip_of_vps without context (myapp), for this i'm using Rewrite in apache2.config like this :
<virtualhost *:80>
RewriteEngine On
LogLevel alert rewrite:trace6
RewriteRule ^/$ http://ip_of_vps/myapp/ [P,L]
</virtualhost>
And i change All AllowOverride in directory from none to All
when i try to access to http://ip_of_vps, i've apache2 home page.
what i've forgot ?
I'm using ubuntu 14.04 server, apache2, tomcat7.
Off the top of my head, typically you would write
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
ReWriteRule your rule
</IfModule>
so, is mod_rewrite actually loaded?
do you need your RewriteBase to be /myapp/ ?
my suggestion would be to put a .htaccess in your html root directory
with a rule like
RewriteRule ^myapp/(.*)$ $1 [L]
this way you wont need mod_proxy at all
hope this helps

How do I get rid of the need for the "/app.php/" in a new Symfony2 app's production URL?

I've done a 1st install of Symfony2,
php app/console --version
Symfony version 2.0.11 - app/dev/debug
I installed it under an existing DocumentRoot by configuring my apache2 server vhost
<VirtualHost 127.0.0.1:80>
...
DocumentRoot /srv/www/localhost_www
...
<Directory "/srv/www/localhost_www" >
AllowOverride none
Options -ExecCGI +FollowSymLinks +Includes +Indexes +MultiViews
Order Allow,Deny
Allow from All
</Directory>
...
Alias /TESTAPP "/srv/www/TESTAPP/web/"
<Directory "/srv/www/TESTAPP/web/">
Options All
AllowOverride All
Allow from All
</Directory>
Alias /TESTAPP.symfony "/srv/www/TESTAPP/"
<Directory "/srv/www/TESTAPP/">
Options All
AllowOverride All
Allow from All
</Directory>
...
After an OK install, and successfully following "The Book" to build the demo "Hello" app, if I nav in a browser to any/all of,
dev:
http://localhost/TESTAPP.symfony/web/app_dev.php/hello/ME
http://localhost/TESTAPP/app_dev.php/hello/ME
prod:
http://localhost/TESTAPP.symfony/web/app.php/hello/ME
http://localhost/TESTAPP/app.php/hello/ME
I see the expected,
"Hello ME!"
I want to rewrite only the production URLs, hiding "app.php" so that the following set of URLs work in the nav bar of a browser for my Symfony2 app:
dev:
http://localhost/TESTAPP.symfony/web/app_dev.php/hello/ME
http://localhost/TESTAPP/app_dev.php/hello/ME
prod:
!! http://localhost/TESTAPP.symfony/web/hello/ME
!! http://localhost/TESTAPP/hello/ME
Iiuc, the default web/.htaccess
cat web/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
needs to change.
I've dug around in the docs and on the web, tried vdiffferent recommendations for modding the RewriteRule, adding 'RedirectMatch permanent', etc., and I'm not managing to get a simple
http://localhost/TESTAPP/hello/ME
to ever work. I always seem to need to add the "/app.php/".
What are the specific changes I'd need to make in order to get this to work?
Thanks.
#chasen
is mod_rewrite enabled for apache?
yes
if you have your .htaccess file in your web directory
i do
and you host file pointing to the web folder the
it is, as above,
Alias /TESTAPP "/srv/www/TESTAPP/web/"
<Directory "/srv/www/TESTAPP/web/">
app.php should not be needed.
that's my problem. without it, it's not working for me.
Specifically,
https://localhost/TESTAPP/app.php/hello/ME
returns:
"Hello Me!"
but
https://localhost/TESTAPP/hello/ME
returns
Object not found!
The requested URL was not found on this server.
If you entered the URL manually please check your
spelling and try again.
If you think this is a server error, please contact
the webmaster.
Error 404
i know that its a silly question but is mod_rewrite enabled for apache?
if you have your .htaccess file in your web directory and you host file pointing to the web folder the app.php should not be needed.
if you are running ubuntu or a similar distro you can do:
sudo a2enmod rewrite
sudo service apache2 reload
sudo service apache2 restart
That should enable the mod, and reload apache.
EDIT:
That response you are getting back is it in a symfony page? if it is its likely that your prod cache needs to be cleared, from the root directory for the application use the symfony console to clear the cache:
php app/console cache:clear --env="prod"
EDIT:
If neither of those have worked you may try adding a RewriteBase to the htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /TESTAPP
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
In my case I need to modify the line containing AllowOverride None to read AllowOverride All. This tells Apache that it's okay to allow .htaccess files to over-ride previous directives. You must reload Apache before this change will have an effect (https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles):
Do this: - go to "/etc/apache2" modify file "apache2.conf" section:
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Require all granted
restart server: /etc/apache2# service apache2 restart
it should work. If it does not work, still you have done 1 step right to insure .htaccess is allowed to override. There are many other reasons can be fixed with the above instruction.
Adding the RewriteBase rule with the name of the folder in which the project is held to the .htaccess file does it's job! Thanks!
RewriteBase /project_name

mod_rewrite not working

I'm new to server administration but I was able to get a LAMP setup running on my new VPS. I uploaded a few web files that work on my other server, but they seem to give me the error: "File does not exist" in my /var/log/apache2/error.log file. The homepage loads just fine through my scripting, but other pages don't.
.htaccess file code
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?r=$1 [L,QSA]
I have enabled mod_rewrite on the server and can see it running under my phpinfo() page I have created. Simply don't know why this issue is happening. If I need to post anything else, please let me know :)
It looks like your site or virtual host has not been granted the appropriate permissions to process .htaccess files. You can test it easily by making a syntax error on purpose: if your site does not crash, the file is being ignored.
Try something like this in your main httpd.conf file:
<Directory "/path/to/your/site">
AllowOverride All
</Directory>
... or this (to your liking):
<VirtualHost *:80>
AllowOverride All
</VirtualHost>
When I had this problem it turned out that the /etc/apache2/sites-enabled/000-default had the AllowOverride All, but the /etc/apache2/apache2.conf also had the same entry for our web Directory with AllowOverwrite None. So be sure to check both places!
ERROR: Module rewrite does not exist
February 21, 2014 by Sharad Chhetri Leave a Comment
While working on Apache Module in Ubuntu,I found rewrite problem in Apache Web Server.I tried to enable the rewrite module but got this error ERROR: Module rewrite does not exist!.After troubleshooting,I found the problem was with mod_rewrite module.
After doing some more troubleshooting,it is found that the rewrite.load file was missing in /etc/apache2/mods-available/ .
Now,I checked the mod_rewrite.so actual module file and Wow it was there.
Below given is step by step command which I ran,to solve this issue.Here is the reference from my system
root#tuxworld:~# a2enmod rewrite
ERROR: Module rewrite does not exist!
root#tuxworld:~# ls -l /usr/lib/apache2/modules/mod_rewrite.so
-rw-r--r-- 1 root root 58728 May 28 2020 /usr/lib/apache2/modules/mod_rewrite.so
root#tuxworld:~#
root#tuxworld:~# echo "LoadModule rewrite_module
/usr/lib/apache2/modules/mod_rewrite.so" > /etc/apache2/mods-available/rewrite.load
root#tuxworld:~#
root#tuxworld:~# a2enmod rewriteEnabling module rewrite.
To activate the new configuration, you need to run:
service apache2 restart
root#tuxworld:~#
After this I restarted the apache2 service
sudo service apache2 restart

Resources