I have just setup the LAMP server on Debian. The initial tests were fine. After that, I've decided to change the home directory from "/var/www/" to something like "/home/user/public_html/". I did this changes in "/etc/apache2/sites-available/default".
The problem I am facing now is, that the PHP does not work in the new home folder. PHP sites are now parsed as text files and I can see the full source in browser (when clicking on view page source).
What can I do, that the PHP will also work under that path (and not only under /var/www)?
Look in php.ini in your php folder. There should be entries to change to 'doc_root' as well as 'extension_dir'. Make sure these are set, then restart Apache and it should work.
Related
It took me all day to find what is happening; however, I found nothing.I am using Dreamweaver CS6. I want to set up a local Apache testing server as to run .php files. I did that. I 've followed the instructions given by Adobe, correctly. Everything is OK with the testing server since my .php files are running. The problem I cannot solve is the following: My main file index.php does not recognize any changes in any external .css file which of course is declared inside the head section. For example,
<link href="mycss/pb.css" rel="stylesheet" type="text/css">
where mycss is a folder inside htdocs/tester/ and tester is the folder inside which there are all the site files. There is no error in any path; in case I remove the Apache server everything works fine. There is no error in paths in Dreamweaver Apache setup:
Server Name: Local Apache
Connect using: Local/Network
Server Folder:C:\xampp\htdocs\tester
Web URL: //localhost/tester/
(with http: in the beginning)
However, any change made in pb.css is ignored by index.php!! This is crazy... I suspect this is a matter of php.ini, .htaccess, httpd.conf, I do not know what. I'd appreciate your help.
Thank you very much
Make sure the file is in the correct path.
Also press ctrl+F5 to refresh and clear the cache. Because the css file is stored in the cache of the browser so you don't have to download it each time. It just loads it then.
As you can see, it gives me a weird view. I use apache+php5+mysql for my wordpress, and everything seems to work right during installation of Wordpress. But it just gives me such a strange scene.
Has anyone seen similar problem as I do? When could be the reason for this?
Can't say for sure without visiting the site, but it looks like you didn't add index.php to DirectoryIndex in your httpd.conf file (for Apache, or whatever the equivalent is in whichever server you're using)
I am not sure - pic resolution is low but it looks like the directory contents. make sure php is (a) installed (b) enabled on the directory (c) after you make changes to the server config, restart it (d) php files are set to execute php interpreter
I have Code Igniter based site and I have it on ubuntu 12.04 in /var/www/mysite folder
My ubuntu serves as a server so I access my site trough other computer, but both computers are on LAN network. I use http://xxx.yyy.zzz.ttt/mysite url to access it.
The problem I have is that I cannot use url without "index.php" in it.
So I have http://xxx.yyy.zzz.ttt/mysite/index.php/phpinfo To acces my controller phpinfo instead of http://xxx.yyy.zzz.ttt/mysite/phpinfo
I have cheked well that mod_revrite works well with this here
And also checked that the folder, files and subfolders in mysite have all 777 file permissions.
I also added all necessary rules in .htaccess file but still no success
Any idea what is causing this.
The first thing I would do is make sure you followed all of the CI instructions.
It may be that you did not update the config file to be a blank string rather than using index.php
Do you know what was the issue.
The default file in sites-available had option
AllowOverride None for /var/wwww
I set it to All and it worked out. :)
cheers :)
I have to do a php project. I done php before so I understand the syntax for the most part. Just for a test, I made a file.php and in it I wrote:
<html>
<body>
<?php echo "helloWorld"; ?>
</body>
</html>
Well it won't display. The screen is blank. I tried it in chrome, firefox, IE and nothing wants to dispaly. Actually in IE, the source is displayed which is wierd. I also tried it without all the html and just used xampp to render it. It will not work. If I right click tho in the browser and view source, the code is there. Any ideas on what's going on?
Well, it comes from your web server configuration. If you're using Apache, have you enabled the mod-php module?
If you're new to setting up your own server, i would recommend using XAMPP (or WAMP), these are preconfigured PHP, Apache and MySQL servers.
If you're sure you have setup your server correctly check the following:
Make sure your executing your files from the server directory and NOT from a local directory. (your URL should look something like "http://localhost/test.php")
Note: You will need to phisically store the files in a place the apache server will look for, an example from XAMPP (on Windows, as thats what im assuming your using) is: "C:\xampp\htdocs"
Make sure your file ends in .php or something else that the Apache server will pickup as a PHP file. (.php3, .php4, etc)(make sure you didn't accidentally leave a .txt or something like that at the very end)
Check mod-php module is enabled (as Julien mentioned)
Hope that helps!
Edit:
Try
<?php
phpinfo();
?>
That as well, it should give you the php configuration information if the server is setup correctly.
EDIT2:
I see that you are using XAMPP, double check that the following file exists at the very least:
"C:\xampp\apache\conf\extra\httpd-xampp.conf", it loads the PHP module
I've just installed LAMP on my Ubuntu 9.10 machine, and everything works fine except when I copy my PHP files from another computer.
The LAMP guides I've followed also made me create a phpinfo() test file, which works, but when I try to type in e.g. index.php absolutely nothing happens - just a blank page in FireFox. :(
The files are in the exact same directory.
I'm thinking it's probably something with permissions and so on, but since I'm new to both PHP and Ubuntu, I'm kind of lost. It's like I can't create a PHP file with my file browser, but only by using the terminal - like when I created the testing.php from the LAMP guide.
Whaddayaknow... I made an error, tried to:
echo "Hello" world
which, even though I'm a PHP noob, I clearly know is wrong.
I think I'll have to figure out how to enable some sort of error reporting, a blank page is clearly not good enough.
You mean you have a index.php (copied from another computer) and a test.php (edited by hand, with a call to phpinfo()) in the same apache directory, the second works from your browser and the first doesnt ?
That can be a permission issue, or some compilation error in your php.
About permissions, for files should be readable from the apache server (more precisely, form the user that runs the apache server). You can type chmod a+r index.php.
YOu can also check your apache error logs (location dependent on installation). In any case it's vital to know where the error logs are if your are developing a web site.