I have downloaded the CakePHP from it's site then I copied the files in srv/www/htdocs
renamed the folder to first_app
Here is the output(error and warnings that shows me):
Release Notes for CakePHP 2.0.0-dev.
Fatal error: Class 'Debugger' not found in /srv/www/htdocs/first_app/cake/libs/view/pages/home.ctp on line 26
also the tutorial tells me that I must have this:
Apache server with mod_rewrite
I didn't know how to find it and install it?
is that causing this problem?
I want to know how to add "another" root without having problem
I used this and no result:
<Directory /srv/www/htdocs/first_app/app/webroot>
Options None
AllowOverride All
Order deny,allow
Deny from all
</Directory>
also I changed the /etc/apache2/server-default.conf
I changed allow override None to Allow override All
in the part of this:
<Directory "/srv/www/htdocs">
chmod -R 0777 /srv/www/htdocs/first_app/app/tmp/
This makes the tmp dir writable for everybody (on your machine) so also for the web server. If you want to limit access, first try this, then browse to your CakePHP install, and then check in the cache dir which files have been created and what's the owner and group of those files.
The tmp dir contains more than just the cache dir, it also contains sessions and logs. Anything outside of /srv/www/htdocs/first_app/app/tmp/ does not need to be writable for the server, anything inside that folder should be writable.
The default CakePHP install comes with .htaccess files. You do need those files. They redirect every request to localhost/first_app (or any other dir your is installed in) into the webroot, so you don't have to do that yourself. You need to have AllowOverride All in your apache config. See here for instruction on how to enable that.
Please Go through these links
http://www.youtube.com/watch?v=9stiBWz71Ts
http://ubuntu-linux-apache-mysql-php.blogspot.com/2008/12/how-to-install-cakephp-on-linux-ubuntu.html
http://groups.google.com/group/cake-php/browse_thread/thread/3ba763933544ece
It may help you.
same problem on mac. on mac, i just right clicked on the directory it was concerned about and changed the permissions so that everyone could read/write, and clicked apply to enclosed files/folders.
I used to use linux but i'm not sure exactly how to do this, but hopefully this will get you on the right track? i assume that the command you posted changes the permissions of that folder, but maybe you need to change the permissions of the files and folders inside.
Related
I am developing a php project, having the project files stored on OneDrive so that I can access them from anywhere.
I have set up XAMPP, with a VirtualHost pointing to my project folder inside OneDrive so that I can run it in my browser.
This has been working great up until yesterday, when OneDrive started crashing and I had to reinstall it. Now I'm no longer able to run php files stored on OneDrive.
I get this error in my browser:
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'D:/OneDrive/MyProject/index.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0
My OneDrive folder is D:\OneDrive. If I set up a VirtualHost pointing to D:\, I am able to run files such as D:\index.php or D:\MyProject\index.php in my browser. But I'm not able to run files such as D:\OneDrive\index.php or D:\OneDrive\MyProject\index.php.
Does anyone have an idea what might cause this issue?
Edit:
The issue does not seem to be related to .htaccess, as the behavior is independent of whether a .htaccess file exists in the project folder or not.
Here is my VirtualHost, in case anyone is interested:
<VirtualHost *:80>
ServerAdmin webmaster#myproject.com
DocumentRoot "D:/OneDrive/MyProject/"
ServerName myproject.com
ServerAlias www.myproject.com
<Directory "D:/OneDrive/MyProject/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>
I've not been able to solve the issue, but I've found a workaround:
Store the project files outside of OneDrive.
Make a symbolic link in the OneDrive folder to the project folder outside of OneDrive.
With this setup I'm able to run my PHP application, since the project files are not physically located in the OneDrive folder, and the project files are still uploaded and backed up on OneDrive due to the symbolic link.
This bug is not fixed still. After Windows 10 May 2019 Update, the bug reappeared and it's not fixed by Microsoft.
I think you just have to right-click OneDrive's icon in the Notification area, choose Settings > Settings > and uncheck Files on Demand.
Optionally, you can leave that, but just right click the folder in OneDrive that's giving you grief and choose the option to always keep a local copy of the folder.
I think is fixed now (2018-11-26) - Now, sites are working again in OneDrive. I'm sure it was a OneDrive app problem that was fixed recently.
Maybe some one know the solution for my problem.
In localhost all works fine.
I bought vps server, install Ubuntu, and LAMP stack in it.
And now copy all files from localhost to live server, threw ftp.
I write ip/public in web browser and I see my projects mine path running well, but if I wanna go to url like ip/public/login it throws 404 error. (Now working only public address)
.htaccess in public folder is good.
Now I find If I write ip/public/index.php/login it works well, but I need that it work like in localhost
Try making a symbolic link to your public folder and using that as the URL of your project. For example, I have a project called inspections in my /var/www/html folder. If I try to access http://url/inspections I get an error:
403 Forbidden: You don't have permission to access /inspections/ on this server.
However, after calling this command:
ln -s /var/www/html/inspections/public /var/www/html/insp
And navigating to http://url/insp the page displays properly and everything works fine.
Another thing to keep in mind is that app/storage need to have write access (at least) in order for Laravel to work properly. I usually just do:
sudo chmod 777 -R app/storage
To activate all privileges and go from there. Hope that helps!
Also did you check if mod_rewrite is enabled on this server?
Maybe Overwrite is not defined for this folder?
Try:
<?php in_array('mod_rewrite', apache_get_modules()); ?>
Or this:
<?php die("Enabled: ". strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false); ?>
And check if Allowoverride is enabled in your virtual host file.
The location of the file depends on the operating system and structure.
It should look a little like this:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
i use moodle ( is a learning management system ), and this cms need to .htaccess
with his content . content of my .htaccess file is :
deny from all
AllowOverride None
Note: this file is broken intentionally, we do not want anybody to undo it in subdirectory!
but when i see my site i face this message :
You need to create the directory mdldata19 with web server write access
there is .htaccess in 'mdldata19' directory.
is better content for this file?
The missing directory probably has nothing to do with .htaccess, but rather Moodle requires a writable directory called mdldata19.
Create a directory mdldata19 whereever the documentation specifies it be created, and make it writable by the web server user. On Apache systems, this is usually a user called www-data, apache, httpd, or others. You would need to find out the user Apache is running under by looking for the following directive in httpd.conf:
User <apacheusername>
Group <apachegroupname>
Then change the directory's group ownership to the Apache user and make it group-writable
chown yourusername:apachegroup mdldata19
chmod g+rwx mdldata19
I have a folder in my root MAMP directory, "site". I have that symlinked to a folder in ~/Documents/Dropbox/site, so whatever happens in "site" gets transferred to Dropbox.
However, when I do this, I get a 403 forbidden error when trying to view localhost/site- is this a problem because I'm using PHP and I should fix php.ini, or is this an httpd.conf problem?
In httpd.conf, I have AllowOverride set to None.
Thanks for any answers in advance.
There's also the FollowSymlinks option in Apache, which is generally disabled by default. You can enable it by doing
Options +FollowSymlinks
This is a bit hacky, but I had this problem before and while the solution didn't necessarily make a whole lot of sense, it worked for me:
sudo su <username> to assume the user (eg, if your webserver is running as nobody, use nobody
If #1 is a user whose shell is something similar to /sbin/nologin, temporarily use usermod to change their shell to something you can use, like /bin/bash, before sudoing as them
Symlink as the user instead of root or whatever user this was done as previously
Reset any changes made in #2
Since symlinks are by default 0777, any normal process has read access provided that the destination directory is also of sufficient permissions (0644 would be fine) - for some reason Apache gave me problems with that to. Once I created the link as the user in question, it worked like a charm. HTH!
Edit: also, this almost goes without saying, but I'm assuming you verified the link yourself via a terminal to make sure that the link is correct, right?
I'm starting to unravel the mysteries of PHP and I configured the pre-installed Snow Leopard PHP and activated the Apache server in the system preferences. So far so good: it works if you put a PHP file in your ~/Sites directory.
Since I've my projects in a code/projects directory I created a symbolic link from the ~/Sites dir to the code/projects/one-project/php-dir and bang!, a 403 error: access forbidden.
I've been changing the permissions of the dirs to 777, but no luck.
Is anyone using the default Snow Leoapard configuration for PHP development and if so, how do you link to your codebase?
Thanks in advance,
Juan
Off the top of my head: it might be the FollowSymLink option in the Options directive of Apache (http://httpd.apache.org/docs/2.0/mod/core.html#options).
That might work if you set FollowSymLinks in your Apache config, but I suggest putting the PHP files under the web root directly.
One good method is to put the presentation files under the web root, and include/require any libraries directly from where they are in the code/projects directory (assuming that dir is readable by the web server user). The include dir shouldn't be writable by the web server, for security. Keep it owned by your user account, and set the permissions to 744.
I presume you have ~/code/projects/projectA/php-dir and ~/sites/php-dir
You need to make sure that the directory above the directory you're sym-linking is readable by the webserver. In this case you need to set the permissions on the folder to 755. Or at least that solved things for me.
you'll most likely need to add a Directory directive to your httpd.conf file as well...
<Directory code/projects/one-project/php-dir>
order allow,deny
allow from all
</Directory>
Above configuration allows access from all IP's, all hosts.
I myself use macports, I find it better since it isolates everything in the /opt directory. But it's a bit of work to get it running...