This question already has answers here:
How to enable PHP short tags?
(21 answers)
Closed 6 years ago.
I have installed nginx in ubuntu, and apparently have a newer version of php, which forces me to put <? Php in all websites if not read, I have a fairly large and serious system problem updating all as I can do to remove that restriction and using the simple <?
You can configure it on your php.ini. Nginx is not related, it is a web server.
Enable the short tag modifying your php.ini with this command
sudo nano /etc/php5/apache2/php.ini
and add this line
short_open_tag = On
Close nano and restart nginx with this command
sudo service nginx restart
Related
This question already has answers here:
The mysqli extension is missing. Please check your PHP configuration
(17 answers)
Closed 1 year ago.
I already checked in php.ini that
extension=mbstring
extension=exif
extension=pdo_mysql
are uncommented.
The mysqli.dll file is at ext folder in PHP.
I restarted my server and run as administrator.
I also restarted my PC but the error is still there.
I am using PHP7.4.3 with Apache 2.4 and MySQL 8 with phpMyAdmin.
add path in extension php.ini file.
like this ...
extension=E:\Aplikasi\XAMPP\php\php_mysqli.dll
I had got the same issue and found out that there are 2 PHP on my machine. So, I changed listen port to another port 81 in httpd.conf.
This question already has answers here:
Apache shows PHP code instead of executing it
(28 answers)
Closed 5 years ago.
i'm new in AWS and Ubuntu
i've facing a issue to execute php file on aws,
i've already install php and apache.
when I access aws it show file is there,but this file in directory
var/www/html/phpinfo.php
But when I delete file from var/www/html/phpinfo.php and past var/www/phpinfo.php no file show aws public IP, but on var/www/html/phpinfo.php it show plain php code
Update
follow these step
in apache2,conf
SetHandler application/x-httpd-php
then using terminal
sudo a2dismod mpm_event && sudo a2enmod mpm_prefork && sudo a2enmod php7
it show following message
considering conflict php5 for php7
module php7.0 already enabled
Enable Modes
etc/apache2/mods-enabled ls
I find these also
php7.0.conf and php7.0.load
By default apache2 point to /var/www/html/
So if you put your file in /var/www/ it's normal that you don't seen the file.
To change this you can edit your apache2.conf file
vi /etc/apache2/apache2.conf
For your second issue (apache2 showing plain php code)
It means that apache2 don't pass the code to your php interpreter.
Make sure that php is enable by checking that these 2 links are in the mod-enable folder in your /etc/apache2
lrwxrwxrwx 1 root root 29 août 3 14:30 php7.0.conf -> ../mods-available/php7.0.conf
lrwxrwxrwx 1 root root 29 août 3 14:30 php7.0.load -> ../mods-available/php7.0.load
if you don't have these links, type the following and try again:
a2enmod php7.0
service apache2 restart
.
Installing Apache and PHP is not enough, you also have to configure Apache properly to handle its mod_php when a file with the ".php" extension is requested.
You can find tons of articles about how to do that here and there on the Web :-) , but here is a good example:
http://symfony.com/doc/current/setup/web_server_configuration.html#apache-with-mod-php-php-cgi
This question already has answers here:
PHP code is not being executed, but the code shows in the browser source code
(35 answers)
Closed 6 years ago.
Well, I am having problem while installing phpmyadmin to my linux system. I followed all the instruction from digital ocean. After, I verify it in the browser then it shows this kind of php code.
Did I miss something during my installation? My version of php is 7 and I am using ubuntu 14.04.
Its seems that your server(Apache) is not recognizing php script as PHP language to be executed. At first check whether PHP is enable or not by running the following command in your terminal:
a2query -m php7.0
If it says somathing like PHP is not enable then run the following command:
sudo a2enmod php7.0
Then restart your Apache2 server with the following command:
sudo service apache2 restart
Try refreshing the phpmyadmin page now. Hope this will solve your problem. Best of luck
After you install php for (I'm assuming) Apache you need to restart the webserver for it to read the config files.
This question already has an answer here:
Yosemite Apache, PHP info page not shown
(1 answer)
Closed 7 years ago.
I'm trying to configure php 5.6 with apache 2.4. I installed php5.6 and apache2.4 using brew on a mac (yosemite).
But when I go to view my test.php page that only has
<?
phpfinfo()
?>
it's just displaying the php source. Even though I've Loaded the php5 module in apache
LoadModule php5_module /usr/local/Cellar/php56/5.6.9/libexec/apache2/libphp5.so
I have restarted apache after making the changes above.
Any suggestions would be grateful.
Cheers
Add PHP handler into apache configuration.
Currently your Apache does not know how to handle .php files, and passes then as text :)
This question already has answers here:
Browser ask me to download php file
(4 answers)
Closed 8 years ago.
I began following a tutorial about PHP. Reached the form handling. But here it is: when I do what they say and press Submit, it gives me to save the .php file instead of executing it? What am I missing here?
You are missing an HTTP server that supports PHP and is configured to use it. PHP (in the context on the WWW) is a server side technology.
You may not actually be running a web server, and instead may be simply loading local files in your web browser. Install an easy setup web server and PHP setup package. On Windows, WAMP is recommended. On MacOS, the equivalent is MAMP
Rather than opening files from your local drive, you then access them as (for example):
http://localhost/your_php_file.php
It is a misconfiguration of the server. Perhaps the recommendations here could help. Either PHP isn't installed or Apache was not configured.
You are missing the Apache server and required PHP installation.
If you are on windows. Go to this link Wamp and select Downloads and download the latest version of Wamp.
For Mac OS you can use Mamp
Download and install it in your machine.
If you are on Linux - Ubuntu you can do:
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
After installation place your php code in configured folder where the php is set to run and then go to browser and take the url : http://localhost/yourphp.file.
Hope this helps