I have a .htaccess file in a php project, I have the apache2 server downloaded and running, but it ignores my project's .htaccess.
When I test the project on Windows or put it on my hosting it works normally.
I already tried to edit the apache2.conf file, among several other methods that I found to solve, and nothing worked, the project worked correctly on the computer of my friends who have linux.
I start the project with the command php -S localhost: 1990 inside the folder that has my files, I tried other ways and nothing worked.
Can someone help me? I've been looking for a long time and nothing has resolved.
I apologize for my English, I'm Brazilian and I still can't speak English very well.
I start the project with the command php -S localhost: 1990
This uses the webserver built-in to PHP, not Apache. Consequently, this does not use a .htaccess file (or apache2.conf).
You need to call your PHP files through Apache - which you say is already "running". (?)
(Aside: There should be no space between localhost: and 1990.)
Reference:
https://www.php.net/manual/en/features.commandline.webserver.php
Related
Here's the steps I took:
1)
2)
3)
For some reason I'm not able to figure out, this is not working. I'm a novice and I'm currently stuck here.
Any help will be much appreciated!
Thank you in advance,
Gabriel
you should consider installing apache webserver and setup the host file in your pc
Apache :
https://knowledgebase.progress.com/articles/Article/How-to-install-Apache-HTTP-Server-on-Windows-Server
Set Hosts file in win :
https://docs.serverpress.com/article/176-windows-10-and-localhost-is-blank
Create a new folder and then go to it in cmd using cd command. And move the file into it.
Then start the php server again and acces it using this link:
localhost:4000/site.php
Or install apache server as #mshahien said.
You can use xampp.
You are running php -S in the wrong directory.
The www directory is inside a directory called php somewhere inside your One Drive directory, but you are running php -S from a directory called i346241.
The server started by php -S takes the current directory to be the root of the development server.
How can I modify .htaccess and httpd.conf in Heroku? I connected it with a repository on Github.
In Github I've tried multiple things, those all don't work. Putting httpd.conf in a folder called /conf/httpd/default.conf didn't work, not sure not even in the repo root it worked, when I tried to put httpd.conf and .htaccess in there, nothing ever happens and I'm not sure why.
I am using the apache2 buildpack from Heroku that is inside a Procfile heroku-php-apache2
I am trying to tell the httpd.conf to parse .html also with php, so I can include things in it.
There is that thing on Github https://github.com/heroku/heroku-buildpack-php not sure if that can help.
Update:
Apperantly when using -c httpd.conf to tell where the httpd.conf is, it started recognising it and using it, what I get now is this:
no listening sockets available, shutting down
Update:
I used -C httpd.conf and it included it now, the problem is
The changes I want to make do not really apply. I'm trying to parse HTML also as PHP.
I just ended up using PHP.
You could try it with a custom buildpack but I don't know how to make one so it can actually use it's own httpd.conf and not the one from the heroku php buildpack.
I have a web application that is writen in php using cake framework. In windows environment i use wamp and it works find if i enbale apache read_write. Then I shift to use Linux environment Ubuntu 15. I have installed apache2 already and php too. it is all work. But when I put my app in /var/www in ubuntu and open the web page it said that the require_once function cannot file the location of the file.
I already change the owner of the www/* to www-data already, but it is still not work. mod_readwrite of apache is also enabled. So I want to know how could I enable read_write in Lamp like in wamp that I did on window? I met the same error in window if I don't enable it. So think it is the problem. Can anyone help me to solve this problem?
One thing you will want to check for is that you're using the proper directory separator in any paths you're using for your require statements (this can be done by using the DIRECTORY_SEPARATOR constant in place of hard coded slashes in your paths)
Another thing you will want to do is look at the apache configuration for each environment and ensure that they are the same. In particular check to ensure that your virtual hosts are defined correctly.
This is driving me nuts.
I've reduced my problem to this: I have a simple file 'test.php' that invokes a php file (this is from a bigger application, so in fact we need to execute many php scripts from a main script):
<?php
exec("php /var/www/setActive.php 273 1 2>&1",$arO,$nO);
echo $nO.'|'.implode(',',$arO);
The original path for setActive.php is way longer, I shortened it for this example.
Now, if I try:
[root#stg]# sudo -u apache php test.php
I get:
0|
Great, this means the setActive.php script ran smoothly.
Now, if I try it from a browser or from curl:
[root#stg]#curl http://my.url/path/test.php
This is what I get:
1|Could not open input file: /var/www/setActive.php
I already reviewed all the permissions. Apache user has access to all directories and files.
This was working ok in another server. I reviewed the php.ini files and there is no difference between them.
Maybe is a option that I'm not seeing, or an apache config option. I'm ran out of ideas.
Please help me!
Thanks in advance.
I have Linux, Cent OS. PHP 5.3.23
If permissions etc.. are all ok, possibly the apache config. in your setup has the 'ChrootDir' set:
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir
This uses the syscall chroot() and the view for '/' dir for that process starts from this setup dir, and hence everything should be relative to it.
I've created PHP project with MS WebMatrix and copied the CakePHP into it. It promped:
URL rewriting is not properly configured on your server.
But, except that, everything is fine:
Your version of PHP is 5.2.8 or higher.
Your tmp directory is writable.
The FileEngine is being used for core caching. To change the config edit APP/Config/core.php
Your database configuration file is present.
Cake is able to connect to the database.
I believe I should just edit httpd.conf file (CakePHP documentation told me so) but I couldn't find such a file at all... is it hidden somewhere or is there any GUI configurator? I'm new to Windows so really, don't know where to search and Google told me nothing but obvious Linux directory...
I could just upload all the files to the server and work from there but that's just not really handy.
You should edit .htaccess file in the app root folder. IIS configuration needs some modification in the htaccess files in your cakephp project.
Hope it will work for you. Please ask if it not worked for you.