installed php, but there is nothing in /etc/init.d/php - php

I read a lot of posts about php problems and ect. They all say to install php, restart apache server and so on..
But the problem is that after I run:
sudo apt-get install php
and even if I check the version:
justas#justas-Lenovo-M490s ~ $ php -v
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies
there is nothing about php in my /etc/init.d/ folder. So for example:
if I create something in /var/www/html/ folder, like file info.php with:
<?php phpinfo(); ?>
and then I open localhost/info.php. I get raw data ( ). My php is not firing and not doing anything.
Could someone please give me some info about what is happening?
I've been using Homestead and vagrant setup in the past, but for this project I would love to configure local lamp. Mby homestead, phpadmin is somehow interfering with my vanila setup? :/

I purged apache/php/mysql. Redid everything and it seems that that fixed my problem. I still don't know what caused the issue and why php was not running properly. Because I had configured and installed all necessary models. Mby there were some problems with my old phpadmin configuration that caused some misunderstandings.

Related

How to upgrade PHP 7.0.27 to 7.3 on Google Cloud?

I have been trying to upgrade the current version of PHP (7.0.2) to 7.3.
I have tried this method here which helped me install v7.3, but it does not get activated.
Here's what else I tried:
I stopped and started VM Instance
I restarted apache2
Tried locating app.yaml to modify the PHP runtime specified here, but couldn't find it.
I tried reinstalling apache since it was giving some error
But none of these helped. I also read here that it's not possible without migrating to a new instance, which truly is a pain and I would want to avoid that at all costs.
Now sure what I should share so here are some stuff:
This is what I get for php -v
$ php -v
PHP 7.0.27 (cli) (built: Jan 19 2018 12:12:50) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.27, Copyright (c) 1999-2017, by Zend Technologies
Am I missing out on something very obvious?
I am not much of a coder, so be gentle :P
In your app.yaml add:
runtime: php73
GCP - PHP 7 Runtime Environment

Drupal 8 installation setup shows older PHP version than what the server is running

When installing Drupal 8, just before database setup, I get a few errors and warnings, but I also see the following:
PHP
7.1.14-1+ubuntu16.04.1+deb.sury.org+1
However, doing php -v I get:
PHP 7.2.2-3+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Feb 6 2018 16:11:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.2-3+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
Clearly, my web server is running 7.2 but Drupal thinks it's 7.1. This is causing a problem where I have gd installed on PHP 7.2, but Drupal doesn't see gd installed on PHP 7.1 (because it isn't, at least its php.ini file doesn't have the gd extension enabled). Same with a few of the other errors and warnings.
How can I get Drupal 8 to recognize the correct PHP version?
So I figured it out:
Runing sudo a2dismod php7.1 then sudo a2enmod php7.2 seems to work perfectly (after a restart of Apache).
Try To install using composer
This method creates a project in web folder and other files outside web folder
composer create-project drupal-composer/drupal-project:8.x-dev d8_test_project --stability dev --no-interaction
Or
This method creates a project in a normal folder structure
composer create-project drupal/drupal my_site_name 8.*#dev --no-dev
I don't think it's about "recognizing" version, but you most likely have 2 different versions, one for console and other for web server. Run phpinfo() and see what PHP version is used by web server.

error upgrading php in mac

I am running OSX El Capitan (version 10.11.6).
I had php 5.5 installed.
Phpunit requires php5.6 and more so I tried to upgrade my php to 5.6. I couldn't do it so I gave php7 a try.
I followed these guides:
https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://php-osx.liip.ch/
Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?
My current output with php -v is :
PHP 7.0.12 (cli) (built: Nov 1 2016 10:21:11) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.12, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
Funny thing, my output with a phpinfo(); when called from somewhere inside a Symfony project, is still PHP Version 5.5.36
Any ideas??
Terminal uses a different PHP than a HTTP server in browser. You can check what PHP you're using in CLI (command line interface) by this terminal command:
$ which php
I don't know if you use any AMP stack (like MAMP). They include their own PHP, so you need to update them in order to have a different PHP version in browser.
Maybe you can use this trick to determine what PHP versions you use in browser / CLI: Find the php.ini path in your phpinfo() output and compare it with this terminal command:
$ php -i | grep php.ini
It's always a good idea to use the debug URL to troubleshoot your Symfony projects; to use this, simply append:
app_dev.php
For example if your route was like http://myhome/, then you would use:
http://myhome/app_dev.php
Then on the bottom of your browser you will have the Symfony debug bar. In the bottom right corner, the version of Symofny is shown, an if you move your mouse over it, you will see the version of PHP; plus also a link to "View phpinfo()". You can click on it to view the full PHP information, including where the PHP file is located.
The PHP config file used (shown on the phpinfo() page) is shown by:
Loaded Configuration File
Hope that helps!

php version install issues for terminal and phpinfo()

In my terminal put that command
# php -v
i am getting
PHP 5.6.23-2+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
but in my localhost phpinfo();
i am getting 5.5.9
PHP Version 5.5.9-1ubuntu4.14
how can i got 5.6 in locahost phpinfo();
i am using localhost wamp server in ubundu os..
The PHP application and the Apache server will load different php.ini files,
wamp provides one in the apache directory and php itself will use the one in it's own php directory (where the apps are located)
To check that, you can do php -i | grep php.ini and compare it to the loaded Configuration File you get from your browser when using phpinfo()
To work around this issue, either install LAMP yourself, or try to link the two files together somehow.
Reference to another Stack Overflow question on the same topic

How to use wsdl2phpgenerator on WAMP

I'm having a lot of trouble trying to get the php for a soap wsdl request working. I came across wsdl2phpgenerator which sounds like it generates the code for the service you want? Problem is I can't figure out how to use it. I'm running WAMP on my local machine. How do i install and use, the instruction don't seem to make a lot of sense to me.
I guess you use windows when you use WAMP.
You should not run the wsdl2phpgenerator through apache. You need to run it on the commandline.
step 1:
First open the CMD and type:
php --version
If the cmd prints something out like :
PHP 5.4.19 (cli) (built: Aug 23 2013 00:51:43)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
go to step 3:
step 2: add php to windows env path:
https://stackoverflow.com/a/9546345/1210773
use the path to your own php installation
after this run step 1 to validate php is correctly setup
Step3: run wsdl2phpgenerator
move the cmd to the wsdl2phpgenerator dir and run wsdl2php
I found some examples in the wsdl2phpgenerator documentation:
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/wiki/ExampleUsage

Categories