While intsalling cakephp on ububtu 11.10 give rewrite_module error - php

I am attempting to install cakephp-1.3 on Ubuntu 11.10. I have finished all the required changes in the configuration file as mention in http://book.cakephp.org.
It shows all database connections as being setup.
Temp folder is rewrite-able.
But it give me an apache module rewrite error. I have checked the apache rewrite mode and it is enabled.
But I still get the URL_REWRITE error repeatedly and am unsure how to proceed. All help appreciated.

You should check if mod_rewrite is actually on. To do that, make a php file with
<?php php_info(); ?>
in your web root folder. At Loaded Modules you should see mod_rewrite.
If not, check for the line:
LoadModule rewrite_module modules/mod_rewrite.so
In httpd.conf (apache2.conf in UBUNTU > /etc/apache2/apache2.conf). It must be uncomented (without ; in front).
Check if AllowOverride option is on for your project. To do that, add the following line at the end of httpd.conf (apache2.conf in UBUNTU)
<Directory "/var/www/myProjectName">
AllowOverride all
</Directory>

Related

localhost/~username is not working, gives 404 Not Found error

I am fairly new to server-side web development and am trying to get a local server up and running. I'm using an apache 2 server on my mac, but can't for the life of me get localhost to give me anything but 404 Not Found error. I'm putting localhost/~ and my username in the search bar and still nothing. I've been following a lynda.com tutorial to configure my personal site folder and haven't had any luck.
I'm trying to configure a personal site folder, or at least that is the terminology used in the tutorial. I created a "Sites" folder in my home directory. Then, I put an "index.html" file in the "Sites" folder to test.
After that, I configured a "httpd.conf" file through my terminal by entering "sudo nano/etc/apache2/httpd.conf". He had me un-comment the following lines:
LoadModule userdir_module libexec/apache2/mod_userdir.so
Include /private/etc/apache2/extra/httpd-userdir.conf
After doing this, I exited the file and saved the changes. I then entered into the terminal:
sudo nano /etc/apache2/extra/httpd-userdir.conf
Here I uncommented the following line:
Include /private/etc/apache2/users/*.conf
I then entered into the terminal
cd /etc/apache2/
And then:
cd users
I entered:
sudo nano jacobbryant.conf
In this file, I made sure it only contained:
<Directory "/Users/jacobbryant/Sites/">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
I then exited this file and restarted the apache server with:
sudo apachectl restart
After this, I went to my browser and typed in "localhost/~jacobbryant" and got a "404 Not Found" error.
I am not sure what #jhilgeman is talking about. Apache has an extension for Per-user web directories that must be setup in order to map ~username to the home directory specified in the configuration. It looks like you have enabled the correct extension but missed the UserDir directive.
For Example: UserDir public_html will serve /home/myuser/public_html at http://your.host.tld/~myuser/
For you example, ditch the <Directory> and use the UserDir directive instead. Please read over https://httpd.apache.org/docs/2.4/howto/public_html.html for setup instructions.

PHP Symfony apps on OSX El Capitan apache

I have installed the symfony_demo application on El Capitan (10.11.2)
If I run the inbuilt PHP server as follows:
php app/console server:run 127.0.0.1:8111
the demo application is Live at localhost:8111
but if I access the application via El Capitan's inbuilt apache instance (by copying it into my <user>/Sites directory), I just get a directory listing.
Note that I do have PHP enabled on apache, and other PHP-based applications run through apache as currently configured (e.g. Joomla).
What more configuration of apache do I need?
Addendum:
I am running the Server version of the OS. I read that there exists another apache configuration file at: /Library/Server/Web/Config/apache2/httpd_server_app.conf
But uncommenting the vhosts .conf and .so directives and restarting 'Websites' via the Server app in this file made no difference to the behaviour
You'll need to uncomment few lines in your /etc/apache2/httpd.conf. Remove the # in front of the following lines if it's there (these lines are in different parts of the file):
LoadModule php5_module libexec/apache2/libphp5.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
Include /private/etc/apache2/extra/httpd-vhosts.conf
Next, you can edit /etc/apache2/extra/httpd-vhosts.conf to define your virtual hosts. For example if your project is located in /Users/username/Sites/symfony (replace "username" with your username, and "symfony" with you project directory):
<VirtualHost *:80>
ServerName symfony.dev
DocumentRoot "/Users/username/Sites/symfony/web/"
<Directory "/Users/username/Sites/symfony/web/">
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
In the example I used a fake domain symfony.dev. If you want to use it you'll need to add it to your /etc/hosts file (add a new line there):
127.0.0.1 symfony.dev
After changing apache's configuration don't forget to restart it:
sudo /usr/sbin/apachectl restart
You might need to adapt the vhost config to your needs. Read more about configuring the web server in the Symfony documentation.
Success!
The pivotal information here is that the Server version of OSX has it's own configuration which disables .htaccess redirection by default.
After finding the setting in Server > Websites > Server Website (edit) > Edit Advanced Settings > "Allow overrides using .htaccess files
And restarting Websites, the symfony demo works fine at http://localhost/symfony_demo/web/
n.b.: No need for vhosts - that's merely a convenience

how do I enable execution of php scripts in the per-user public_html directories

I have a php script to upload files in a directory.
This works fine in apache's DocumentRoot.
When I copy the code in my /home/$USER/public_html , instead of the right output I just when a printout of the php file. I presume it does not get executed.
I was looking into the userDir module and found this
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
includesNoExec looked promising but it is related to cgi only.
So how can I enable php scripts to be executed for every user?
Try setting this configuration:
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine On
</Directory>
</IfModule>
Don't forget to restart Apache.
service apache2 restart
It turns out the important bit of code that Claudix provided is already present in the configuration files under /etc/apache2/mods-available/php5.conf
the clause there contains php_admin_value engine Off , so by setting the Claudix solution anywhere will conflict with this setting. What is more, the comment above suggests NOT to set php_admin_value engine On as it renders .htaccess files unable to disable php.
As such the correct way to run php in user www directories is by commenting out the relevant text in /etc/apache2/mods-available/php5.conf
I assume you are using apache2 on debian like I do and I think the solution
for you is to add Alias dir and set that alias dir config like below
1 edit the apache2 configuration from terminal run this command
sudo gedit /etc/apache2/sites-enabled/000-default
2 edit the path you will to execute PHP files and save
Alias /testdir /home/user/testdir
<Directory /home/user/testdir>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
</Directory>
3 restart apache2
sudo service apache2 restart
check If you can access the folder from browser if not probably you will have to chmod/chown the folder
yourhost/testdir
According to Apache 2.2 documentation this can be done by uncommenting this configuration line:
#Include conf/extra/httpd-userdir.conf
and modifying httpd-userdir.conf to suit your server. Based on your qustion text, this should resolve your issue.

Postgresql, phpPgAdmin in xammp

Hi I have this error while I'm trying to launch phpPgAdmin:
Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option.
I'm using XAMPP ver 1.7.7, Postgresql 9.2.4 64 bit, and phpPgAdmin 5.1.
I already did the following:
Open config.inc.php found in C:\xampp\phpPgAdmin\conf\ and set extra_login_security to false
$conf['extra_login_security'] = false;
Find php.ini file in C:\xampp\php\, then look for the line ; extension = php_pgsql.dll. Remove tag ;, so that the
result was extension = php_pgsql.dll.
(although I found php.ini- production and development so I uncomment them both)
Open C:\xampp\apache\conf\extra\httpd-xampp.conf and in section <IfModule mime_module> add
Alias /phppgadmin "c:/xampp/phpPgAdmin/"
<Directory "c:/xampp/phpPgAdmin">
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
LoadFile “C:/xammp/php/libpq.dll”
but I still get this error. Can someone help me?
I am writing the answer from the beginning, not everything what you tried was wrong.
xampp is up and running.
Download phpPgAdmin and copy it into c:\xampp\phpPgAdmin
Modify the config file
C:\xampp\apache\conf\extra\httpd-xampp.conf
Add like phpMyAdmin part the phpPgAdmin part:
Alias /phppgadmin "C:/xampp/phpPgAdmin/"
<Directory "C:/xampp/phpPgAdmin">
AllowOverride AuthConfig
Require all granted
</Directory>
Restart apache and enter in browser
http://127.0.0.1/phppgadmin/
Now you would get the message: install php with –-pqsql option
Postgres installation and the configuration:
Install postgresql 32bit even if you have 64bit windows (this is not a joke)
Postgres is now up and running
Modify again the config file
C:\xampp\apache\conf\extra\httpd-xampp.conf
Add the following line (in my case PostgreSQL is installed in C:/xampp/PostgreSQL):
LoadFile "C:/xampp/PostgreSQL/bin/libpq.dll"
before the following existing lines
LoadFile "C:/xampp/php/php5ts.dll"
LoadModule php5_module "C:/xampp/php/php5apache2_4.dll"
Modify the config file
C:\xampp\php\php.ini
Uncomment the following line by removing ';'
;extension=php_pgsql.dll
Restart apache and enter again in your browser
http://127.0.0.1/phppgadmin/
It should work, it works for me
Not need to install postgresql 32 bit version just enable php_pgsql.dll extension in your php.ini file and do restart apache service
event though you get error like "cdbconnection failed to open the db connection could not find driver postgresql" then
please add below line in php.ini file and restart apache
extension=php_pdo_pgsql
Now it should work perfact
Just make sure in your C:\xampp\php\php.ini to uncomment the following line by removing ';'
extension=php_pdo_pgsql
extension=pgsql
or if you don't have those lines then add them.
Then restart Apache and it should work just fine.

Integration of postgreSQL on WAMP

I have just installed the postgreSQL on windows 7. I am trying to integrate postgreSQL with WAMP server.
For this i have done the following changes in httpd.conf and php.ini file
1 LoadModule c:/path to libpq.dll in httpd.conf and then
2 extension=php_mod_pgsql.dll, extension=php_pgsql.dll -- enable(reemove ;) in php.ini
If I do the above changes the localhost does not work.
If I do the second changes the localhost work but does not load the libpq.dll.
I checked the pgsql by php script by this
<?php
echo extension_loaded('pgsql') ? 'yes':'no';
?>
The script shows "yes", but apache is not loading the libpq.dll.
Now what i should do for load the postgreSQL into the Apache2.2* (wamp)
After installation of PostgreSQL, you need to copy libpq.dll from wamp\bin\php\phpX.X.X to wamp\bin\apache\Apache2.2*\bin . And restart the Wampserver.
Download phpPgAdmin here.
Extract phpPgAdmin-5.1.zip in C:\wamp\apps So the path will be, C:\wamp\apps\phpPgAdmin-5.1.
Create a file called phppgadmin.conf in C:\wamp\alias. And copy paste the following :
Alias /phppgadmin "C:/wamp/apps/phpPgAdmin-5.1/"
<Directory "C:/wamp/apps/phpPgAdmin-5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
Left Click on the Wampserver Tray icon. Navigate to PHP > PHP extension. Then enable this
a. php_pgsql
b. php_pdo_pgsql extension.
Open C:\wamp\apps\phpPgAdmin-5.1\conf\config.inc.php,
a. find $conf['servers'][0]['host'] = ''; change to $conf['servers'][0]['host'] = 'localhost';
b. find $conf['extra_login_security'] = true; change true to false
Restart All service
Go to http://localhost/phppgadmin/ and try to login.
Default Login credentials are
Username = "postgres"
Password = "root"
references :
WAMP + PostgreSQL integration
sourceforgenet phpPgAdmin downloadable for Windows with Wamp
Thank you. These instructions worked once I also added
'Require local' to the phppgadmin.conf file:
Alias /phppgadmin "C:/wamp/apps/phpPgAdmin-5.1/"
<Directory "C:/wamp/apps/phpPgAdmin-5.1/">
Require local
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
Don't forget that WAMP has two php.ini files. One in Apache directory, one in php directory (bin\php\php5.X.X). Wampserver Tray manages the one in Apache directory.
To be able to run php cli tools (e.g php artisan), you need to uncomment the php_pgsql and php_pdo_pgsql in the php.ini in php directory.
it worked thank you
Alias /phppgadmin "C:/wamp/apps/phpPgAdmin-5.1/"
<Directory "C:/wamp/apps/phpPgAdmin-5.1/">
Require local
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
Probably the best place to start is with the msdn docs. It looks like the simplest fix is to set the %PATH% environment variable system-wide to include the path to libpq.dll.
Note that %PATH is searched last, so if a libpq is ever put into the system directory or the Apache directory it will be caught first.
After Enabling Postgresql extension from WAMP icon i was able to get postgresql admin page but bin/cake bake all command was failing with error 'php extn missing'.
(referred #rails_id's post below to complete postgresql integration with WAMP)
checked in cmd prompt with php -m, no "postgresql" module was present.
Went to php installation directory, in my case it was "C:\wamp64\bin\php\php7.2.10" and enabled (removed the ;) following pg module in php.ini file:
extension=pdo_pgsql
extension=pgsql
restarted the wamp services.
bin/cake bake all is working fine from command prompt.
Not sure why you are checking this page , but even after trying all the above and following other pages only for the reason that you have wamp already iinstalled .. then dont waste your time .
checkout below link
https://bitnami.com/ which makes you wamp integration with postgreSQL damn easy ,without WAMP server :b ,
And now start your project right away !!

Categories